|
IBAMR
IBAMR version 0.19.
|
Node in the asynchronous Berger-Rigoutsos (BR) dendogram. More...
#include <AsyncBergerRigoutsosNode.h>

Classes | |
| struct | CommonParams |
| Parameters shared among all dendogram nodes in an dendogram and collectively managed by those nodes. More... | |
Public Types | |
| enum | OwnerMode { SINGLE_OWNER = 0, MOST_OVERLAP = 1, FEWEST_OWNED = 2, LEAST_ACTIVE = 3 } |
| typedef hier::LayerNodeSet< DIM >::Node | GraphNode |
| Shorthand for the box-graph node corresponding to boxes. More... | |
| typedef hier::LayerNodeSet< DIM >::NodeContainer | GraphNodeContainer |
| Shorthand for a container of graph-nodes. More... | |
| typedef hier::LayerEdgeSet< DIM >::NabrContainer | GraphNabrContainer |
| Shorthand for a container of neighbor graph-nodes. More... | |
| typedef hier::LayerEdgeSet< DIM >::Connectivity | Connectivity |
| Shortthand for the connectivity between two sets of graph nodes. More... | |
| typedef std::set< int > | IntSet |
| Shorthand for a sorted, possibly incontiguous, set of integers. More... | |
| enum | JobState { COMMUNICATION_WAIT = 0, NONCOMMUNICATION_WAIT = 1, JOB_IS_COMPLETED = 2 } |
Public Member Functions | |
| AsyncBergerRigoutsosNode (CommonParams *common_params, const hier::Box< DIM > *bound_box=NULL, mesh::AsyncBergerRigoutsosNode< DIM > *parent=NULL, const int child_number=1) | |
| Construct a node of a BR dendogram. More... | |
| ~AsyncBergerRigoutsosNode (void) | |
| Destructor. More... | |
Algorithm mode settings | |
| void | setMaxGhostCellWidth (const hier::IntVector< DIM > &max_gcw) |
| Set the maximum ghost cell width used for checking overlaps. More... | |
| void | setAlgorithmAdvanceMode (const std::string &algo_advance_mode) |
| Set the mode for advancing the asynchronous implementation. More... | |
| void | setOwnerMode (const std::string &mode) |
| Set the method for choosing the owner. Choices: More... | |
| void | setUseLevelBoxes (bool flag) |
| Switch on or off the use of global level boxes. More... | |
| void | setComputeEdges (int compute_edges) |
| Edge computation flag. More... | |
| void | runAlgorithm () |
| Run the BR algorithm to find boxes. More... | |
Access to outputs | |
| const hier::LayerNodeSet< DIM > & | getNewNodes () const |
| Get the output boxes in a hier::LayerNodeSet<DIM> form. More... | |
| const Connectivity & | getNewCnect () const |
| Get the connectivity between input and output graph nodes (between the tagged and new graph nodes). More... | |
Developer's methods for analysis and debugging this class. | |
| virtual void | printClassData (std::ostream &os, int detail_level=0) const |
| int | getMaxNodes () const |
| Max number of local nodes for dendogram. More... | |
| int | getMaxGeneration () const |
| max generation count for the local nodes in the dendogram. More... | |
| int | getMaxOwnership () const |
| Max number of locally owned nodes in the dendogram. More... | |
| double | getAvgNumberOfCont () const |
| Average number of continuations for local nodes in dendogram. More... | |
| int | getMaxNumberOfCont () const |
| Max number of continuations for local nodes in dendogram. More... | |
| int | getNumBoxesGenerated () const |
| Number of boxes generated (but not necessarily owned) on the local process. More... | |
| void | setLogNodeHistory (bool flag) |
| Set whether to log dendogram node action history (useful for debugging). More... | |
Private Member Functions | |
Delegated tasks for various phases of running algorithm. | |
| void | makeLocalTagHistogram () |
| void | reduceHistogram_start () |
| bool | reduceHistogram_check () |
| void | computeMinimalBoundingBoxForTags () |
| void | acceptOrSplitBox () |
| void | broadcastAcceptability_start () |
| bool | broadcastAcceptability_check () |
| void | countOverlapWithLocalPatches () |
| void | gatherGroupingCriteria_start () |
| bool | gatherGroupingCriteria_check () |
| void | formChildGroups () |
| Form child groups from gathered overlap counts. More... | |
| void | formChildGroupsUsingLevelBoxes () |
| Form child groups from local copy of all level boxes. More... | |
| void | broadcastChildGroups_start () |
| bool | broadcastChildGroups_check () |
| void | runChildren_start () |
| bool | runChildren_check () |
| void | broadcastToDropouts_start () |
| bool | broadcastToDropouts_check () |
| void | createLayerNode () |
| void | eraseLayerNode () |
| void | computeNewGraphEdges () |
| Compute new graph edges touching local tag nodes. More... | |
| void | shareNewEdgesWithOwners () |
| Participants send new edge data to graph node owners. More... | |
Utilities for implementing algorithm | |
| int | findOwnerInGroup (int owner, const tbox::Array< int > &group) const |
| Find the index of the owner in the group. More... | |
| void | claimMPITag () |
| Claim a unique tag from process's available tag pool. More... | |
| int | computeCommunicationTreeDegree (int group_size) const |
| Heuristically determine "best" tree degree for communication group size. More... | |
| bool | findZeroCutPoint (int &cut_pt, const int dim) |
| bool | findZeroCutSwath (int &cut_lo, int &cut_hi, const int dim) |
| void | cutAtLaplacian (int &cut_pt, const int dim, const int lo, const int hi, const int min_size) |
| int | getHistogramBufferSize (const hier::Box< DIM > &box) const |
| int * | putHistogramToBuffer (int *buffer) |
| int * | getHistogramFromBuffer (int *buffer) |
| int * | putBoxToBuffer (const hier::Box< DIM > &box, int *buffer) const |
| int * | getBoxFromBuffer (hier::Box< DIM > &box, int *buffer) const |
| void | computeDropoutGroup (const tbox::Array< int > &main_group, const tbox::Array< int > &sub_group, tbox::Array< int > &dropouts, const int add_group) const |
| Compute list of non-participating processes. More... | |
| BoxAcceptance | intToBoxAcceptance (int i) const |
| bool | boxAccepted () const |
| bool | boxRejected () const |
| bool | boxHasNoTag () const |
Private Attributes | |
Tree-related data | |
| AsyncBergerRigoutsosNode * | d_parent |
| Parent node (or NULL for the root node). More... | |
| AsyncBergerRigoutsosNode * | d_lft_child |
| Left child. More... | |
| AsyncBergerRigoutsosNode * | d_rht_child |
| Right child. More... | |
Data for one recursion of the BR algorithm | |
| hier::Box< DIM > | d_box |
| int | d_owner |
Id of participating processes. | |
| tbox::Array< int > | d_group |
| int | d_mpi_tag |
| MPI tag for message within a dendogram node. More... | |
| int | d_overlap |
| Overlap count with d_box. More... | |
| BoxAcceptance | d_box_acceptance |
| Whether and how box is accepted. More... | |
| tbox::Array< int > | d_histogram [DIM] |
| Histogram for all dimensions of box d_box. More... | |
| GraphNode | d_node |
| Distributed graph node corresponding to an accepted box. More... | |
| GraphNodeContainer::iterator | d_node_iterator |
| Distributed graph node iterator corresponding to an accepted box on the owner. More... | |
| WaitPhase | d_wait_phase |
| Name of wait phase when continueAlgorithm() exits before completion. More... | |
Lower-level parameters for communication. | |
| tbox::Array< int > | d_send_msg |
| Buffer for organizing outgoing data. More... | |
| tbox::Array< int > | d_recv_msg |
| Buffer for organizing incoming data. More... | |
| tbox::AsyncCommGroup * | d_comm_group |
Deubgging aid | |
| const int | d_generation |
| Generation number. More... | |
| int | d_n_cont |
| Number of times continueAlgorithm was called. More... | |
Utilities to help analysis and debugging | |
| const int | d_pos |
| Unique id in the binary dendogram. More... | |
| CommonParams * | d_common |
| Common parameters shared with descendents and ancestors. More... | |
| tbox::List< tbox::RelaunchableJob * >::Iterator | inRelaunchQueue (tbox::RelaunchableJob *node_ptr) const |
| bool | inGroup (tbox::Array< int > &group, int rank=-1) const |
In mesh generation, the BR algorithm can be used to cluster tagged cells into boxes. This algorithm is described in Berger and Rigoutsos, IEEE Trans. on Sys, Man, and Cyber (21)5:1278-1286.
This class implements the BR algorithm to execute in a non-recursive way, in order to improve parallel efficiency over recursive implementations. To facilitate a non-recursive implementation, data in the recursive tree is maintained in a "BR dendogram", nodes of which are instances of this class.
Clarification on the uses of the word "node":
Each dendogram node is associated with a candidate box, an owner process coordinating distributed computations on the box and a group of processors participating in those computations. Should the candidate box be one of the final output boxes, the owner also owns the graph node associated with the box.
To use this class:
This class creates its output in a distributed nested-level box-graph (DNBG) format. The output is distributed over all processes running the algorithm, with each process owning a subset of the DNBG. The 2 primary outputs of this implementation are:
| typedef hier::LayerNodeSet<DIM>::Node SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::GraphNode |
| typedef hier::LayerNodeSet<DIM>::NodeContainer SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::GraphNodeContainer |
| typedef hier::LayerEdgeSet<DIM>::NabrContainer SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::GraphNabrContainer |
| typedef hier::LayerEdgeSet<DIM>::Connectivity SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::Connectivity |
| typedef std::set<int> SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::IntSet |
| enum SAMRAI::mesh::AsyncBergerRigoutsosNode::OwnerMode |
|
private |
"For_data_only" phase is when the dendogram node is only used to store data. If the node is to be executed, it enters the "to_be_launched" phase.
All names beginning with "reduce", "gather" or "bcast" refer to communication phases, where control is returned before the algorithm completes.
The "children" phase does not explicitly contain communication, but the children may perform communication.
The "completed" phase is when the algorithm has run to completion. This is where the recursive implementation would return.
The "deallocated" phase is for debugging. This phase is set by the destructor, just to help find dendogram nodes that are deallocated but somehow was referenced.
| Enumerator | |
|---|---|
| for_data_only | |
| to_be_launched | |
| reduce_histogram | |
| bcast_acceptability | |
| gather_grouping_criteria | |
| bcast_child_groups | |
| run_children | |
| bcast_to_dropouts | |
| completed | |
| deallocated | |
|
private |
Each message tag is the d_mpi_tag plus a PhaseTag. Originally, there were different tags for different communication phases, determined by d_mpi_tag plus a PhaseTag. But this is not really needed, so all phases use the tag d_mpi_tag. The PhaseTag type is just here in case we have to go back to using them.
| Enumerator | |
|---|---|
| reduce_histogram_tag | |
| bcast_acceptability_tag | |
| gather_grouping_criteria_tag | |
| bcast_child_groups_tag | |
| bcast_to_dropouts_tag | |
| total_phase_tags | |
|
private |
Note that accepted values are odd and rejected and undetermined values are even! See boxAccepted(), boxRejected() and boxHasNoTag().
It is not critical to have all values shown, but the values help in debugging.
Meaning of values:
|
inherited |
| SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::AsyncBergerRigoutsosNode | ( | CommonParams * | common_params, |
| const hier::Box< DIM > * | bound_box = NULL, |
||
| mesh::AsyncBergerRigoutsosNode< DIM > * | parent = NULL, |
||
| const int | child_number = 1 |
||
| ) |
Construct a node node of a BR dendogram, which you can use to run the BR algorithm.
| common_params | The common parameter object you plan to use to run the ABR algorithm. |
| bound_box | Bounding box for tagged cells. |
| parent | Parent node of the node being constructed. Set to NULL if you are constructing the root node of the BR dendogram. |
| child_number | 0 if constructing left child and 1 if constructing right child. Set to 1 if you are constructing the root node of the BR dendogram. |
| SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::~AsyncBergerRigoutsosNode | ( | void | ) |
Deallocate internal data.
| void SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::setMaxGhostCellWidth | ( | const hier::IntVector< DIM > & | max_gcw | ) |
Overlap checking is done to determine nearest-neighbor relationships when generating connectivity to new graph nodes. If a box grown by this ammount intersects another box, the two boxes are considered neighbors.
By default the max ghost cell width is one in each direction.
| void SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::setAlgorithmAdvanceMode | ( | const std::string & | algo_advance_mode | ) |
Choices are:
The default is "ADVANCE_SOME".
Asynchronous modes are NOT guaranteed to compute the output graph nodes in any particular order. The order depends on the ordering of message completion, which is not deterministic. If you require consistent outputs, we suggest you have a scheme for reordering the output boxes.
| void SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::setOwnerMode | ( | const std::string & | mode | ) |
Experiments show that "MOST_OVERLAP" gives the best clustering speed, while "SINGLE_OWNER" may give a faster output globalization (since you don't need an all-gather).
| void SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::setUseLevelBoxes | ( | bool | flag | ) |
If off, the global level boxes will neither be used nor be generated. This feature is in anticipation of future support for the distributed nested-level box graph in SAMRAI.
| void SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::setComputeEdges | ( | int | compute_edges | ) |
Valid values to set are:
By default, the value is 2.
| void SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::runAlgorithm | ( | ) |
| const hier::LayerNodeSet<DIM>& SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::getNewNodes | ( | ) | const |
| const Connectivity& SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::getNewCnect | ( | ) | const |
The connectivity data generated depend on the flag set using setComputeEdges().
|
virtual |
| int SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::getMaxNodes | ( | ) | const |
| int SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::getMaxGeneration | ( | ) | const |
| int SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::getMaxOwnership | ( | ) | const |
| double SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::getAvgNumberOfCont | ( | ) | const |
| int SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::getMaxNumberOfCont | ( | ) | const |
| int SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::getNumBoxesGenerated | ( | ) | const |
| void SAMRAI::mesh::AsyncBergerRigoutsosNode< DIM >::setLogNodeHistory | ( | bool | flag | ) |
|
privatevirtual |
Continue the user-defined job.
Implements SAMRAI::tbox::RelaunchableJob.
|
privatevirtual |
Implements SAMRAI::tbox::RelaunchableJob.
|
privatevirtual |
Implements SAMRAI::tbox::RelaunchableJob.
|
private |
Parameters for finding boxes are internal. They should be set in the constructor.
In parallel, this the method may return before algorithm is completed. In serial, no communication is done, so the algorithm IS completed when this method returns. The method is completed if it returns WaitPhase::completed. This method may and should be called multiple times as long as the algorithm has not completed.
If this method returns before the algorithm is complete, this object will have put itself on the leaf queue to be checked for completion later.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
private |
|
private |
|
private |
This parameter is only used for debugging.
The id of a node grows exponentially with each generation. If the position in the binary tree is too big to be represented by an integer, d_pos is set to -1 for a left child and -2 for a right child.
|
private |
Only the root of the tree allocates the common parameters. For all others, this pointer is set by the parent.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
The tag is determined by on the process that owns the parent when the parent decides to split its box. The tags are broadcasted along with the children boxes.
|
private |
|
private |
|
private |
If local process is d_owner, this is initially the local histogram, then later, the reduced histogram. If not, it is just the local histogram.
|
private |
On the owner process, this belongs in a hier::LayerNodeSet<DIM> object. On contributor nodes, this is used to identify the layer node id assigned by the owner. The layer node id is important for computing neighbor data.
|
private |
This is relevant only on the owner, where the d_node is in a container. On contributors, the graph node is non-local and stands alone.
|
private |
|
private |
|
private |
|
private |
|
private |
The generation number is the parent's generation number plus 1. The root has generation number 1.
|
private |
1.8.17