#include <source/hierarchy/dlbg/LayerNodeSet.h>
Public Types | |
enum | ParallelState { DISTRIBUTED, GLOBALIZED } |
Names of parallel states. More... | |
typedef LayerNode< DIM > | Node |
typedef std::set< Node > | NodeContainer |
Container for nodes. | |
Public Member Functions | |
LayerNodeSet () | |
Default constructor. | |
LayerNodeSet (const LayerNodeSet &r) | |
Construct using a deep copy. | |
virtual | ~LayerNodeSet (void) |
Destructor. | |
LayerNodeSet & | operator= (const LayerNodeSet &r) |
Assignment operator duplicates edge data and reference to layer node set and sets up a similar partner relationship and parallel state. | |
bool | hasNode (const int local_index, const int owner=-1) const |
Whether object has a given node. | |
bool | hasNode (Node &node) const |
Whether object has a given node. | |
void | setParallelState (const ParallelState parallel_state) |
Set the parallel state. | |
void | setParallelState (LayerNodeSet *layers, const int num_layers, ParallelState parallel_state) const |
Set the parallel state for multiple layers. | |
ParallelState | getParallelState () const |
void | deallocateData () |
Deallocate internal node data. | |
virtual void | printClassData (std::ostream &os, int detail_depth=0) const |
Manually access internal data | |
const NodeContainer & | getNodeContainer (const int rank=-1) const |
Returns the container of nodes for a given process. | |
const hier::IntVector< DIM > & | getRefinementRatio () const |
void | setRefinementRatio (const hier::IntVector< DIM > &ratio) |
void | setTo (const hier::PatchLevel< DIM > &level) |
void | setTo (const LayerNodeSet &layer) |
NodeContainer::iterator | addBox (const hier::Box< DIM > &box, const bool use_vacant_index=true) |
Create new node from given box and append. | |
void | eraseNode (const typename NodeContainer::iterator &inode) |
Erase an existing node. | |
void | eraseNode (const Node &node) |
Erase an existing node. |
This class is a part of the distributed box-graph management. The distributed box-graph is described in the LayerEdgeSet documentation.
The primary purpose of this class is to organize local node data and (when applicable) nonlocal node data. It performs the communication necessary to acquire data on nonlocal nodes.
A local LayerNode is owned by the local process (see LayerNode for ownership). A remote LayerNode is owned by a remote process.
An LayerNodeSet can be in one of two parallel states:
The parallel state is changed by calling setParallelState(). Note that going from DISTRIBUTED to GLOBALIZED state requires an all-to-all gather communication, the performance of which should be carefully considered if used frequently. The GLOBALIZED state also requires more memory. Going from GLOBALIZED state to distributed state is cheap.
The general attributes of a LayerNodeSet are
typedef LayerNode<DIM> SAMRAI::hier::LayerNodeSet< DIM >::Node |
typedef std::set<Node> SAMRAI::hier::LayerNodeSet< DIM >::NodeContainer |
Container for nodes.
This is a sorted container so it can be compared without expensive searches. A node can be removed or added without changing the indices of existing nodes.
enum SAMRAI::hier::LayerNodeSet::ParallelState |
SAMRAI::hier::LayerNodeSet< DIM >::LayerNodeSet | ( | ) |
Default constructor.
The default constructor creates object in distributed state.
SAMRAI::hier::LayerNodeSet< DIM >::LayerNodeSet | ( | const LayerNodeSet< DIM > & | r | ) |
Construct using a deep copy.
New object has the same parallel state as original.
SAMRAI::hier::LayerNodeSet< DIM >::~LayerNodeSet | ( | void | ) | [virtual] |
Destructor.
Deallocate internal data.
LayerNodeSet< DIM > & SAMRAI::hier::LayerNodeSet< DIM >::operator= | ( | const LayerNodeSet< DIM > & | r | ) |
Assignment operator duplicates edge data and reference to layer node set and sets up a similar partner relationship and parallel state.
If r
is attached to itself, self-attach. If r
is attached but not to itself, create a duplicate partner and attach to it.
All other data is directly copied.
const LayerNodeSet< DIM >::NodeContainer & SAMRAI::hier::LayerNodeSet< DIM >::getNodeContainer | ( | const int | rank = -1 |
) | const |
Returns the container of nodes for a given process.
If rank is omitted, it refers to the local process. If rank is not the local process, the object must be if in GLOBALIZED state.
const hier::IntVector< DIM > & SAMRAI::hier::LayerNodeSet< DIM >::getRefinementRatio | ( | ) | const |
void SAMRAI::hier::LayerNodeSet< DIM >::setRefinementRatio | ( | const hier::IntVector< DIM > & | ratio | ) |
void SAMRAI::hier::LayerNodeSet< DIM >::setTo | ( | const hier::PatchLevel< DIM > & | level | ) |
void SAMRAI::hier::LayerNodeSet< DIM >::setTo | ( | const LayerNodeSet< DIM > & | layer | ) |
LayerNodeSet< DIM >::NodeContainer::iterator SAMRAI::hier::LayerNodeSet< DIM >::addBox | ( | const hier::Box< DIM > & | box, | |
const bool | use_vacant_index = true | |||
) |
Create new node from given box and append.
The new node will be assigned an unused local index. To be efficient, no communication will be used. Therefore, the state must be distributed.
void SAMRAI::hier::LayerNodeSet< DIM >::eraseNode | ( | const typename NodeContainer::iterator & | inode | ) |
Erase an existing node.
The given iterator MUST be a valid iterator pointing to a node currently in this object.
void SAMRAI::hier::LayerNodeSet< DIM >::eraseNode | ( | const Node & | node | ) |
Erase an existing node.
The given node MUST match a node currently in this object.
bool SAMRAI::hier::LayerNodeSet< DIM >::hasNode | ( | const int | local_index, | |
const int | owner = -1 | |||
) | const |
Whether object has a given node.
If owner
is omitted, the local process is the presumed owner. If node is not locally owned, the state must be GLOBALIZED.
bool SAMRAI::hier::LayerNodeSet< DIM >::hasNode | ( | Node & | node | ) | const |
Whether object has a given node.
Search for a node with the owner and local index matching the given node. (The box of the given node is ignored and need not be set.) If node is not locally owned, and the state not GLOBALIZED, it is an error.
If the node is found, the box of node
will be set to the correct box for the corresponding node and the return value is true. Otherwise, node is not modified and false is returned.
void SAMRAI::hier::LayerNodeSet< DIM >::setParallelState | ( | const ParallelState | parallel_state | ) |
Set the parallel state.
This method is not necessarily trivial. Acquiring nonlocal node information (when going to GLOBALIZED mode) triggers all-gather communication. More memory is required to store additional nodes.
Data not used by the new state gets deallocated.
void SAMRAI::hier::LayerNodeSet< DIM >::setParallelState | ( | LayerNodeSet< DIM > * | layers, | |
const int | num_layers, | |||
ParallelState | parallel_state | |||
) | const |
Set the parallel state for multiple layers.
This method will combine messages for all the layers into a single communication phase.
This method is stateless.
LayerNodeSet< DIM >::ParallelState SAMRAI::hier::LayerNodeSet< DIM >::getParallelState | ( | ) | const [inline] |
void SAMRAI::hier::LayerNodeSet< DIM >::deallocateData | ( | ) |
Deallocate internal node data.
The containers are not deallocated. They are just emptied.
void SAMRAI::hier::LayerNodeSet< DIM >::printClassData | ( | std::ostream & | os, | |
int | detail_depth = 0 | |||
) | const [virtual] |