IBAMR  IBAMR version 0.19.
Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SAMRAI::mesh::HistogramBox< DIM > Class Template Reference

Class HistogramBox<DIM> manages the histogram signature array for a region of index space contained within a single box. It is used during the regridding process to gather information about the distribution of tagged cells across a portion of a patch level.

#include <HistogramBox.h>

Public Types

enum  { ORIGINAL_MODE = 0, ORIG_FAST_REDUCE_MODE = 1, BINARY_TREE_MODE = 2, COMMUNICATOR_MODE = 3 }
 

Public Member Functions

 HistogramBox ()
 
 HistogramBox (const hier::Box< DIM > &box)
 
 ~HistogramBox ()
 
void findBoundBoxForTags (hier::Box< DIM > &bound_box, const hier::IntVector< DIM > &min_box) const
 
void boundTagHistogram (int &box_lo, int &box_hi, const int id, const int min_size) const
 
void setCommunicationMode (int mode)
 
void setCommunicator (tbox::SAMRAI_MPI::comm comm)
 
int computeTagHistogram (const tbox::Pointer< hier::PatchLevel< DIM > > level, const int tag_index, const int tag_val)
 
void reduceTags (const tbox::Pointer< hier::PatchLevel< DIM > > level)
 
void reduceTags (const int id, const tbox::Pointer< hier::PatchLevel< DIM > > level, const int tag_index, const int tag_val)
 
const hier::Box< DIM > & getBox () const
 
tbox::Array< int > & histogram (const int id)
 
const tbox::Array< int > & histogram (const int id) const
 
inthistogramElt (const int id, const int ic)
 
const inthistogramElt (const int id, const int ic) const
 
void setBox (const hier::Box< DIM > &box)
 
void resetHistogram ()
 

Private Member Functions

int computeTagHistogramOrig (const tbox::Pointer< hier::PatchLevel< DIM > > level, const int tag_index, const int tag_val)
 
void computeLocalHistogram (const int id, const tbox::Pointer< hier::PatchLevel< DIM > > level, const int tag_index, const int tag_val)
 

Static Private Member Functions

static void freeTimers ()
 

Private Attributes

hier::Box< DIM > d_box
 
tbox::Array< intd_histogram [DIM]
 
tbox::SAMRAI_MPI::comm d_comm
 
int d_communication_mode
 

Static Private Attributes

static tbox::Pointer< tbox::Timert_compute
 
static tbox::Pointer< tbox::Timert_commwait
 

Member Enumeration Documentation

◆ anonymous enum

template<int DIM>
anonymous enum

Enumerated type for the communication mode. For a description of each of these modes,

See also
mesh::BergerRigoutsos.
  • ORIGINAL_MODE {Original communication mode used in SAMRAI, through v1.3.1 (global reductions).}
  • ORIG_FAST_REDUCE_MODE {Original communication mode but with a 'faster' reduce operation.}
  • BINARY_TREE_MODE {Reduces all-to-all communication costs using explicit tbox::MPI send/recvs in a binary tree, rather than global reductions.}
  • COMMUNICATOR_MODE {Similar to the binary tree option, but uses tbox::MPI communicators in place of the explicit send/recvs.}
Enumerator
ORIGINAL_MODE 
ORIG_FAST_REDUCE_MODE 
BINARY_TREE_MODE 
COMMUNICATOR_MODE 

Constructor & Destructor Documentation

◆ HistogramBox() [1/2]

template<int DIM>
SAMRAI::mesh::HistogramBox< DIM >::HistogramBox ( )

Default constructor for HistogramBox<DIM>. Note that the HistogramBox<DIM> must be initialized with a box before it can be used.

◆ HistogramBox() [2/2]

template<int DIM>
SAMRAI::mesh::HistogramBox< DIM >::HistogramBox ( const hier::Box< DIM > &  box)

Constructor for the HistogramBox<DIM>. The HistogramBox<DIM> will be initialized with the box and the histogram elements will be allocated and initialized to zero.

◆ ~HistogramBox()

template<int DIM>
SAMRAI::mesh::HistogramBox< DIM >::~HistogramBox ( )

Destructor for the HistogramBox.

Member Function Documentation

◆ findBoundBoxForTags()

template<int DIM>
void SAMRAI::mesh::HistogramBox< DIM >::findBoundBoxForTags ( hier::Box< DIM > &  bound_box,
const hier::IntVector< DIM > &  min_box 
) const

Given histogram information in a box region, determine smallest box containing non-zero histogram points. Note that this routine assumes that histogram values are already computed.

◆ boundTagHistogram()

template<int DIM>
void SAMRAI::mesh::HistogramBox< DIM >::boundTagHistogram ( int box_lo,
int box_hi,
const int  id,
const int  min_size 
) const

Bound the non-zero histogram elements within the specified interval (box_lo, box_hi) in the given coordinate direction.

◆ setCommunicationMode()

template<int DIM>
void SAMRAI::mesh::HistogramBox< DIM >::setCommunicationMode ( int  mode)

Set the method used to perform historgram reduction. (This function should only by called from within BergerRigoutsos<DIM>::findBoxesContainingTags.)

◆ setCommunicator()

template<int DIM>
void SAMRAI::mesh::HistogramBox< DIM >::setCommunicator ( tbox::SAMRAI_MPI::comm  comm)

Set the communicator to use during histogram reduction. This call only has an effect when used in conjunction with setCommunicationMode(COMMUNICATOR_MODE); (This function should only by called from within BergerRigoutsos<DIM>::findBoxesContainingTags.)

◆ computeTagHistogram()

template<int DIM>
int SAMRAI::mesh::HistogramBox< DIM >::computeTagHistogram ( const tbox::Pointer< hier::PatchLevel< DIM > >  level,
const int  tag_index,
const int  tag_val 
)

Compute histogram for integer tags (matching tag_val) within the histogram box on the patch level.

◆ reduceTags() [1/2]

template<int DIM>
void SAMRAI::mesh::HistogramBox< DIM >::reduceTags ( const tbox::Pointer< hier::PatchLevel< DIM > >  level)

Compute global histogram by performing a reduction sum on the local histograms. Note that the reduction is needed since the histogram box will not be contained within any single patch, in general. Also, if the integer tag patch data corresponding to the given descriptor index has ghost cells, the values in these cells are ignored so that the reduction sums data over patch interiors only.

◆ reduceTags() [2/2]

template<int DIM>
void SAMRAI::mesh::HistogramBox< DIM >::reduceTags ( const int  id,
const tbox::Pointer< hier::PatchLevel< DIM > >  level,
const int  tag_index,
const int  tag_val 
)

◆ getBox()

template<int DIM>
const hier::Box<DIM>& SAMRAI::mesh::HistogramBox< DIM >::getBox ( ) const

Return const reference to box represented by histogram.

◆ histogram() [1/2]

template<int DIM>
tbox::Array<int>& SAMRAI::mesh::HistogramBox< DIM >::histogram ( const int  id)

Return non-const reference to histogram array for given direction. Note that there is no bounds-checking on direction number.

◆ histogram() [2/2]

template<int DIM>
const tbox::Array<int>& SAMRAI::mesh::HistogramBox< DIM >::histogram ( const int  id) const

Return const reference to histogram array for given direction. Note that there is no bounds-checking on direction number.

◆ histogramElt() [1/2]

template<int DIM>
int& SAMRAI::mesh::HistogramBox< DIM >::histogramElt ( const int  id,
const int  ic 
)

Return non-const histogram element corresponding to given direction and cell index. Note cell index and histogram array location are distinct, in general. Also, there is no bounds checking done to assure the cell index lies within the box.

◆ histogramElt() [2/2]

template<int DIM>
const int& SAMRAI::mesh::HistogramBox< DIM >::histogramElt ( const int  id,
const int  ic 
) const

Return const histogram element corresponding to given direction and cell index. Note cell index and histogram array location are distinct, in general. Also, there is no bounds checking done to assure the cell index lies within the box.

◆ setBox()

template<int DIM>
void SAMRAI::mesh::HistogramBox< DIM >::setBox ( const hier::Box< DIM > &  box)

Set the box for the HistogramBox, allocate storage for the histogram signature arrays, and initialize the histogram elements to zero.

◆ resetHistogram()

template<int DIM>
void SAMRAI::mesh::HistogramBox< DIM >::resetHistogram ( )

Set all histogram elements to zero.

◆ computeTagHistogramOrig()

template<int DIM>
int SAMRAI::mesh::HistogramBox< DIM >::computeTagHistogramOrig ( const tbox::Pointer< hier::PatchLevel< DIM > >  level,
const int  tag_index,
const int  tag_val 
)
private

◆ computeLocalHistogram()

template<int DIM>
void SAMRAI::mesh::HistogramBox< DIM >::computeLocalHistogram ( const int  id,
const tbox::Pointer< hier::PatchLevel< DIM > >  level,
const int  tag_index,
const int  tag_val 
)
private

◆ freeTimers()

template<int DIM>
static void SAMRAI::mesh::HistogramBox< DIM >::freeTimers ( )
staticprivate

Free static timers.

To be called by shutdown registry to make sure memory for timers does not leak.

Member Data Documentation

◆ d_box

template<int DIM>
hier::Box<DIM> SAMRAI::mesh::HistogramBox< DIM >::d_box
private

◆ d_histogram

template<int DIM>
tbox::Array<int> SAMRAI::mesh::HistogramBox< DIM >::d_histogram[DIM]
private

◆ d_comm

template<int DIM>
tbox::SAMRAI_MPI::comm SAMRAI::mesh::HistogramBox< DIM >::d_comm
private

◆ d_communication_mode

template<int DIM>
int SAMRAI::mesh::HistogramBox< DIM >::d_communication_mode
private

◆ t_compute

template<int DIM>
tbox::Pointer<tbox::Timer> SAMRAI::mesh::HistogramBox< DIM >::t_compute
staticprivate

◆ t_commwait

template<int DIM>
tbox::Pointer<tbox::Timer> SAMRAI::mesh::HistogramBox< DIM >::t_commwait
staticprivate

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