Chombo + EB  3.0
Public Member Functions | Protected Member Functions | List of all members
BRMeshRefine Class Reference

Class which manages Berger-Rigoutsos grid generation. More...

#include <BRMeshRefine.H>

Inheritance diagram for BRMeshRefine:
Inheritance graph
[legend]

Public Member Functions

 BRMeshRefine ()
 Default constructor – leaves object in an unusable state. More...
 
 BRMeshRefine (const Box &a_baseDomain, const Vector< int > &a_refRatios, const Real a_fillRatio, const int a_blockFactor, const int a_bufferSize, const int a_maxSize)
 Full constructor – leaves object in usable state. More...
 
 BRMeshRefine (const ProblemDomain &a_baseDomain, const Vector< int > &a_refRatios, const Real a_fillRatio, const int a_blockFactor, const int a_bufferSize, const int a_maxSize)
 Full constructor – leaves object in usable state. More...
 
virtual ~BRMeshRefine ()
 Destructor. More...
 
void define (const Box &a_baseDomain, const Vector< int > &a_refRatios, const Real a_fillRatio, const int a_blockFactor, const int a_bufferSize, const int a_maxSize)
 Define function – size of RefRatios will define maximum number of levels. More...
 
void define (const ProblemDomain &a_baseDomain, const Vector< int > &a_refRatios, const Real a_fillRatio, const int a_blockFactor, const int a_bufferSize, const int a_maxSize)
 Define function – size of RefRatios will define maximum number of levels. More...
 
void makeBoxes (Vector< Box > &a_mesh, const IntVectSet &a_tags, const IntVectSet &a_pnd, const ProblemDomain &a_domain, const int a_maxSize, const int a_totalBufferSize) const
 Constructs a set of boxes which covers a set of tagged cells. More...
 
- Public Member Functions inherited from MeshRefine
 MeshRefine ()
 default constructor – leaves object in an unusable state More...
 
 MeshRefine (const Box &a_baseDomain, const Vector< int > &a_refRatios, const Real a_fillRatio, const int a_blockFactor, const int a_bufferSize, const int a_maxSize)
 full constructor – leaves object in usable state More...
 
 MeshRefine (const ProblemDomain &a_baseDomain, const Vector< int > &a_refRatios, const Real a_fillRatio, const int a_blockFactor, const int a_bufferSize, const int a_maxSize)
 full constructor – leaves object in usable state More...
 
virtual ~MeshRefine ()
 destructor More...
 
void define (const Box &a_baseDomain, const Vector< int > &a_refRatios, const Real a_fillRatio, const int a_blockFactor, const int a_bufferSize, const int a_maxSize)
 define function – size of RefRatios will define maximum number of levels More...
 
void define (const ProblemDomain &a_baseDomain, const Vector< int > &a_refRatios, const Real a_fillRatio, const int a_blockFactor, const int a_bufferSize, const int a_maxSize)
 define function – size of RefRatios will define maximum number of levels More...
 
virtual int regrid (Vector< Vector< Box > > &a_newmeshes, const IntVectSet &a_tags, const int a_baseLevel, const int a_topLevel, const Vector< Vector< Box > > &a_oldMeshes)
 create hierarchy of grids from a single level of tags More...
 
virtual int regrid (Vector< Vector< Box > > &a_newmeshes, Vector< IntVectSet > &a_tags, const int a_baseLevel, const int a_topLevel, const Vector< Vector< Box > > &a_oldMeshes)
 create hierarchy of grids from tags at all levels More...
 
const Vector< int > & refRatios () const
 returns vector of refinement ratios More...
 
Real fillRatio () const
 returns fillRatio More...
 
int blockFactor () const
 returns blocking factor More...
 
int bufferSize () const
 returns proper nesting buffer size More...
 
int maxSize () const
 returns maximum box size in any dimension – 0 means no limit More...
 
void refRatios (const Vector< int > &a_nRefVect)
 sets vector of refinement ratios More...
 
void fillRatio (const Real a_fill_ratio)
 sets fillRatio More...
 
void blockFactor (const int a_block_factor)
 sets blocking factor More...
 
void bufferSize (const int a_buffer_size)
 sets proper nesting buffer size More...
 
void maxSize (const int a_max_size)
 sets maximum box size in any dimension – 0 means no limit More...
 
bool isDefined () const
 has this object been defined properly? More...
 
void granularity (int a_granularity)
 sets proper nesting region granularity. More...
 
void setPNDMode (int a_mode)
 

Protected Member Functions

void makeBoxes (std::list< Box > &a_mesh, IntVectSet &a_tags, const IntVectSet &a_pnd, const ProblemDomain &a_domain, const int a_maxSize, const int a_depth, const int a_totalBufferSize) const
 
void splitBox (std::list< Box > &a_boxes, const std::list< Box >::iterator &a_boxindex, const int a_dimension, const int a_maxboxsize) const
 
void splitBox (std::list< Box > &a_boxes, const std::list< Box >::iterator &a_boxindex, const int a_maxboxsize) const
 
Vector< int > makeTrace (const IntVectSet &a_Ivs, int a_dir) const
 
void makeTraces (const IntVectSet &a_Ivs, Vector< int > *a_traces) const
 
int findSplit (const Vector< int > &a_trace) const
 
int findSplit (const Vector< int > &a_trace, const int a_maxSize) const
 
int findMaxInflectionPoint (const Vector< int > &a_trace, int &a_maxVal) const
 
int findMaxInflectionPoint (const Vector< int > &a_trace, int &a_maxVal, const int a_maxSize) const
 
void splitTags (const IntVectSet &a_tags, const int a_split_dir, const int a_split_indx, IntVectSet &a_tags_lo, IntVectSet &a_tags_hi) const
 
void splitTagsInPlace (const int a_split_dir, const int a_split_indx, IntVectSet &a_tags_inout_lo, IntVectSet &a_tags_hi) const
 
void splitTagsInBestDimension (IntVectSet &a_tags_inout_lo, IntVectSet &a_tags_hi, const int a_maxSize) const
 
void breakBoxes (Vector< Box > &a_vboxin, const int &a_maxSize, const int &a_idir) const
 
int maxloc (const int *a_V, const int a_Size) const
 
void makeBoxesParallel (std::list< Box > &a_mesh, IntVectSet &a_tags, const IntVectSet &a_pnd, const ProblemDomain &a_domain, const int a_maxSize, const int a_depth, const int a_totalBufferSize, const int a_minSize, const Interval &a_procInterval) const
 
void sendBoxesParallel (const std::list< Box > &a_mesh, int tag) const
 
void receiveBoxesParallel (const Interval &a_from, const Interval &a_to, std::list< Box > &a_mesh, int tag) const
 
- Protected Member Functions inherited from MeshRefine
virtual void computeLocalBlockFactors ()
 computes local blockFactors used internally to enforce the BlockFactor More...
 
bool properlyNested (const Box &a_box, const ProblemDomain &a_domain, const IntVectSet &a_pnd, int a_totalBuffer) const
 
virtual void makePNDs (Vector< IntVectSet > &a_pnds, Vector< int > &a_totalBufferSize, const int a_baseLevel, const int a_topLevel, const Vector< ProblemDomain > &a_domains, const IntVectSet &a_baseMesh, const Vector< int > &a_bufferSize) const
 Computes proper nesting domains. More...
 
virtual void makePNDs (Vector< IntVectSet > &a_pnds, Vector< int > &a_totalBufferSize, const int a_baseLevel, const int a_topLevel, const Vector< ProblemDomain > &a_domains, const Vector< Box > &a_baseMesh, const Vector< int > &a_bufferSize) const
 

Additional Inherited Members

- Protected Attributes inherited from MeshRefine
bool m_isDefined
 
Vector< ProblemDomainm_vectDomains
 
Vector< IntVectSetm_pnds
 
int m_lastBase
 
int m_lastTop
 
int m_lastBuffer
 
Vector< int > m_nRefVect
 
Real m_fillRatio
 
int m_blockFactor
 
Vector< int > m_level_blockfactors
 
int m_bufferSize
 
int m_maxSize
 
int m_granularity
 
int m_PNDMode
 

Detailed Description

Class which manages Berger-Rigoutsos grid generation.

This class manages grid generation from sets of tagged cells using the Berger-Rigoutsos algorithm in the context of the MeshRefine class from which it is derived

There are two ways grids can be defined based on tagged cells. one takes a single IntVectSet of tags defined on the BaseLevel mesh and uses that set of tags for every level to be refined; the other takes a Vector<IntVectSet> of tags defined on all the mesh levels to be refined and uses those.

Long Description:

Create new meshes based on tagged cells on a range of levels of a mesh hierarchy. Each level of tagged cells is used to generate a new mesh at the next finer level. The finest level in the output mesh will be one level higher than the top of the range of levels given as input. As a special case, use the same tags (appropriately refined) for all levels.

Usage:

Call the regrid functions after computing error estimates and tagging cells. To add a new mesh level, set TopLevel to the index of the finest level in the existing mesh and define tags on the finest level. To keep the existing number of mesh levels, set TopLevel to one less than the index of the finest level and don't define any tags on the finest level. If a single IntVectSet of tags is passed (instead of a Vector<IntVectSet>) then the same tags (properly refined) will be used for all the new meshes up to level TopLevel+1. In any case, the meshes at levels BaseLevel and below are not modified. The output argument newmeshes will be reallocated to the necessary size before being used. When this function returns, the elements of the newmeshes vector corresponding to the unchanged levels will be filled in with copies of the levels from the old mesh vector. The variable tags is modified in an undefined way, so its contents should not be relied upon. The variable BlockFactor specifies the amount by which each box will be coarsenable. Every grid box will have an integral multiple of BlockFactor cells in each dimension and also lower index values that are integral multiples. As a side effect, the minimum box size will be BlockFactor.

Expensive validations are done only when debugging is enabled (i.e. the DEBUG make variable is "TRUE").

Usage Notes:

All the input vectors should be defined with max index >= TopLevel. They should have values for indices [BaseLevel:TopLevel]. (except for OldMeshes, which must be defined for all indices). The new mesh vector newmeshes will be redefined up to index TopLevel+1. RefRatios should be defined such that RefRatios[L] is the value to use to refine the level L mesh to produce the level L+1 mesh. The tags vector is modified in an undefined manner. The output variable newmeshes may not be completely defined if an exception occurs. The BlockFactor can be used to force a minimum box size.

Constructor & Destructor Documentation

◆ BRMeshRefine() [1/3]

BRMeshRefine::BRMeshRefine ( )

Default constructor – leaves object in an unusable state.

◆ BRMeshRefine() [2/3]

BRMeshRefine::BRMeshRefine ( const Box a_baseDomain,
const Vector< int > &  a_refRatios,
const Real  a_fillRatio,
const int  a_blockFactor,
const int  a_bufferSize,
const int  a_maxSize 
)

Full constructor – leaves object in usable state.

Parameters
a_baseDomainLevel 0 domain
a_refRatiosRefinement ratios – refRatio[0] is btwn levels 0 and 1
a_fillRatioMeasure of how efficiently tagged cells will be covered
a_blockFactorAmount by which grids are guaranteed to be coarsenable
a_bufferSizeProper nesting buffer amount
a_maxSizeMaximum grid length in any direction – 0 means no limit.

◆ BRMeshRefine() [3/3]

BRMeshRefine::BRMeshRefine ( const ProblemDomain a_baseDomain,
const Vector< int > &  a_refRatios,
const Real  a_fillRatio,
const int  a_blockFactor,
const int  a_bufferSize,
const int  a_maxSize 
)

Full constructor – leaves object in usable state.

Parameters
a_baseDomainLevel 0 domain
a_refRatiosRefinement ratios – refRatio[0] is btwn levels 0 and 1
a_fillRatioMeasure of how efficiently tagged cells will be covered
a_blockFactorAmount by which grids are guaranteed to be coarsenable
a_bufferSizeProper nesting buffer amount
a_maxSizeMaximum grid length in any direction – 0 means no limit.

◆ ~BRMeshRefine()

virtual BRMeshRefine::~BRMeshRefine ( )
virtual

Destructor.

Member Function Documentation

◆ define() [1/2]

void BRMeshRefine::define ( const Box a_baseDomain,
const Vector< int > &  a_refRatios,
const Real  a_fillRatio,
const int  a_blockFactor,
const int  a_bufferSize,
const int  a_maxSize 
)

Define function – size of RefRatios will define maximum number of levels.

Parameters
a_baseDomainLevel 0 domain
a_refRatiosRefinement ratios – refRatio[0] is btwn levels 0 and 1
a_fillRatioMeasure of how efficiently tagged cells will be covered
a_blockFactorAmount by which grids are guaranteed to be coarsenable
a_bufferSizeProper nesting buffer amount
a_maxSizeMaximum grid length in any direction – 0 means no limit

◆ define() [2/2]

void BRMeshRefine::define ( const ProblemDomain a_baseDomain,
const Vector< int > &  a_refRatios,
const Real  a_fillRatio,
const int  a_blockFactor,
const int  a_bufferSize,
const int  a_maxSize 
)

Define function – size of RefRatios will define maximum number of levels.

Parameters
a_baseDomain:evel 0 domain
a_refRatiosRefinement ratios – refRatio[0] is btwn levels 0 and 1
a_fillRatioMeasure of how efficiently tagged cells will be covered
a_blockFactorAmount by which grids are guaranteed to be coarsenable
a_bufferSizeProper nesting buffer amount
a_maxSizeMaximum grid length in any direction – 0 means no limit

◆ makeBoxes() [1/2]

void BRMeshRefine::makeBoxes ( Vector< Box > &  a_mesh,
const IntVectSet a_tags,
const IntVectSet a_pnd,
const ProblemDomain a_domain,
const int  a_maxSize,
const int  a_totalBufferSize 
) const
virtual

Constructs a set of boxes which covers a set of tagged cells.

Constructs a set of boxes which covers a set of tagged cells by using the Berger-Rigoutsos algorithm. Everything should be on the same level, and blocking factor is not applied. Boxes will be on the same refinement level as the tags. This would normally be a protected function, but it can be useful to call it on it's own, so it has been left public.

Parameters
a_meshPutput: refined boxes at each new level
a_tagsInput: set of tagged cells to cover
a_pndInput: proper nesting domain in which mesh boxes must live
a_domainInput: physical domain
a_maxSizeInput: largest number of cells in any dimension for any box

Implements MeshRefine.

◆ makeBoxes() [2/2]

void BRMeshRefine::makeBoxes ( std::list< Box > &  a_mesh,
IntVectSet a_tags,
const IntVectSet a_pnd,
const ProblemDomain a_domain,
const int  a_maxSize,
const int  a_depth,
const int  a_totalBufferSize 
) const
protected

Function which actually implement Berger-Rigoutsos chopping.

Parameters
a_meshOutput: refined boxes at each new level
a_tagsInput: set of tagged cells to cover
a_pndInput: proper nesting domain in which mesh boxes must live
a_domainInput: physical domain
a_maxSizeInput: largest number of cells in any dimension for any box
a_depthInput: depth of this recursion in the algorithm

◆ splitBox() [1/2]

void BRMeshRefine::splitBox ( std::list< Box > &  a_boxes,
const std::list< Box >::iterator &  a_boxindex,
const int  a_dimension,
const int  a_maxboxsize 
) const
protected

◆ splitBox() [2/2]

void BRMeshRefine::splitBox ( std::list< Box > &  a_boxes,
const std::list< Box >::iterator &  a_boxindex,
const int  a_maxboxsize 
) const
protected

◆ makeTrace()

Vector<int> BRMeshRefine::makeTrace ( const IntVectSet a_Ivs,
int  a_dir 
) const
protected

◆ makeTraces()

void BRMeshRefine::makeTraces ( const IntVectSet a_Ivs,
Vector< int > *  a_traces 
) const
protected

◆ findSplit() [1/2]

int BRMeshRefine::findSplit ( const Vector< int > &  a_trace) const
protected

◆ findSplit() [2/2]

int BRMeshRefine::findSplit ( const Vector< int > &  a_trace,
const int  a_maxSize 
) const
protected

◆ findMaxInflectionPoint() [1/2]

int BRMeshRefine::findMaxInflectionPoint ( const Vector< int > &  a_trace,
int &  a_maxVal 
) const
protected

◆ findMaxInflectionPoint() [2/2]

int BRMeshRefine::findMaxInflectionPoint ( const Vector< int > &  a_trace,
int &  a_maxVal,
const int  a_maxSize 
) const
protected

◆ splitTags()

void BRMeshRefine::splitTags ( const IntVectSet a_tags,
const int  a_split_dir,
const int  a_split_indx,
IntVectSet a_tags_lo,
IntVectSet a_tags_hi 
) const
protected

◆ splitTagsInPlace()

void BRMeshRefine::splitTagsInPlace ( const int  a_split_dir,
const int  a_split_indx,
IntVectSet a_tags_inout_lo,
IntVectSet a_tags_hi 
) const
protected

◆ splitTagsInBestDimension()

void BRMeshRefine::splitTagsInBestDimension ( IntVectSet a_tags_inout_lo,
IntVectSet a_tags_hi,
const int  a_maxSize 
) const
protected

◆ breakBoxes()

void BRMeshRefine::breakBoxes ( Vector< Box > &  a_vboxin,
const int &  a_maxSize,
const int &  a_idir 
) const
protected

◆ maxloc()

int BRMeshRefine::maxloc ( const int *  a_V,
const int  a_Size 
) const
protected

◆ makeBoxesParallel()

void BRMeshRefine::makeBoxesParallel ( std::list< Box > &  a_mesh,
IntVectSet a_tags,
const IntVectSet a_pnd,
const ProblemDomain a_domain,
const int  a_maxSize,
const int  a_depth,
const int  a_totalBufferSize,
const int  a_minSize,
const Interval a_procInterval 
) const
protected

◆ sendBoxesParallel()

void BRMeshRefine::sendBoxesParallel ( const std::list< Box > &  a_mesh,
int  tag 
) const
protected

◆ receiveBoxesParallel()

void BRMeshRefine::receiveBoxesParallel ( const Interval a_from,
const Interval a_to,
std::list< Box > &  a_mesh,
int  tag 
) const
protected

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