Block-Structured AMR Software Framework
amrex::AmrMesh Class Reference

#include <AMReX_AmrMesh.H>

Inheritance diagram for amrex::AmrMesh:
amrex::AmrInfo amrex::AmrCore amrex::Amr

Public Member Functions

 AmrMesh ()
 
 AmrMesh (const RealBox *rb, int max_level_in, const Vector< int > &n_cell_in, int coord=-1, Vector< IntVect > refrat=Vector< IntVect >(), const int *is_per=nullptr)
 
 AmrMesh (const RealBox &rb, int max_level_in, const Vector< int > &n_cell_in, int coord, Vector< IntVect > const &a_refrat, Array< int, AMREX_SPACEDIM > const &is_per)
 
 AmrMesh (Geometry const &level_0_geom, AmrInfo const &amr_info)
 
 AmrMesh (const AmrMesh &rhs)=delete
 
AmrMeshoperator= (const AmrMesh &rhs)=delete
 
 AmrMesh (AmrMesh &&rhs)=default
 
AmrMeshoperator= (AmrMesh &&rhs)=default
 
virtual ~AmrMesh ()=default
 
int Verbose () const noexcept
 
int maxLevel () const noexcept
 Return the max level. More...
 
int finestLevel () const noexcept
 Return the finest level. More...
 
IntVect refRatio (int lev) const noexcept
 Return the refinement ratio for level lev. More...
 
int MaxRefRatio (int lev) const noexcept
 Return the maximum refinement ratio in any direction. More...
 
const Vector< IntVect > & refRatio () const noexcept
 Return refinement ratios between all levels. More...
 
const Vector< Geometry > & Geom () const noexcept
 
const Vector< DistributionMapping > & DistributionMap () const noexcept
 
const Vector< BoxArray > & boxArray () const noexcept
 
const GeometryGeom (int lev) const noexcept
 
const DistributionMappingDistributionMap (int lev) const noexcept
 
const BoxArrayboxArray (int lev) const noexcept
 
Vector< GeometryGeom (int a_coarsest_lev, int a_finest_lev) const noexcept
 
Vector< BoxArrayboxArray (int a_coarsest_lev, int a_finest_lev) const noexcept
 
Vector< DistributionMappingDistributionMap (int a_coarsest_lev, int a_finest_lev) const noexcept
 
Vector< Geometry > & Geom () noexcept
 
GeometryGeom (int lev) noexcept
 
void SetMaxGridSize (int new_mgs) noexcept
 
void SetMaxGridSize (const IntVect &new_mgs) noexcept
 
void SetMaxGridSize (const Vector< int > &new_mgs) noexcept
 
void SetMaxGridSize (const Vector< IntVect > &new_mgs) noexcept
 
void SetBlockingFactor (int new_bf) noexcept
 
void SetBlockingFactor (const IntVect &new_bf) noexcept
 
void SetBlockingFactor (const Vector< int > &new_bf) noexcept
 
void SetBlockingFactor (const Vector< IntVect > &new_bf) noexcept
 
void SetGridEff (Real eff) noexcept
 
void SetNProper (int n) noexcept
 
void SetFinestLevel (int new_finest_level) noexcept
 Set ref_ratio would require rebuilding Geometry objects. More...
 
void SetDistributionMap (int lev, const DistributionMapping &dmap_in) noexcept
 
void SetBoxArray (int lev, const BoxArray &ba_in) noexcept
 
void SetGeometry (int lev, const Geometry &geom_in) noexcept
 
int GetLevel (Box const &domain) noexcept
 Given domain box, return AMR level. Return -1 if there is no match. More...
 
void ClearDistributionMap (int lev) noexcept
 
void ClearBoxArray (int lev) noexcept
 
int nErrorBuf (int lev, int direction=0) const noexcept
 Return the number of buffer cells (as a single integer) in error estimator. More...
 
const IntVectnErrorBufVect (int lev) const noexcept
 Return the number of buffer cells (as an IntVect) in error estimator. More...
 
Real gridEff () const noexcept
 Return the minimum allowable grid efficiency. More...
 
int nProper () const noexcept
 Return the number of cells to define proper nesting. More...
 
const IntVectblockingFactor (int lev) const noexcept
 Return the blocking factor at level lev. More...
 
const IntVectmaxGridSize (int lev) const noexcept
 Return the largest allowable grid. More...
 
bool LevelDefined (int lev) noexcept
 
bool useFixedCoarseGrids () const noexcept
 Should we keep the coarser grids fixed (and not regrid those levels) at all? More...
 
int useFixedUpToLevel () const noexcept
 Up to what level should we keep the coarser grids fixed (and not regrid those levels)? More...
 
void ChopGrids (int lev, BoxArray &ba, int target_size) const
 "Try" to chop up grids so that the number of boxes in the BoxArray is greater than the target_size. More...
 
BoxArray MakeBaseGrids () const
 Make a level 0 grids covering the whole domain. It does NOT install the new grids. More...
 
void MakeNewGrids (int lbase, Real time, int &new_finest, Vector< BoxArray > &new_grids)
 Make new grids based on error estimates. This function expects that valid BoxArrays exist in this->grids from level lbase to level this->finest_level (the current finest level). new_grids. On return, the new finest level is stored in new_finest, and the new grids are stored in new_grids from Array element lbase+1 to new_finest_level (unless fixed grids are used). Note that this function adds at most one more level to the existing levels, and it may remove all levels above the base level. This function does not change the value of this->finest_level, nor does it modifies any BoxArrays stored in this->grids. It also does not modify new_grids's elements outside the range [lbase+1,new_finest_level]. More...
 
void MakeNewGrids (Real time=0.0)
 This function makes new grid for all levels (including level 0). More...
 
virtual void MakeNewLevelFromScratch (int, Real, const BoxArray &, const DistributionMapping &)
 
virtual void ErrorEst (int, TagBoxArray &, Real, int)
 Tag cells for refinement. TagBoxArray tags is built on level lev grids. More...
 
virtual void ManualTagsPlacement (int, TagBoxArray &, const Vector< IntVect > &)
 Manually tag. Note that tags is built on level lev grids coarsened by bf_lev[lev]. More...
 
virtual void PostProcessBaseGrids (BoxArray &) const
 
virtual BoxArray GetAreaNotToTag (int)
 
long CountCells (int lev) noexcept
 
virtual DistributionMapping MakeDistributionMap (int lev, BoxArray const &ba)
 

Protected Member Functions

void checkInput ()
 
void SetIterateToFalse () noexcept
 
void SetUseNewChop () noexcept
 

Protected Attributes

int finest_level
 Current finest level. More...
 
Vector< Geometrygeom
 
Vector< DistributionMappingdmap
 
Vector< BoxArraygrids
 
unsigned int num_setdm = 0
 
unsigned int num_setba = 0
 
- Protected Attributes inherited from amrex::AmrInfo
int verbose = 0
 
int max_level = 0
 Maximum allowed level. More...
 
Vector< IntVectref_ratio {{IntVect(2)}}
 Refinement ratios. More...
 
Vector< IntVectblocking_factor {{IntVect(8)}}
 Blocking factor in grid generation (by level). More...
 
Vector< IntVectmax_grid_size {{IntVect(AMREX_D_PICK(128,128,32))}}
 Maximum allowable grid size (by level). More...
 
Vector< IntVectn_error_buf {{IntVect(1)}}
 Buffer cells around each tagged cell. More...
 
Real grid_eff = static_cast<Real>(0.7)
 Grid efficiency. More...
 
int n_proper = 1
 Cells required for proper nesting. More...
 
int use_fixed_upto_level = 0
 
bool use_fixed_coarse_grids = false
 
bool refine_grid_layout = true
 
IntVect refine_grid_layout_dims = IntVect(1)
 
bool check_input = true
 
bool use_new_chop = false
 
bool iterate_on_new_grids = true
 

Private Member Functions

void InitAmrMesh (int max_level_in, const Vector< int > &n_cell_in, Vector< IntVect > refrat=Vector< IntVect >(), const RealBox *rb=nullptr, int coord=-1, const int *is_per=nullptr)
 

Static Private Member Functions

static void ProjPeriodic (BoxList &blout, const Box &domain, Array< int, AMREX_SPACEDIM > const &is_per)
 

Friends

std::ostream & operator<< (std::ostream &os, AmrMesh const &amr_mesh)
 

Constructor & Destructor Documentation

◆ AmrMesh() [1/6]

amrex::AmrMesh::AmrMesh ( )

◆ AmrMesh() [2/6]

amrex::AmrMesh::AmrMesh ( const RealBox rb,
int  max_level_in,
const Vector< int > &  n_cell_in,
int  coord = -1,
Vector< IntVect refrat = Vector<IntVect>(),
const int is_per = nullptr 
)

◆ AmrMesh() [3/6]

amrex::AmrMesh::AmrMesh ( const RealBox rb,
int  max_level_in,
const Vector< int > &  n_cell_in,
int  coord,
Vector< IntVect > const &  a_refrat,
Array< int, AMREX_SPACEDIM > const &  is_per 
)

◆ AmrMesh() [4/6]

amrex::AmrMesh::AmrMesh ( Geometry const &  level_0_geom,
AmrInfo const &  amr_info 
)

◆ AmrMesh() [5/6]

amrex::AmrMesh::AmrMesh ( const AmrMesh rhs)
delete

◆ AmrMesh() [6/6]

amrex::AmrMesh::AmrMesh ( AmrMesh &&  rhs)
default

◆ ~AmrMesh()

virtual amrex::AmrMesh::~AmrMesh ( )
virtualdefault

Member Function Documentation

◆ blockingFactor()

const IntVect& amrex::AmrMesh::blockingFactor ( int  lev) const
inlinenoexcept

Return the blocking factor at level lev.

◆ boxArray() [1/3]

const Vector<BoxArray>& amrex::AmrMesh::boxArray ( ) const
inlinenoexcept

◆ boxArray() [2/3]

Vector<BoxArray> amrex::AmrMesh::boxArray ( int  a_coarsest_lev,
int  a_finest_lev 
) const
inlinenoexcept

◆ boxArray() [3/3]

const BoxArray& amrex::AmrMesh::boxArray ( int  lev) const
inlinenoexcept

◆ checkInput()

void amrex::AmrMesh::checkInput ( )
protected

◆ ChopGrids()

void amrex::AmrMesh::ChopGrids ( int  lev,
BoxArray ba,
int  target_size 
) const

"Try" to chop up grids so that the number of boxes in the BoxArray is greater than the target_size.

◆ ClearBoxArray()

void amrex::AmrMesh::ClearBoxArray ( int  lev)
noexcept

◆ ClearDistributionMap()

void amrex::AmrMesh::ClearDistributionMap ( int  lev)
noexcept

◆ CountCells()

long amrex::AmrMesh::CountCells ( int  lev)
noexcept

◆ DistributionMap() [1/3]

const Vector<DistributionMapping>& amrex::AmrMesh::DistributionMap ( ) const
inlinenoexcept

◆ DistributionMap() [2/3]

Vector<DistributionMapping> amrex::AmrMesh::DistributionMap ( int  a_coarsest_lev,
int  a_finest_lev 
) const
inlinenoexcept

◆ DistributionMap() [3/3]

const DistributionMapping& amrex::AmrMesh::DistributionMap ( int  lev) const
inlinenoexcept

◆ ErrorEst()

virtual void amrex::AmrMesh::ErrorEst ( int  ,
TagBoxArray ,
Real  ,
int   
)
inlinevirtual

Tag cells for refinement. TagBoxArray tags is built on level lev grids.

Reimplemented in amrex::AmrCore, and amrex::Amr.

◆ finestLevel()

int amrex::AmrMesh::finestLevel ( ) const
inlinenoexcept

Return the finest level.

◆ Geom() [1/5]

const Vector<Geometry>& amrex::AmrMesh::Geom ( ) const
inlinenoexcept

◆ Geom() [2/5]

Vector<Geometry>& amrex::AmrMesh::Geom ( )
inlinenoexcept

◆ Geom() [3/5]

Vector<Geometry> amrex::AmrMesh::Geom ( int  a_coarsest_lev,
int  a_finest_lev 
) const
inlinenoexcept

◆ Geom() [4/5]

const Geometry& amrex::AmrMesh::Geom ( int  lev) const
inlinenoexcept

◆ Geom() [5/5]

Geometry& amrex::AmrMesh::Geom ( int  lev)
inlinenoexcept

◆ GetAreaNotToTag()

virtual BoxArray amrex::AmrMesh::GetAreaNotToTag ( int  )
inlinevirtual

Reimplemented in amrex::Amr.

◆ GetLevel()

int amrex::AmrMesh::GetLevel ( Box const &  domain)
noexcept

Given domain box, return AMR level. Return -1 if there is no match.

◆ gridEff()

Real amrex::AmrMesh::gridEff ( ) const
inlinenoexcept

Return the minimum allowable grid efficiency.

◆ InitAmrMesh()

void amrex::AmrMesh::InitAmrMesh ( int  max_level_in,
const Vector< int > &  n_cell_in,
Vector< IntVect refrat = Vector<IntVect>(),
const RealBox rb = nullptr,
int  coord = -1,
const int is_per = nullptr 
)
private

◆ LevelDefined()

bool amrex::AmrMesh::LevelDefined ( int  lev)
noexcept

◆ MakeBaseGrids()

BoxArray amrex::AmrMesh::MakeBaseGrids ( ) const

Make a level 0 grids covering the whole domain. It does NOT install the new grids.

◆ MakeDistributionMap()

DistributionMapping amrex::AmrMesh::MakeDistributionMap ( int  lev,
BoxArray const &  ba 
)
virtual

◆ MakeNewGrids() [1/2]

void amrex::AmrMesh::MakeNewGrids ( int  lbase,
Real  time,
int new_finest,
Vector< BoxArray > &  new_grids 
)

Make new grids based on error estimates. This function expects that valid BoxArrays exist in this->grids from level lbase to level this->finest_level (the current finest level). new_grids. On return, the new finest level is stored in new_finest, and the new grids are stored in new_grids from Array element lbase+1 to new_finest_level (unless fixed grids are used). Note that this function adds at most one more level to the existing levels, and it may remove all levels above the base level. This function does not change the value of this->finest_level, nor does it modifies any BoxArrays stored in this->grids. It also does not modify new_grids's elements outside the range [lbase+1,new_finest_level].

◆ MakeNewGrids() [2/2]

void amrex::AmrMesh::MakeNewGrids ( Real  time = 0.0)

This function makes new grid for all levels (including level 0).

◆ MakeNewLevelFromScratch()

virtual void amrex::AmrMesh::MakeNewLevelFromScratch ( int  ,
Real  ,
const BoxArray ,
const DistributionMapping  
)
inlinevirtual

This function is called by the second version of MakeNewGrids. Make a new level from scratch using provided BoxArray and DistributionMapping. Only used during initialization.

Reimplemented in amrex::Amr, and amrex::AmrCore.

◆ ManualTagsPlacement()

virtual void amrex::AmrMesh::ManualTagsPlacement ( int  ,
TagBoxArray ,
const Vector< IntVect > &   
)
inlinevirtual

Manually tag. Note that tags is built on level lev grids coarsened by bf_lev[lev].

Reimplemented in amrex::Amr.

◆ maxGridSize()

const IntVect& amrex::AmrMesh::maxGridSize ( int  lev) const
inlinenoexcept

Return the largest allowable grid.

◆ maxLevel()

int amrex::AmrMesh::maxLevel ( ) const
inlinenoexcept

Return the max level.

◆ MaxRefRatio()

int amrex::AmrMesh::MaxRefRatio ( int  lev) const
noexcept

Return the maximum refinement ratio in any direction.

◆ nErrorBuf()

int amrex::AmrMesh::nErrorBuf ( int  lev,
int  direction = 0 
) const
inlinenoexcept

Return the number of buffer cells (as a single integer) in error estimator.

◆ nErrorBufVect()

const IntVect& amrex::AmrMesh::nErrorBufVect ( int  lev) const
inlinenoexcept

Return the number of buffer cells (as an IntVect) in error estimator.

◆ nProper()

int amrex::AmrMesh::nProper ( ) const
inlinenoexcept

Return the number of cells to define proper nesting.

◆ operator=() [1/2]

AmrMesh& amrex::AmrMesh::operator= ( AmrMesh &&  rhs)
default

◆ operator=() [2/2]

AmrMesh& amrex::AmrMesh::operator= ( const AmrMesh rhs)
delete

◆ PostProcessBaseGrids()

virtual void amrex::AmrMesh::PostProcessBaseGrids ( BoxArray ) const
inlinevirtual

Apply some user-defined changes the to base grids.

This function is only called by MakeNewGrids after computing a box array for the coarsest level and before calling MakeNewLevelFromScratch.

For example, use this function if you want to remove covered grids on the coarsest refinement level.

◆ ProjPeriodic()

void amrex::AmrMesh::ProjPeriodic ( BoxList blout,
const Box domain,
Array< int, AMREX_SPACEDIM > const &  is_per 
)
staticprivate

◆ refRatio() [1/2]

const Vector<IntVect>& amrex::AmrMesh::refRatio ( ) const
inlinenoexcept

Return refinement ratios between all levels.

◆ refRatio() [2/2]

IntVect amrex::AmrMesh::refRatio ( int  lev) const
inlinenoexcept

Return the refinement ratio for level lev.

◆ SetBlockingFactor() [1/4]

void amrex::AmrMesh::SetBlockingFactor ( const IntVect new_bf)
inlinenoexcept

◆ SetBlockingFactor() [2/4]

void amrex::AmrMesh::SetBlockingFactor ( const Vector< int > &  new_bf)
inlinenoexcept

◆ SetBlockingFactor() [3/4]

void amrex::AmrMesh::SetBlockingFactor ( const Vector< IntVect > &  new_bf)
inlinenoexcept

◆ SetBlockingFactor() [4/4]

void amrex::AmrMesh::SetBlockingFactor ( int  new_bf)
inlinenoexcept

◆ SetBoxArray()

void amrex::AmrMesh::SetBoxArray ( int  lev,
const BoxArray ba_in 
)
noexcept

◆ SetDistributionMap()

void amrex::AmrMesh::SetDistributionMap ( int  lev,
const DistributionMapping dmap_in 
)
noexcept

◆ SetFinestLevel()

void amrex::AmrMesh::SetFinestLevel ( int  new_finest_level)
inlinenoexcept

Set ref_ratio would require rebuilding Geometry objects.

◆ SetGeometry()

void amrex::AmrMesh::SetGeometry ( int  lev,
const Geometry geom_in 
)
noexcept

◆ SetGridEff()

void amrex::AmrMesh::SetGridEff ( Real  eff)
inlinenoexcept

◆ SetIterateToFalse()

void amrex::AmrMesh::SetIterateToFalse ( )
inlineprotectednoexcept

◆ SetMaxGridSize() [1/4]

void amrex::AmrMesh::SetMaxGridSize ( const IntVect new_mgs)
inlinenoexcept

◆ SetMaxGridSize() [2/4]

void amrex::AmrMesh::SetMaxGridSize ( const Vector< int > &  new_mgs)
inlinenoexcept

◆ SetMaxGridSize() [3/4]

void amrex::AmrMesh::SetMaxGridSize ( const Vector< IntVect > &  new_mgs)
inlinenoexcept

◆ SetMaxGridSize() [4/4]

void amrex::AmrMesh::SetMaxGridSize ( int  new_mgs)
inlinenoexcept

◆ SetNProper()

void amrex::AmrMesh::SetNProper ( int  n)
inlinenoexcept

◆ SetUseNewChop()

void amrex::AmrMesh::SetUseNewChop ( )
inlineprotectednoexcept

◆ useFixedCoarseGrids()

bool amrex::AmrMesh::useFixedCoarseGrids ( ) const
inlinenoexcept

Should we keep the coarser grids fixed (and not regrid those levels) at all?

◆ useFixedUpToLevel()

int amrex::AmrMesh::useFixedUpToLevel ( ) const
inlinenoexcept

Up to what level should we keep the coarser grids fixed (and not regrid those levels)?

◆ Verbose()

int amrex::AmrMesh::Verbose ( ) const
inlinenoexcept

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
AmrMesh const &  amr_mesh 
)
friend

Member Data Documentation

◆ dmap

Vector<DistributionMapping> amrex::AmrMesh::dmap
protected

◆ finest_level

int amrex::AmrMesh::finest_level
protected

Current finest level.

◆ geom

Vector<Geometry> amrex::AmrMesh::geom
protected

◆ grids

Vector<BoxArray> amrex::AmrMesh::grids
protected

◆ num_setba

unsigned int amrex::AmrMesh::num_setba = 0
protected

◆ num_setdm

unsigned int amrex::AmrMesh::num_setdm = 0
protected

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