|
IBAMR
IBAMR version 0.19.
|
Encapsulates a set of LayerNode objects on the same index space. More...
#include <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. More... | |
Public Member Functions | |
| LayerNodeSet () | |
| Default constructor. More... | |
| LayerNodeSet (const LayerNodeSet &r) | |
| Construct using a deep copy. More... | |
| virtual | ~LayerNodeSet (void) |
| Destructor. More... | |
| 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. More... | |
Manually access internal data | |
| NodeContainer * | d_nodes |
| Locally-stored nodes. More... | |
| hier::IntVector< DIM > | d_ratio |
| Refinement ratio from some reference such as level 0. More... | |
| ParallelState | d_parallel_state |
| State flag. More... | |
| const int | d_rank |
| Process rank (id). More... | |
| tbox::Pointer< tbox::Timer > | t_acquire_nonlocal_nodes |
| Timer. More... | |
| const NodeContainer & | getNodeContainer (const int rank=-1) const |
| Returns the container of nodes for a given process. More... | |
| 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. More... | |
| void | eraseNode (const typename NodeContainer::iterator &inode) |
| Erase an existing node. More... | |
| void | eraseNode (const Node &node) |
| Erase an existing node. More... | |
| bool | hasNode (const int local_index, const int owner=-1) const |
| Whether object has a given node. More... | |
| bool | hasNode (Node &node) const |
| Whether object has a given node. More... | |
| void | setParallelState (const ParallelState parallel_state) |
| Set the parallel state. More... | |
| void | setParallelState (LayerNodeSet *layers, const int num_layers, ParallelState parallel_state) const |
| Set the parallel state for multiple layers. More... | |
| ParallelState | getParallelState () const |
| void | deallocateData () |
| Deallocate internal node data. More... | |
| virtual void | printClassData (std::ostream &os, int detail_depth=0) const |
| NodeContainer & | getMutableNodeContainer (const int rank=-1) |
| Returns the container of nodes for a given process. More... | |
| void | acquireNonlocalNodes (const int hogging_process=-1) |
| Get info on nonlocal nodes. More... | |
| void | acquireNonlocalNodes_pack (tbox::Array< int > &send_mesg, int offset) const |
| Pack local nodes into an integer array. More... | |
| void | acquireNonlocalNodes_unpack (const tbox::Array< int > &recv_mesg, tbox::Array< int > &proc_offset) |
| Unpack nodes from an integer array into internal storage. More... | |
| void | acquireNonlocalNodes_unpack (const tbox::Array< int > &recv_mesg) |
| const int * | acquireNonlocalNodes_unpack (const int *recv_mesg, const int src_rank) |
| void | acquireNonlocalNodes (const int num_sets, LayerNodeSet *layer_node_sets[], const int hogging_process=-1) |
| Get info on nonlocal nodes for multiple LayerNodeSet objects. More... | |
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 |
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 | ( | ) |
The default constructor creates object in distributed state.
| SAMRAI::hier::LayerNodeSet< DIM >::LayerNodeSet | ( | const LayerNodeSet< DIM > & | r | ) |
New object has the same parallel state as original.
|
virtual |
Deallocate internal data.
| LayerNodeSet& SAMRAI::hier::LayerNodeSet< DIM >::operator= | ( | const LayerNodeSet< DIM > & | r | ) |
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 NodeContainer& SAMRAI::hier::LayerNodeSet< DIM >::getNodeContainer | ( | const int | rank = -1 | ) | const |
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 | ) |
| NodeContainer::iterator SAMRAI::hier::LayerNodeSet< DIM >::addBox | ( | const hier::Box< DIM > & | box, |
| const bool | use_vacant_index = true |
||
| ) |
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 | ) |
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 | ) |
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 |
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 |
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 | ) |
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 |
This method will combine messages for all the layers into a single communication phase.
This method is stateless.
| ParallelState SAMRAI::hier::LayerNodeSet< DIM >::getParallelState | ( | ) | const |
| void SAMRAI::hier::LayerNodeSet< DIM >::deallocateData | ( | ) |
The containers are not deallocated. They are just emptied.
|
virtual |
|
private |
If rank is omitted, it refers to the local process. If rank is not the local process, the object must be in GLOBALIZED state.
This method is like the public getMutableNodeContainer, but returns a non-const reference for internal use.
|
private |
This requires global communication (all gather). This method is more complex than just performing a global data-share. To combine communication when a partner is attached, both communications are done together.
|
private |
|
private |
|
private |
|
private |
|
private |
This method combines communication for the multiple layers to increase message passing efficiency.
Note: This method is stateless (could be static).
|
private |
In distributed mode, this points to the container for the local nodes. In other modes, this is an array of containers, one for each process.
|
private |
|
private |
Modified by setParallelState().
|
private |
We save this because we use it frequently.
|
private |
1.8.17