35 #ifndef DISTRIBUTEDBOXCOLLECTION_HPP_ 36 #define DISTRIBUTEDBOXCOLLECTION_HPP_ 39 #include <boost/serialization/vector.hpp> 42 #include "Element.hpp" 45 #include "DistributedVectorFactory.hpp" 53 template<
unsigned DIM>
57 friend class TestDistributedBoxCollection;
137 friend class boost::serialization::access;
145 template<
class Archive>
146 void serialize(Archive & archive,
const unsigned int version)
166 DistributedBoxCollection(
double boxWidth, c_vector<double, 2*DIM> domainSize,
bool isPeriodicInX =
false,
bool mIsPeriodicInY=
false,
bool mIsPeriodicInZ=
false,
int localRows = PETSC_DECIDE);
316 int LoadBalance(std::vector<int> localDistribution);
348 bool IsOwned(c_vector<double, DIM>& location);
426 namespace serialization
431 template<
class Archive,
unsigned DIM>
432 inline void save_construct_data(
439 MPI_Gather(&num_local_rows, 1, MPI_INT, &num_rows[0], 1, MPI_INT, 0, PETSC_COMM_WORLD);
447 for (
unsigned i=0; i<2*DIM; i++)
449 ar << domain_size[i];
458 std::vector<int>
const const_num_rows = num_rows;
459 ar << const_num_rows;
465 template<
class Archive,
unsigned DIM>
466 inline void load_construct_data(
473 c_vector<double,2*DIM> domain_size;
474 for (
unsigned i=0; i<2*DIM; i++)
478 domain_size[i] = coordinate;
482 for (
unsigned i=0; i<DIM; i++)
484 domain_size[2*i+1] -= 1e-14;
489 unsigned num_original_procs;
490 ar >> num_original_procs;
492 int num_rows = PETSC_DECIDE;
493 std::vector<int> original_rows;
std::vector< Box< DIM > > mBoxes
bool IsBoxOwned(unsigned globalIndex)
std::vector< unsigned > & rGetHaloNodesRight()
std::vector< unsigned > mHalosRight
unsigned CalculateContainingBox(Node< DIM > *pNode)
unsigned GetNumLocalBoxes()
void serialize(Archive &archive, const unsigned int version)
~DistributedBoxCollection()
double GetBoxWidth() const
bool IsInteriorBox(unsigned globalIndex)
DistributedBoxCollection(double boxWidth, c_vector< double, 2 *DIM > domainSize, bool isPeriodicInX=false, bool mIsPeriodicInY=false, bool mIsPeriodicInZ=false, int localRows=PETSC_DECIDE)
void CalculateBoundaryNodePairs(std::vector< Node< DIM > *> &rNodes, std::vector< std::pair< Node< DIM > *, Node< DIM > *> > &rNodePairs)
c_vector< double, 2 *DIM > rGetDomainSize() const
c_vector< double, 2 *DIM > mDomainSize
std::vector< std::set< unsigned > > mLocalBoxes
void AddPairsFromBox(unsigned boxIndex, std::vector< std::pair< Node< DIM > *, Node< DIM > *> > &rNodePairs)
std::vector< unsigned > mHalosLeft
void SetCalculateNodeNeighbours(bool calculateNodeNeighbours)
unsigned CalculateGlobalIndex(c_vector< unsigned, DIM > gridIndices)
std::vector< Box< DIM > > mHaloBoxes
std::vector< int > CalculateNumberOfNodesInEachStrip()
unsigned GetNumLocalRows() const
unsigned GetProcessOwningNode(Node< DIM > *pNode)
std::set< unsigned > & rGetLocalBoxes(unsigned boxIndex)
void SetupLocalBoxesHalfOnly()
static const double msFudge
bool mIsPeriodicAcrossProcs
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS(CLASS)
c_vector< unsigned, DIM > mNumBoxesEachDirection
std::vector< unsigned > & rGetHaloNodesLeft()
bool IsOwned(Node< DIM > *pNode)
std::vector< unsigned > mHaloNodesRight
bool GetIsPeriodicAcrossProcs() const
std::map< unsigned, unsigned > mHaloBoxesMapping
bool GetIsPeriodicInX() const
int LoadBalance(std::vector< int > localDistribution)
void CalculateInteriorNodePairs(std::vector< Node< DIM > *> &rNodes, std::vector< std::pair< Node< DIM > *, Node< DIM > *> > &rNodePairs)
bool GetIsPeriodicInY() const
bool mCalculateNodeNeighbours
bool GetIsPeriodicInZ() const
c_vector< unsigned, DIM > CalculateGridIndices(unsigned globalIndex)
bool IsHaloBox(unsigned globalIndex)
Box< DIM > & rGetHaloBox(unsigned boxIndex)
unsigned mNumBoxesInAFace
Box< DIM > & rGetBox(unsigned boxIndex)
void CalculateNodePairs(std::vector< Node< DIM > *> &rNodes, std::vector< std::pair< Node< DIM > *, Node< DIM > *> > &rNodePairs)
c_vector< bool, DIM > GetIsPeriodicAllDims() const
std::vector< unsigned > mHaloNodesLeft
bool GetAreLocalBoxesSet() const
gcov doesn't like this file...
DistributedVectorFactory * mpDistributedBoxStackFactory
void SetupAllLocalBoxes()
unsigned GetNumRowsOfBoxes() const