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

Class CoarsenSchedule<DIM> performs the communication operations to coarsen data from a finer level to a coarser level.
More...

#include <ibtk/SideDataSynchronization.h>

Inheritance diagram for SAMRAI::xfer::CoarsenSchedule< DIM >:
Inheritance graph
[legend]

Public Member Functions

 CoarsenSchedule (tbox::Pointer< hier::PatchLevel< DIM > > crse_level, tbox::Pointer< hier::PatchLevel< DIM > > fine_level, const tbox::Pointer< xfer::CoarsenClasses< DIM > > coarsen_classes, tbox::Pointer< xfer::CoarsenTransactionFactory< DIM > > transaction_factory, xfer::CoarsenPatchStrategy< DIM > *patch_strategy, bool fill_coarse_data)
 
virtual ~CoarsenSchedule ()
 
void reset (const tbox::Pointer< xfer::CoarsenClasses< DIM > > coarsen_classes)
 
void coarsenData () const
 
const tbox::Pointer< xfer::CoarsenClasses< DIM > > & getEquivalenceClasses () const
 
virtual void printClassData (std::ostream &stream) const
 

Static Public Member Functions

static void setScheduleGenerationMethod (const std::string &method)
 

Private Member Functions

 CoarsenSchedule (const CoarsenSchedule< DIM > &)
 
void operator= (const CoarsenSchedule< DIM > &)
 
void generateSchedule ()
 Main schedule generation routine which passes control to one of the algorithmic variations based on value of s_schedule_generation_method. More...
 
void generateScheduleNSquared ()
 This version of the schedule generation procedure uses N^2 algorithms to determine box intersections; i.e., the original SAMRAI implementation which checks every box against every other. More...
 
void generateScheduleBoxGraph ()
 This version of the schedule generation procedure uses a bipartite graph algorithm to determine which source patches contribute data to each destination patch. More...
 
void generateScheduleBoxTree ()
 This version of the schedule generation procedure uses a recursive binary box tree algorithm to determine which source patches contribute data to each destination patch and to compute unfilled_boxes. More...
 
void generateTemporaryLevel ()
 Generate a temporary coarse level by coarsening the fine level. Note that this function does not allocate patch data storage. More...
 
void setupRefineAlgorithm ()
 Set up refine algorithms to transfer coarsened data and to fill temporary coarse level before coarsening operations, if needed.
More...
 
void coarsenSourceData (xfer::CoarsenPatchStrategy< DIM > *patch_strategy) const
 Coarsen source patch data from the fine patch level into the source patch data on the coarse temporary patch level. More...
 
hier::IntVector< DIM > getMaxGhostsToGrow () const
 Calculate the maximum ghost cell width to grow boxes to check for overlaps. More...
 
void constructScheduleTransactions (tbox::Pointer< hier::PatchLevel< DIM > > dst_level, int dst_patch_id, tbox::Pointer< hier::PatchLevel< DIM > > src_level, int src_patch_id)
 Function that constructs schedule transactions that move data from source patch on source level to destination patch on destination level. More...
 
void setCoarsenItems (const tbox::Pointer< xfer::CoarsenClasses< DIM > > coarsen_classes)
 Utility function to set up local copies of patch data source, destination, etc. indices and necessary data coarsening information stored in the coarsen classes object generated by the coarsen algorithm.
More...
 
void clearCoarsenItems ()
 Utility function to clear local copies of coarsen items. More...
 
void initialCheckCoarsenClassItems () const
 Utility function to check coarsen items to see whether source and destination patch data components have sufficient ghost cell widths to satisfy the "ghost width to coarsen" functionality described in the CoarsenAlgorithm<DIM> class header.
More...
 

Private Attributes

tbox::Pointer< xfer::CoarsenClasses< DIM > > d_coarsen_classes
 
int d_number_coarsen_items
 
const xfer::CoarsenClasses< DIM >::Data ** d_coarsen_items
 
tbox::Pointer< hier::PatchLevel< DIM > > d_crse_level
 
tbox::Pointer< hier::PatchLevel< DIM > > d_fine_level
 
tbox::Pointer< hier::PatchLevel< DIM > > d_temp_crse_level
 
xfer::CoarsenPatchStrategy< DIM > * d_coarsen_patch_strategy
 
tbox::Pointer< xfer::CoarsenTransactionFactory< DIM > > d_transaction_factory
 
hier::IntVector< DIM > d_ratio_between_levels
 
hier::ComponentSelector d_sources
 
tbox::Pointer< tbox::Scheduled_schedule
 
bool d_fill_coarse_data
 
tbox::Pointer< RefineAlgorithm< DIM > > d_precoarsen_refine_algorithm
 
tbox::Pointer< RefineSchedule< DIM > > d_precoarsen_refine_schedule
 
tbox::Pointer< tbox::Timert_coarsen_data
 
tbox::Pointer< tbox::Timert_gen_sched_n_squared
 
tbox::Pointer< tbox::Timert_gen_sched_box_graph
 
tbox::Pointer< tbox::Timert_gen_sched_box_tree
 

Static Private Attributes

static const hier::IntVector< DIM > s_constant_zero_intvector
 
static const hier::IntVector< DIM > s_constant_one_intvector
 
static std::string s_schedule_generation_method
 

Detailed Description

template<int DIM>
class SAMRAI::xfer::CoarsenSchedule< DIM >

Typically, data is coarsened from the interiors of source patch components on the source patch level into interiors of destination patch components on
the destination level. However, variations are possible for special situations; see the CoarsenAlgorithm<DIM> class header for more information. Generally, the source patch data must contain sufficient ghost cells to satisfy the coarsening operators involved. If a coarsen operator has a non-zero ghost cell width, then the source ghost cells must be filled before the coarsen schedule is executed. The communication schedule is executed by calling member function coarsenData().

Each schedule object is typically created by a coarsen algorithm and represents communication dependencies for a particular configuration of the AMR hierarchy. The communication schedule is only valid for that particular configuration and must be regenerated when the AMR patch hierarchy changes. However, as long as the patch levels involved in the creation of the schedule remain unchanged, the schedule may be used for multiple communication cycles. For more information about creating refine schedules, see the CoarsenAlgorithm<DIM> header file.

NOTE: Algorithmic variations are available by calling the static method CoarsenSchedule<DIM>::setScheduleGenerationMethod(), which sets the option for all instances of the class.

See also
xfer::CoarsenAlgorithm
xfer::CoarsenPatchStrategy
xfer::CoarsenClasses

Constructor & Destructor Documentation

◆ CoarsenSchedule() [1/2]

template<int DIM>
SAMRAI::xfer::CoarsenSchedule< DIM >::CoarsenSchedule ( tbox::Pointer< hier::PatchLevel< DIM > >  crse_level,
tbox::Pointer< hier::PatchLevel< DIM > >  fine_level,
const tbox::Pointer< xfer::CoarsenClasses< DIM > >  coarsen_classes,
tbox::Pointer< xfer::CoarsenTransactionFactory< DIM > >  transaction_factory,
xfer::CoarsenPatchStrategy< DIM > *  patch_strategy,
bool  fill_coarse_data 
)

Constructor to create a coarsen schedule that coarsens data from source patch data components on the fine level into the destination patch data components on the coarse level. In general, this constructor is called by a CoarsenAlgorithm<DIM> object. For possible variations on data coarsening, see the CoarsenAlgorithm<DIM> class header information.

If the coarsening operators require data from ghost cells, then the associated source patch data components must have a sufficient ghost cell width and and they must be filled with valid data before calling coarsenData().

Parameters
crse_levelPointer to coarse (destination) patch level.
fine_levelPointer to fine (source) patch level.
coarsen_classesPointer to structure containing patch data and operator information. In general, this is constructed by the calling CoarsenAlgorithm<DIM> object.
transaction_factoryPointer to a factory object that will create data transactions.
patch_strategyPointer to a coarsen patch strategy object that provides user-defined coarsen operations. This ponter may be null, in which case no user-defined coarsen operations will be performed.
fill_coarse_dataBoolean indicating whether coarse data should be filled before coarsening operations are done.

When assertion checking is active, unrecoverable assertions will result if either patch level pointer, the refine classes pointer, or the transaction factory pointer, is null.

◆ ~CoarsenSchedule()

template<int DIM>
virtual SAMRAI::xfer::CoarsenSchedule< DIM >::~CoarsenSchedule ( )
virtual

The virtual destructor for the schedule releases all internal storage.

◆ CoarsenSchedule() [2/2]

template<int DIM>
SAMRAI::xfer::CoarsenSchedule< DIM >::CoarsenSchedule ( const CoarsenSchedule< DIM > &  )
private

Member Function Documentation

◆ setScheduleGenerationMethod()

template<int DIM>
static void SAMRAI::xfer::CoarsenSchedule< DIM >::setScheduleGenerationMethod ( const std::string &  method)
static

Static function to set box intersection algorithm to use during schedule construction for all CoarsenSchedule objects.
If this method is not called, the default will be used.

Parameters
methodstring identifying box intersection method. Valid choices are: "BOX_TREE" (default case), "BOX_GRAPH", and "ORIG_NSQUARED". More details can be found below in the comments for the generateSchedule() routine.

If an invalid string is passed, an unrecoverable error will result.

◆ reset()

template<int DIM>
void SAMRAI::xfer::CoarsenSchedule< DIM >::reset ( const tbox::Pointer< xfer::CoarsenClasses< DIM > >  coarsen_classes)

Reset this coarsen schedule to perform data transfers asssociated with coarsen class items in function argument. In general, this function is called by a CoarsenAlgorithm<DIM> object.

Parameters
coarsen_classesPointer to structure containing patch data and operator information. In general, this is constructed by the calling CoarsenAlgorithm<DIM> object. This pointer must be non-null.

◆ coarsenData()

template<int DIM>
void SAMRAI::xfer::CoarsenSchedule< DIM >::coarsenData ( ) const

Execute the stored communication schedule and perform the data movement.

◆ getEquivalenceClasses()

template<int DIM>
const tbox::Pointer< xfer::CoarsenClasses<DIM> >& SAMRAI::xfer::CoarsenSchedule< DIM >::getEquivalenceClasses ( ) const

Return const reference to the pointer to coarsen equivalence classes used in schedule.

◆ printClassData()

template<int DIM>
virtual void SAMRAI::xfer::CoarsenSchedule< DIM >::printClassData ( std::ostream &  stream) const
virtual

Print the coarsen schedule state to the specified data stream.

Parameters
streamOutput data stream.

◆ operator=()

template<int DIM>
void SAMRAI::xfer::CoarsenSchedule< DIM >::operator= ( const CoarsenSchedule< DIM > &  )
private

◆ generateSchedule()

template<int DIM>
void SAMRAI::xfer::CoarsenSchedule< DIM >::generateSchedule ( )
private

The resulting communication schedule will move source patch data from a temporary coarse level (i.e., coarsened version of fine level) into the destination patch data of the destination (coarse) level.

The generateSchedule() routine invokes various versions of the schedule generation process implemented in the similarly named routines below based on the chosen schedule generation method. The different options will not change the result of the application but may improve its performance, especially for large numbers of processors. Note that the algorithm choice may be changed by calling the setScheduleGenerationMethod() routine.

The possibilities are as follows:

◆ generateScheduleNSquared()

template<int DIM>
void SAMRAI::xfer::CoarsenSchedule< DIM >::generateScheduleNSquared ( )
private

◆ generateScheduleBoxGraph()

template<int DIM>
void SAMRAI::xfer::CoarsenSchedule< DIM >::generateScheduleBoxGraph ( )
private

◆ generateScheduleBoxTree()

template<int DIM>
void SAMRAI::xfer::CoarsenSchedule< DIM >::generateScheduleBoxTree ( )
private

◆ generateTemporaryLevel()

template<int DIM>
void SAMRAI::xfer::CoarsenSchedule< DIM >::generateTemporaryLevel ( )
private

◆ setupRefineAlgorithm()

template<int DIM>
void SAMRAI::xfer::CoarsenSchedule< DIM >::setupRefineAlgorithm ( )
private

The associated schedules are set in the generateSchedule() routine.

◆ coarsenSourceData()

template<int DIM>
void SAMRAI::xfer::CoarsenSchedule< DIM >::coarsenSourceData ( xfer::CoarsenPatchStrategy< DIM > *  patch_strategy) const
private

◆ getMaxGhostsToGrow()

template<int DIM>
hier::IntVector<DIM> SAMRAI::xfer::CoarsenSchedule< DIM >::getMaxGhostsToGrow ( ) const
private

◆ constructScheduleTransactions()

template<int DIM>
void SAMRAI::xfer::CoarsenSchedule< DIM >::constructScheduleTransactions ( tbox::Pointer< hier::PatchLevel< DIM > >  dst_level,
int  dst_patch_id,
tbox::Pointer< hier::PatchLevel< DIM > >  src_level,
int  src_patch_id 
)
private

◆ setCoarsenItems()

template<int DIM>
void SAMRAI::xfer::CoarsenSchedule< DIM >::setCoarsenItems ( const tbox::Pointer< xfer::CoarsenClasses< DIM > >  coarsen_classes)
private

An array of coarsen data items is stored locally here to facilitate interaction with transations.

◆ clearCoarsenItems()

template<int DIM>
void SAMRAI::xfer::CoarsenSchedule< DIM >::clearCoarsenItems ( )
private

◆ initialCheckCoarsenClassItems()

template<int DIM>
void SAMRAI::xfer::CoarsenSchedule< DIM >::initialCheckCoarsenClassItems ( ) const
private

Specifically, the destination data must have a ghost cell width at least as large as the ghost cell width to coarsen. The source data must have a ghost cell width at least as large as the ghost cell width to coarsen refined to the source (finer) level index space. Although it is redundant if the coarsen algorithm created the coarsen classes, the routine CoarsenClasses<DIM>::checkCoarsenItem() is also called.

If any entries are erroneous an assertion is thrown with a descriptive error message and program halts.

Member Data Documentation

◆ s_constant_zero_intvector

template<int DIM>
const hier::IntVector<DIM> SAMRAI::xfer::CoarsenSchedule< DIM >::s_constant_zero_intvector
staticprivate

Constant int vectors used to avoid recreating these vectors in loops.

◆ s_constant_one_intvector

template<int DIM>
const hier::IntVector<DIM> SAMRAI::xfer::CoarsenSchedule< DIM >::s_constant_one_intvector
staticprivate

◆ s_schedule_generation_method

template<int DIM>
std::string SAMRAI::xfer::CoarsenSchedule< DIM >::s_schedule_generation_method
staticprivate

Selects algorithm used to generate communication schedule.

◆ d_coarsen_classes

template<int DIM>
tbox::Pointer< xfer::CoarsenClasses<DIM> > SAMRAI::xfer::CoarsenSchedule< DIM >::d_coarsen_classes
private

Structures that store coarsen data items.

◆ d_number_coarsen_items

template<int DIM>
int SAMRAI::xfer::CoarsenSchedule< DIM >::d_number_coarsen_items
private

◆ d_coarsen_items

template<int DIM>
const xfer::CoarsenClasses<DIM>::Data** SAMRAI::xfer::CoarsenSchedule< DIM >::d_coarsen_items
private

◆ d_crse_level

template<int DIM>
tbox::Pointer< hier::PatchLevel<DIM> > SAMRAI::xfer::CoarsenSchedule< DIM >::d_crse_level
private

Cached pointers to the coarse, fine, and temporary patch levels.

◆ d_fine_level

template<int DIM>
tbox::Pointer< hier::PatchLevel<DIM> > SAMRAI::xfer::CoarsenSchedule< DIM >::d_fine_level
private

◆ d_temp_crse_level

template<int DIM>
tbox::Pointer< hier::PatchLevel<DIM> > SAMRAI::xfer::CoarsenSchedule< DIM >::d_temp_crse_level
private

◆ d_coarsen_patch_strategy

template<int DIM>
xfer::CoarsenPatchStrategy<DIM>* SAMRAI::xfer::CoarsenSchedule< DIM >::d_coarsen_patch_strategy
private

Object supporting interface to user-defined spatial data coarsening operations.

◆ d_transaction_factory

template<int DIM>
tbox::Pointer< xfer::CoarsenTransactionFactory<DIM> > SAMRAI::xfer::CoarsenSchedule< DIM >::d_transaction_factory
private

Factory object used to create data transactions when schedule is constructed.

◆ d_ratio_between_levels

template<int DIM>
hier::IntVector<DIM> SAMRAI::xfer::CoarsenSchedule< DIM >::d_ratio_between_levels
private

Cached ratio between source (fine) level and destination (coarse) level.

◆ d_sources

template<int DIM>
hier::ComponentSelector SAMRAI::xfer::CoarsenSchedule< DIM >::d_sources
private

Stored source patch data indices for rapid data allocation/deallocation.

◆ d_schedule

template<int DIM>
tbox::Pointer<tbox::Schedule> SAMRAI::xfer::CoarsenSchedule< DIM >::d_schedule
private

Level-to-level communication schedule between the temporary coarse level and (actual) destination level.

◆ d_fill_coarse_data

template<int DIM>
bool SAMRAI::xfer::CoarsenSchedule< DIM >::d_fill_coarse_data
private

Boolean indicating whether source data on the coarse temporary level must be filled before coarsening operations (see comments for class constructor in header file), and refine algorithm and schedule needed to peform up these fill operations.

◆ d_precoarsen_refine_algorithm

template<int DIM>
tbox::Pointer< RefineAlgorithm<DIM> > SAMRAI::xfer::CoarsenSchedule< DIM >::d_precoarsen_refine_algorithm
private

◆ d_precoarsen_refine_schedule

template<int DIM>
tbox::Pointer< RefineSchedule<DIM> > SAMRAI::xfer::CoarsenSchedule< DIM >::d_precoarsen_refine_schedule
private

◆ t_coarsen_data

template<int DIM>
tbox::Pointer<tbox::Timer> SAMRAI::xfer::CoarsenSchedule< DIM >::t_coarsen_data
private

Timer objects for performance measurement.

◆ t_gen_sched_n_squared

template<int DIM>
tbox::Pointer<tbox::Timer> SAMRAI::xfer::CoarsenSchedule< DIM >::t_gen_sched_n_squared
private

◆ t_gen_sched_box_graph

template<int DIM>
tbox::Pointer<tbox::Timer> SAMRAI::xfer::CoarsenSchedule< DIM >::t_gen_sched_box_graph
private

◆ t_gen_sched_box_tree

template<int DIM>
tbox::Pointer<tbox::Timer> SAMRAI::xfer::CoarsenSchedule< DIM >::t_gen_sched_box_tree
private

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