SAMRAI::hier::LayerNodeSet< DIM > Class Template Reference

Encapsulates a set of LayerNode objects on the same index space. More...

#include <source/hierarchy/dlbg/LayerNodeSet.h>

List of all members.

Public Types

enum  ParallelState { DISTRIBUTED, GLOBALIZED }
 Names of parallel states. More...
typedef LayerNode< DIM > Node
typedef std::set< NodeNodeContainer
 Container for nodes.

Public Member Functions

 LayerNodeSet ()
 Default constructor.
 LayerNodeSet (const LayerNodeSet &r)
 Construct using a deep copy.
virtual ~LayerNodeSet (void)
 Destructor.
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.
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 NodeContainergetNodeContainer (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.


Detailed Description

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

Encapsulates a set of LayerNode objects on the same index space.

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

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

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


Member Enumeration Documentation

template<int DIM>
enum SAMRAI::hier::LayerNodeSet::ParallelState

Names of parallel states.

Enumerator:
DISTRIBUTED 
GLOBALIZED 


Constructor & Destructor Documentation

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

Default constructor.

The default constructor creates object in distributed state.

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

Construct using a deep copy.

New object has the same parallel state as original.

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

Destructor.

Deallocate internal data.


Member Function Documentation

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

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

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

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

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

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

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

Returns:
iterator to the new node

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

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

Erase an existing node.

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

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

Returns:
Whether the specified node exists in the object.

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

Returns:
Whether the specified node exists in the object.

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

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

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

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

Deallocate internal node data.

The containers are not deallocated. They are just emptied.

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


The documentation for this class was generated from the following files:
Generated on Thu Jun 18 11:28:28 2009 for SAMRAI by  doxygen 1.5.1