IBAMR  IBAMR version 0.19.
Public Types | Public Member Functions | List of all members
SAMRAI::hier::LayerNodeSet< DIM > Class Template Reference

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< NodeNodeContainer
 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...
 
LayerNodeSetoperator= (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

NodeContainerd_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::Timert_acquire_nonlocal_nodes
 Timer. More...
 
const NodeContainergetNodeContainer (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
 
NodeContainergetMutableNodeContainer (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 intacquireNonlocalNodes_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...
 

Detailed Description

template<int DIM>
class SAMRAI::hier::LayerNodeSet< DIM >

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

Member Typedef Documentation

◆ Node

template<int DIM>
typedef LayerNode<DIM> SAMRAI::hier::LayerNodeSet< DIM >::Node

◆ NodeContainer

template<int DIM>
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.

Member Enumeration Documentation

◆ ParallelState

Enumerator
DISTRIBUTED 
GLOBALIZED 

Constructor & Destructor Documentation

◆ LayerNodeSet() [1/2]

template<int DIM>
SAMRAI::hier::LayerNodeSet< DIM >::LayerNodeSet ( )

The default constructor creates object in distributed state.

◆ LayerNodeSet() [2/2]

template<int DIM>
SAMRAI::hier::LayerNodeSet< DIM >::LayerNodeSet ( const LayerNodeSet< DIM > &  r)

New object has the same parallel state as original.

◆ ~LayerNodeSet()

template<int DIM>
virtual SAMRAI::hier::LayerNodeSet< DIM >::~LayerNodeSet ( void  )
virtual

Deallocate internal data.

Member Function Documentation

◆ operator=()

template<int DIM>
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.

◆ getNodeContainer()

template<int DIM>
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.

◆ getRefinementRatio()

template<int DIM>
const hier::IntVector<DIM>& SAMRAI::hier::LayerNodeSet< DIM >::getRefinementRatio ( ) const

◆ setRefinementRatio()

template<int DIM>
void SAMRAI::hier::LayerNodeSet< DIM >::setRefinementRatio ( const hier::IntVector< DIM > &  ratio)

◆ setTo() [1/2]

template<int DIM>
void SAMRAI::hier::LayerNodeSet< DIM >::setTo ( const hier::PatchLevel< DIM > &  level)

◆ setTo() [2/2]

template<int DIM>
void SAMRAI::hier::LayerNodeSet< DIM >::setTo ( const LayerNodeSet< DIM > &  layer)

◆ addBox()

template<int DIM>
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.

Returns
iterator to the new node

◆ eraseNode() [1/2]

template<int DIM>
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.

◆ eraseNode() [2/2]

template<int DIM>
void SAMRAI::hier::LayerNodeSet< DIM >::eraseNode ( const Node node)

The given node MUST match a node currently in this object.

◆ hasNode() [1/2]

template<int DIM>
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.

Returns
Whether the specified node exists in the object.

◆ hasNode() [2/2]

template<int DIM>
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.

Returns
Whether the specified node exists in the object.

◆ setParallelState() [1/2]

template<int DIM>
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.

◆ setParallelState() [2/2]

template<int DIM>
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.

◆ getParallelState()

template<int DIM>
ParallelState SAMRAI::hier::LayerNodeSet< DIM >::getParallelState ( ) const

◆ deallocateData()

template<int DIM>
void SAMRAI::hier::LayerNodeSet< DIM >::deallocateData ( )

The containers are not deallocated. They are just emptied.

◆ printClassData()

template<int DIM>
virtual void SAMRAI::hier::LayerNodeSet< DIM >::printClassData ( std::ostream &  os,
int  detail_depth = 0 
) const
virtual

◆ getMutableNodeContainer()

template<int DIM>
NodeContainer& SAMRAI::hier::LayerNodeSet< DIM >::getMutableNodeContainer ( const int  rank = -1)
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.

◆ acquireNonlocalNodes() [1/2]

template<int DIM>
void SAMRAI::hier::LayerNodeSet< DIM >::acquireNonlocalNodes ( const int  hogging_process = -1)
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.

◆ acquireNonlocalNodes_pack()

template<int DIM>
void SAMRAI::hier::LayerNodeSet< DIM >::acquireNonlocalNodes_pack ( tbox::Array< int > &  send_mesg,
int  offset 
) const
private

◆ acquireNonlocalNodes_unpack() [1/3]

template<int DIM>
void SAMRAI::hier::LayerNodeSet< DIM >::acquireNonlocalNodes_unpack ( const tbox::Array< int > &  recv_mesg,
tbox::Array< int > &  proc_offset 
)
private

◆ acquireNonlocalNodes_unpack() [2/3]

template<int DIM>
void SAMRAI::hier::LayerNodeSet< DIM >::acquireNonlocalNodes_unpack ( const tbox::Array< int > &  recv_mesg)
private

◆ acquireNonlocalNodes_unpack() [3/3]

template<int DIM>
const int* SAMRAI::hier::LayerNodeSet< DIM >::acquireNonlocalNodes_unpack ( const int recv_mesg,
const int  src_rank 
)
private

◆ acquireNonlocalNodes() [2/2]

template<int DIM>
void SAMRAI::hier::LayerNodeSet< DIM >::acquireNonlocalNodes ( const int  num_sets,
LayerNodeSet< DIM > *  layer_node_sets[],
const int  hogging_process = -1 
)
private

This method combines communication for the multiple layers to increase message passing efficiency.

Note: This method is stateless (could be static).

Member Data Documentation

◆ d_nodes

template<int DIM>
NodeContainer* SAMRAI::hier::LayerNodeSet< DIM >::d_nodes
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.

◆ d_ratio

template<int DIM>
hier::IntVector<DIM> SAMRAI::hier::LayerNodeSet< DIM >::d_ratio
private

◆ d_parallel_state

template<int DIM>
ParallelState SAMRAI::hier::LayerNodeSet< DIM >::d_parallel_state
private

Modified by setParallelState().

◆ d_rank

template<int DIM>
const int SAMRAI::hier::LayerNodeSet< DIM >::d_rank
private

We save this because we use it frequently.

◆ t_acquire_nonlocal_nodes

template<int DIM>
tbox::Pointer<tbox::Timer> SAMRAI::hier::LayerNodeSet< DIM >::t_acquire_nonlocal_nodes
private

The documentation for this class was generated from the following file: