Block-Structured AMR Software Framework
amrex::AmrCore Class Referenceabstract

Provide basic functionalities to set up an AMR hierarchy. More...

#include <AMReX_AmrCore.H>

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

Public Member Functions

 AmrCore ()
 
 AmrCore (const RealBox *rb, int max_level_in, const Vector< int > &n_cell_in, int coord=-1, Vector< IntVect > ref_ratios=Vector< IntVect >(), const int *is_per=nullptr)
 
 AmrCore (const RealBox &rb, int max_level_in, const Vector< int > &n_cell_in, int coord, Vector< IntVect > const &ref_ratios, Array< int, AMREX_SPACEDIM > const &is_per)
 
 AmrCore (Geometry const &level_0_geom, AmrInfo const &amr_info)
 
 AmrCore (AmrCore &&rhs) noexcept
 
AmrCoreoperator= (AmrCore &&rhs) noexcept
 
 AmrCore (const AmrCore &rhs)=delete
 
AmrCoreoperator= (const AmrCore &rhs)=delete
 
 ~AmrCore () override
 
void InitFromScratch (Real time)
 Initialize BoxArray, DistributionMapping and data from scratch. Calling this function requires the derive class implement its own MakeNewLevelFromScratch to allocate and initialize data. Also note usually one needs to average the fine data down to coarse level after this. More...
 
virtual void regrid (int lbase, Real time, bool initial=false)
 Rebuild levels finer than lbase. More...
 
void printGridSummary (std::ostream &os, int min_lev, int max_lev) const noexcept
 
- Public Member Functions inherited from amrex::AmrMesh
 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) const 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) const 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 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) const noexcept
 
virtual DistributionMapping MakeDistributionMap (int lev, BoxArray const &ba)
 

Protected Member Functions

void ErrorEst (int lev, TagBoxArray &tags, Real time, int ngrow) override=0
 Tag cells for refinement. TagBoxArray tags is built on level lev grids. More...
 
void MakeNewLevelFromScratch (int lev, Real time, const BoxArray &ba, const DistributionMapping &dm) override=0
 
virtual void MakeNewLevelFromCoarse (int lev, Real time, const BoxArray &ba, const DistributionMapping &dm)=0
 Make a new level using provided BoxArray and DistributionMapping and fill with interpolated coarse level data. More...
 
virtual void RemakeLevel (int lev, Real time, const BoxArray &ba, const DistributionMapping &dm)=0
 Remake an existing level using provided BoxArray and DistributionMapping and fill with existing fine and coarse data. More...
 
virtual void ClearLevel (int lev)=0
 Delete level data. More...
 
- Protected Member Functions inherited from amrex::AmrMesh
void checkInput ()
 
void SetIterateToFalse () noexcept
 
void SetUseNewChop () noexcept
 

Private Member Functions

void InitAmrCore ()
 

Additional Inherited Members

- Protected Attributes inherited from amrex::AmrMesh
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,64))}}
 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
 

Detailed Description

Provide basic functionalities to set up an AMR hierarchy.

Because it does not own any floating point data, AmrCore used virtual functions to allocate, initialize and delete data. It also requires the derived class to tag cells for refinement.

Constructor & Destructor Documentation

◆ AmrCore() [1/6]

amrex::AmrCore::AmrCore ( )

◆ AmrCore() [2/6]

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

◆ AmrCore() [3/6]

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

◆ AmrCore() [4/6]

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

◆ AmrCore() [5/6]

amrex::AmrCore::AmrCore ( AmrCore &&  rhs)
noexcept

◆ AmrCore() [6/6]

amrex::AmrCore::AmrCore ( const AmrCore rhs)
delete

◆ ~AmrCore()

amrex::AmrCore::~AmrCore ( )
override

Member Function Documentation

◆ ClearLevel()

virtual void amrex::AmrCore::ClearLevel ( int  lev)
protectedpure virtual

Delete level data.

Implemented in amrex::Amr.

◆ ErrorEst()

void amrex::AmrCore::ErrorEst ( int  lev,
TagBoxArray tags,
Real  time,
int  ngrow 
)
overrideprotectedpure virtual

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

Reimplemented from amrex::AmrMesh.

Implemented in amrex::Amr.

◆ InitAmrCore()

void amrex::AmrCore::InitAmrCore ( )
private

◆ InitFromScratch()

void amrex::AmrCore::InitFromScratch ( Real  time)

Initialize BoxArray, DistributionMapping and data from scratch. Calling this function requires the derive class implement its own MakeNewLevelFromScratch to allocate and initialize data. Also note usually one needs to average the fine data down to coarse level after this.

◆ MakeNewLevelFromCoarse()

virtual void amrex::AmrCore::MakeNewLevelFromCoarse ( int  lev,
Real  time,
const BoxArray ba,
const DistributionMapping dm 
)
protectedpure virtual

Make a new level using provided BoxArray and DistributionMapping and fill with interpolated coarse level data.

Implemented in amrex::Amr.

◆ MakeNewLevelFromScratch()

void amrex::AmrCore::MakeNewLevelFromScratch ( int  lev,
Real  time,
const BoxArray ba,
const DistributionMapping dm 
)
overrideprotectedpure virtual

Make a new level from scratch using provided BoxArray and DistributionMapping. Only used during initialization.

Reimplemented from amrex::AmrMesh.

Implemented in amrex::Amr.

◆ operator=() [1/2]

AmrCore & amrex::AmrCore::operator= ( AmrCore &&  rhs)
noexcept

◆ operator=() [2/2]

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

◆ printGridSummary()

void amrex::AmrCore::printGridSummary ( std::ostream &  os,
int  min_lev,
int  max_lev 
) const
noexcept

◆ regrid()

void amrex::AmrCore::regrid ( int  lbase,
Real  time,
bool  initial = false 
)
virtual

Rebuild levels finer than lbase.

Reimplemented in amrex::Amr.

◆ RemakeLevel()

virtual void amrex::AmrCore::RemakeLevel ( int  lev,
Real  time,
const BoxArray ba,
const DistributionMapping dm 
)
protectedpure virtual

Remake an existing level using provided BoxArray and DistributionMapping and fill with existing fine and coarse data.

Implemented in amrex::Amr.


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