![]() |
Peano
|
#include <HierarchicalStackMap.h>
Data Structures | |
struct | TreeData |
Data of one tree. More... | |
Public Member Functions | |
HierarchicalStackMap () | |
~HierarchicalStackMap () | |
bool | empty (int treeId, int stackId) const |
void | clear () |
void | clear (int spacetree) |
T * | getForPush (int treeId, int stackId) |
Get the stack belonging to a tree. | |
T * | getForPush (const StackKey &key) |
T * | getForPop (int treeId, int stackId) |
T * | getForPop (const StackKey &key) |
std::string | toString () const |
std::set< StackKey > | getKeys () |
This one should be const, but I might need a semaphore, so I have to omit the const qualifier. | |
void | garbageCollection (int spacetree) |
bool | holdsStack (int treeId, int stackId) const |
For debugging/assertions. | |
bool | holdsStack (const StackKey &key) const |
Private Member Functions | |
void | createStack (int localTreeNumber, int stackNumber) |
This routine is not thread-safe, i.e. | |
Private Attributes | |
std::vector< TreeData > | _data |
A vector of maps. | |
There's one entry per tree. I use the mapping from global to local trees, so I don't have to maintain too many entries for 'just in case'. Each entry has a semaphore of its own. So if we need a lock, we only lock once per tree.
Definition at line 37 of file HierarchicalStackMap.h.
peano4::maps::HierarchicalStackMap< T >::HierarchicalStackMap | ( | ) |
Definition at line 227 of file HierarchicalStackMap.h.
peano4::maps::HierarchicalStackMap< T >::~HierarchicalStackMap | ( | ) |
Definition at line 217 of file HierarchicalStackMap.h.
void peano4::maps::HierarchicalStackMap< T >::clear | ( | ) |
Definition at line 251 of file HierarchicalStackMap.h.
Referenced by peano4.output.Makefile.Makefile::__init__(), and peano4::parallel::SpacetreeSet::shutdown().
void peano4::maps::HierarchicalStackMap< T >::clear | ( | int | spacetree | ) |
Definition at line 264 of file HierarchicalStackMap.h.
References peano4::parallel::Node::getInstance(), and peano4::parallel::Node::getLocalTreeId().
Referenced by peano4.output.Makefile.Makefile::__init__().
|
private |
This routine is not thread-safe, i.e.
if you need it thread-safe then you have to wrap it into a semaphore manually.
Definition at line 117 of file HierarchicalStackMap.h.
References assertion.
bool peano4::maps::HierarchicalStackMap< T >::empty | ( | int | treeId, |
int | stackId ) const |
Definition at line 132 of file HierarchicalStackMap.h.
References assertion3, assertion4, peano4::parallel::Node::getInstance(), and peano4::parallel::Node::getLocalTreeId().
Referenced by peano4::parallel::SpacetreeSet::streamDataFromSplittingTreesToNewTrees().
void peano4::maps::HierarchicalStackMap< T >::garbageCollection | ( | int | spacetree | ) |
Definition at line 233 of file HierarchicalStackMap.h.
References peano4::parallel::Node::getInstance(), peano4::parallel::Node::getLocalTreeId(), and peano4::parallel::Node::isStorageStackNumber().
T * peano4::maps::HierarchicalStackMap< T >::getForPop | ( | const StackKey & | key | ) |
Definition at line 180 of file HierarchicalStackMap.h.
References assertion3, assertion4, peano4::parallel::Node::getInstance(), and peano4::parallel::Node::getLocalTreeId().
T * peano4::maps::HierarchicalStackMap< T >::getForPop | ( | int | treeId, |
int | stackId ) |
Definition at line 174 of file HierarchicalStackMap.h.
T * peano4::maps::HierarchicalStackMap< T >::getForPush | ( | const StackKey & | key | ) |
Definition at line 163 of file HierarchicalStackMap.h.
References assertion3, assertion4, peano4::parallel::Node::getInstance(), tarch::mpi::Rank::getInstance(), peano4::parallel::Node::getLocalTreeId(), and tarch::mpi::Rank::getRank().
T * peano4::maps::HierarchicalStackMap< T >::getForPush | ( | int | treeId, |
int | stackId ) |
Get the stack belonging to a tree.
There are two versions of the routine: one is thread-safe, the other one does not employ a dedicated semaphore. The one with a semaphore can lazily create stacks; which is the reason why we need the semaphore: everytime we lazily insert new stacks, we run risk that we break the consistency of the underlying container. Originally, I worked with thread-safe accessors only. This resulted in disappointing timings and notably speedup. With a carelfull distinction, I got down the runtime to two third of the original.
Definition at line 142 of file HierarchicalStackMap.h.
Referenced by peano4::parallel::SpacetreeSet::streamDataFromSplittingTreesToNewTrees().
std::set< peano4::maps::StackKey > peano4::maps::HierarchicalStackMap< T >::getKeys | ( | ) |
This one should be const, but I might need a semaphore, so I have to omit the const qualifier.
Definition at line 205 of file HierarchicalStackMap.h.
References peano4::parallel::Node::getInstance().
bool peano4::maps::HierarchicalStackMap< T >::holdsStack | ( | const StackKey & | key | ) | const |
Definition at line 154 of file HierarchicalStackMap.h.
References assertion3, assertion4, peano4::parallel::Node::getInstance(), and peano4::parallel::Node::getLocalTreeId().
bool peano4::maps::HierarchicalStackMap< T >::holdsStack | ( | int | treeId, |
int | stackId ) const |
For debugging/assertions.
Definition at line 148 of file HierarchicalStackMap.h.
std::string peano4::maps::HierarchicalStackMap< T >::toString | ( | ) | const |
Definition at line 191 of file HierarchicalStackMap.h.
|
private |
A vector of maps.
I hold one entry per local spacetree, i.e. map all global ids onto local indices.
Definition at line 50 of file HierarchicalStackMap.h.
Referenced by peano4.datamodel.DaStGen2.DaStGen2Generator::construct_output(), peano4.datamodel.DaStGen2.DaStGen2GeneratorForObjectsWithSmartPointers::construct_output(), peano4.toolbox.particles.ParticleSet.ParticleSetGenerator_ScatteredOnHeap_IndexByList::construct_output(), peano4.toolbox.particles.ParticleSet.ParticleSetGenerator_ScatteredOnHeap_IndexByVector::construct_output(), peano4.toolbox.particles.ParticleSet.ParticleSetGenerator_ContinuousPerVertex::construct_output(), peano4.toolbox.particles.ParticleSet.ParticleSetGenerator_GlobalContinuous::construct_output(), peano4.datamodel.DaStGen2.DaStGen2Generator::get_header_file_include(), peano4.datamodel.DaStGen2.DaStGen2GeneratorForObjectsWithSmartPointers::get_header_file_include(), peano4.toolbox.particles.ParticleSet.AbstractParticleSetGenerator::get_header_file_include(), peano4.datamodel.DaStGen2.DaStGen2Generator::get_stack_container(), peano4.datamodel.DaStGen2.DaStGen2GeneratorForObjectsWithSmartPointers::get_stack_container(), peano4.datamodel.DynamicArrayOverPrimitivesToStdVector.DynamicArrayOverPrimitivesToStdVector::get_stack_container(), and peano4.toolbox.particles.ParticleSet.AbstractParticleSetGenerator::get_stack_container().