25 class TraversalObserver;
26 struct GridStatistics;
27 struct AutomatonState;
69 virtual bool run()
override;
146 template <
class Container>
158 template <
class Container>
174 template <
class Container>
176 Container& stackContainer,
177 int spacetreeId,
int parentId
180 template <
class Container>
182 Container& stackContainer,
195 template <
class Container>
285 template <
class Container>
288 template <
class Container>
501 int spacetreeId,
int parentId,
502 const std::set<int>& joiningIds
std::bitset< Dimensions > periodicBC
Each task triggers the traversal of one specific spacetree.
SpacetreeSet & _spacetreeSet
virtual bool run() override
I create the copy of the observer, run the traversal on my local tree _spacetree and finally destroy ...
const bool _invertTreeTraversalDirectionBeforeWeStart
peano4::grid::TraversalObserver & _observer
peano4::grid::Spacetree & _spacetree
TraverseTask(peano4::grid::Spacetree &tree, SpacetreeSet &set, peano4::grid::TraversalObserver &observer, bool invertTreeTraversalDirectionBeforeWeStart)
The spacetree set has to be a singleton, as it is reponsible to accept requests for new trees from re...
void exchangeVerticalDataBetweenTrees(peano4::grid::TraversalObserver &observer)
void addSpacetree(int masterId, int newTreeId)
Adds a new spacetree to the set.
@ TraverseTreesAndExchangeData
void createNewTrees()
This operation should be called pretty close towards the end of a traversal.
std::map< int, peano4::grid::TraversalObserver * > _clonedObserver
I create/clone one observer per local tree.
static void streamDataFromSplittingTreeToNewTree(Container &stackContainer, int master, int worker)
Copies (streams) data from the master to the worker.
static void exchangeAllPeriodicBoundaryDataStacks(Container &stackContainer, int spacetreeId)
Exchange periodic BC data.
SpacetreeSet & operator=(const SpacetreeSet &)=delete
peano4::grid::Spacetree & getSpacetree(int id)
static void deleteAllStacks(Container &stackContainer, int spacetreeId)
SpacetreeSet(const SpacetreeSet &)=delete
void streamLocalVertexInformationToMasterThroughVerticalStacks(int spacetreeId, int parentId, const std::set< int > &joiningIds)
Whenever we join two partitions, we have to stream data from the worker to the master.
std::set< int > getLocalTreesMergingWithWorkers() const
I need this routine for technical reasons: Prior to the sweep of trees, I have to identify all of tho...
SpacetreeSetState _state
The state identifies what the set is doing right now.
int getAnswerTag(int targetSpacetreeId) const
bool split(int treeId, const peano4::SplitInstruction &instruction, int targetRank)
Split a local tree.
int _requestMessageTag
I use this tag to identify messages send from one tree to another rank.
static std::string toString(SpacetreeSetState state)
void deleteClonedObservers()
void createObserverCloneIfRequired(peano4::grid::TraversalObserver &observer, int treeId)
Quick lookup whether an observer clone for this tree id does already exist.
int _answerMessageTag
Never use this tag directly.
virtual void receiveDanglingMessages() override
We poll the tree management messages.
void answerQuestions()
Run through the set of unanswered questions and, well, answer them.
peano4::grid::GridStatistics getGridStatistics() const
Return statistics object for primary spacetree.
std::list< peano4::grid::Spacetree > _spacetrees
These are the local spacetrees.
void init(const tarch::la::Vector< Dimensions, double > &offset, const tarch::la::Vector< Dimensions, double > &width, const std::bitset< Dimensions > &periodicBC=0)
void exchangeHorizontalDataBetweenTrees(peano4::grid::TraversalObserver &observer)
void cleanUpTrees(peano4::grid::TraversalObserver &observer)
static SpacetreeSet & getInstance()
std::set< int > getLocalSpacetrees() const
static void exchangeAllVerticalDataExchangeStacks(Container &stackContainer, int spacetreeId, int parentId)
static tarch::logging::Log _log
Logging device.
virtual void shutdown() override
static SpacetreeSet _singleton
static void finishAllOutstandingSendsAndReceives(Container &stackContainer, int spacetreeId)
This routine finishes all the sends and receives that are still active, i.e.
~SpacetreeSet()
As the setis a singleton and a service, it has to deregister itself.
static tarch::multicore::BooleanSemaphore _semaphore
Semaphore to protect container holding all the local trees.
static void exchangeAllHorizontalDataExchangeStacks(Container &stackContainer, int spacetreeId, bool symmetricDataCardinality)
Realise domain boundary exchange (over multiple scales)
bool isLocalSpacetree(int treeId) const
Codes hold one spacetree set per rank.
void streamDataFromSplittingTreesToNewTrees(peano4::grid::TraversalObserver &observer)
Copy the data from a splitting tree onto its new workers.
void traverse(peano4::grid::TraversalObserver &observer)
Invoke traverse on all spacetrees in parallel.
static void streamDataFromJoiningTreeToMasterTree(Container &stackContainer, int master, int worker)
std::vector< peano4::parallel::TreeManagementMessage > _unansweredMessages
Abstract super class for a job.
The parallel namespace is Peano's core abstracts from both MPI and multicore parallelisation.