56 void createStack(
int localTreeNumber,
int stackNumber);
62 bool empty(
int treeId,
int stackId)
const;
69 void clear(
int spacetree);
111 bool holdsStack(
int treeId,
int stackId)
const;
119 assertion(localTreeNumber<
static_cast<int>(_data.size()));
120 if ( _data[localTreeNumber]._stackNumberToData.count(stackNumber)==0 ) {
121 _data[localTreeNumber]._stackNumberToData.insert(
122 std::pair< int, T* >(
134 assertion3(localTreeId>=0,localTreeId,treeId,stackId);
135 assertion4(localTreeId<_data.size(),localTreeId,_data.size(),treeId,stackId);
136 return _data[localTreeId]._stackNumberToData.count(stackId)==0
137 or _data[localTreeId]._stackNumberToData.at(stackId)->empty();
143 return getForPush(
StackKey(treeId,stackId) );
149 return holdsStack(
StackKey(treeId,stackId) );
156 assertion3(localTreeId>=0,localTreeId,key.first,key.second);
157 assertion4(localTreeId<
static_cast<int>(_data.size()),localTreeId,_data.size(),key.first,key.second);
158 return _data[localTreeId]._stackNumberToData.count(key.second)==1;
165 assertion3(localTreeId>=0,localTreeId,key.first,key.second);
166 assertion4(localTreeId<
static_cast<int>(_data.size()),localTreeId,_data.size(),key.first,key.second);
167 createStack(localTreeId,key.second);
169 return _data[localTreeId]._stackNumberToData[key.second];
175 return getForPop(
StackKey(treeId,stackId) );
182 assertion3(localTreeId>=0,localTreeId,key.first,key.second);
183 assertion4(localTreeId<
static_cast<int>(_data.size()),localTreeId,_data.size(),key.first,key.second);
184 assertion4(_data[localTreeId]._stackNumberToData.count(key.second)==1,localTreeId,_data.size(),key.first,key.second);
185 assertion3(key.second>=0,localTreeId,key.first,key.second);
186 return _data[localTreeId]._stackNumberToData.at(key.second);
192 std::string result =
"(" + std::to_string( _data.size() );
206 std::set<peano4::maps::StackKey> result;
207 for (
int i = 0; i < static_cast<int>(_data.size()); i++) {
208 for (
auto& pp: _data[i]._stackNumberToData) {
218 for (
auto& p: _data) {
219 for (
auto& pp: p._stackNumberToData) {
235 if (
static_cast<int>(_data.size()) > localTreeId) {
236 for (
auto& p: _data[localTreeId]._stackNumberToData) {
252 for (
auto& p: _data) {
253 for (
auto& pp: p._stackNumberToData) {
254 if (pp.second->empty()) {
266 if (
static_cast<int>(_data.size()) > localTreeId) {
267 for (
auto& p: _data[localTreeId]._stackNumberToData) {
#define assertion4(expr, param0, param1, param2, param3)
#define assertion3(expr, param0, param1, param2)
void createStack(int localTreeNumber, int stackNumber)
This routine is not thread-safe, i.e.
std::string toString() const
T * getForPush(int treeId, int stackId)
Get the stack belonging to a tree.
std::set< StackKey > getKeys()
This one should be const, but I might need a semaphore, so I have to omit the const qualifier.
bool holdsStack(int treeId, int stackId) const
For debugging/assertions.
std::vector< TreeData > _data
A vector of maps.
void garbageCollection(int spacetree)
bool empty(int treeId, int stackId) const
T * getForPop(int treeId, int stackId)
int getLocalTreeId(int treeId) const
static bool isStorageStackNumber(int number)
There are communication stacks and storage stacks.
static Node & getInstance()
This operation returns the singleton instance.
static Rank & getInstance()
This operation returns the singleton instance.
int getRank() const
Return rank of this node.
The parallel namespace is Peano's core abstracts from both MPI and multicore parallelisation.
std::pair< int, int > StackKey
Unique key identifying a stack.
std::map< int, T * > _stackNumberToData