35#ifndef DISTRIBUTEDBOXCOLLECTION_HPP_
36#define DISTRIBUTEDBOXCOLLECTION_HPP_
39#include <boost/serialization/vector.hpp>
45#include "DistributedVectorFactory.hpp"
57 friend class TestDistributedBoxCollection;
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 isPeriodicInY=
false,
bool isPeriodicInZ=
false,
int localRows = PETSC_DECIDE);
316 int LoadBalance(std::vector<int> localDistribution);
348 bool IsOwned(c_vector<double, DIM>& location);
426namespace serialization
431template<
class Archive,
unsigned DIM>
432inline void save_construct_data(
437 int num_local_rows = (int)(t->GetNumRowsOfBoxes());
439 MPI_Gather(&num_local_rows, 1, MPI_INT, &num_rows[0], 1, MPI_INT, 0, PETSC_COMM_WORLD);
443 bool are_boxes_set = t->GetAreLocalBoxesSet();
446 c_vector<double, 2*DIM> domain_size = t->rGetDomainSize();
447 for (
unsigned i=0; i<2*DIM; i++)
449 ar << domain_size[i];
452 double box_width = t->GetBoxWidth();
458 std::vector<int>
const const_num_rows = num_rows;
459 ar << const_num_rows;
465template<
class Archive,
unsigned DIM>
466inline 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;
505 t->SetupLocalBoxesHalfOnly();
gcov doesn't like this file...
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS(CLASS)
unsigned GetNumRowsOfBoxes() const
void AddPairsFromBox(unsigned boxIndex, std::vector< std::pair< Node< DIM > *, Node< DIM > * > > &rNodePairs)
std::vector< Box< DIM > > mBoxes
std::set< unsigned > & rGetLocalBoxes(unsigned boxIndex)
std::vector< std::set< unsigned > > mLocalBoxes
bool GetAreLocalBoxesSet() const
bool GetIsPeriodicInZ() const
~DistributedBoxCollection()
bool GetIsPeriodicInX() const
std::vector< Box< DIM > > mHaloBoxes
Box< DIM > & rGetHaloBox(unsigned boxIndex)
c_vector< double, 2 *DIM > rGetDomainSize() const
int LoadBalance(std::vector< int > localDistribution)
unsigned GetNumLocalRows() const
bool mCalculateNodeNeighbours
void CalculateNodePairs(std::vector< Node< DIM > * > &rNodes, std::vector< std::pair< Node< DIM > *, Node< DIM > * > > &rNodePairs)
void CalculateInteriorNodePairs(std::vector< Node< DIM > * > &rNodes, std::vector< std::pair< Node< DIM > *, Node< DIM > * > > &rNodePairs)
bool GetIsPeriodicInY() const
bool IsOwned(Node< DIM > *pNode)
unsigned GetProcessOwningNode(Node< DIM > *pNode)
bool mIsPeriodicAcrossProcs
std::vector< unsigned > mHaloNodesRight
void SetCalculateNodeNeighbours(bool calculateNodeNeighbours)
bool IsInteriorBox(unsigned globalIndex)
unsigned CalculateContainingBox(Node< DIM > *pNode)
std::vector< unsigned > & rGetHaloNodesLeft()
std::vector< int > CalculateNumberOfNodesInEachStrip()
bool IsBoxOwned(unsigned globalIndex)
std::vector< unsigned > mHalosLeft
std::vector< unsigned > & rGetHaloNodesRight()
std::vector< unsigned > mHalosRight
std::vector< unsigned > mHaloNodesLeft
bool GetIsPeriodicAcrossProcs() const
bool IsHaloBox(unsigned globalIndex)
static const double msFudge
DistributedVectorFactory * mpDistributedBoxStackFactory
unsigned GetNumLocalBoxes()
unsigned mNumBoxesInAFace
std::map< unsigned, unsigned > mHaloBoxesMapping
c_vector< bool, DIM > GetIsPeriodicAllDims() const
friend class boost::serialization::access
c_vector< double, 2 *DIM > mDomainSize
void SetupAllLocalBoxes()
void CalculateBoundaryNodePairs(std::vector< Node< DIM > * > &rNodes, std::vector< std::pair< Node< DIM > *, Node< DIM > * > > &rNodePairs)
c_vector< unsigned, DIM > mNumBoxesEachDirection
void SetupLocalBoxesHalfOnly()
double GetBoxWidth() const
unsigned CalculateGlobalIndex(c_vector< unsigned, DIM > gridIndices)
c_vector< unsigned, DIM > CalculateGridIndices(unsigned globalIndex)
void serialize(Archive &archive, const unsigned int version)
Box< DIM > & rGetBox(unsigned boxIndex)