![]() |
Block-Structured AMR Software Framework
|
#include <AMReX_AmrMesh.H>
Public Member Functions | |
| AmrMesh () | |
| Construct an empty mesh. | |
| 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) | |
| Construct using legacy inputs (same signature as AmrCore). | |
| AmrMesh (const RealBox &rb, int max_level_in, const Vector< int > &n_cell_in, int coord, Vector< IntVect > const &a_refrat, Array< int, 3 > const &is_per) | |
| Construct with explicit domain and periodicity array. | |
| AmrMesh (Geometry const &level_0_geom, AmrInfo const &amr_info) | |
| Construct from a pre-built Geometry and AmrInfo bundle. | |
| AmrMesh (const AmrMesh &rhs)=delete | |
| AmrMesh & | operator= (const AmrMesh &rhs)=delete |
| AmrMesh (AmrMesh &&rhs)=default | |
| AmrMesh & | operator= (AmrMesh &&rhs)=default |
| virtual | ~AmrMesh ()=default |
| int | Verbose () const noexcept |
| int | maxLevel () const noexcept |
| Return the max level. | |
| int | finestLevel () const noexcept |
| Return the finest level. | |
| IntVect | refRatio (int lev) const noexcept |
| Return the refinement ratio for level lev. | |
| int | MaxRefRatio (int lev) const noexcept |
| Return the maximum refinement ratio in any direction. | |
| const Vector< IntVect > & | refRatio () const noexcept |
| Return refinement ratios between all levels. | |
| const Vector< Geometry > & | Geom () const noexcept |
| const Vector< DistributionMapping > & | DistributionMap () const noexcept |
| const Vector< BoxArray > & | boxArray () const noexcept |
| const Geometry & | Geom (int lev) const noexcept |
| const DistributionMapping & | DistributionMap (int lev) const noexcept |
| const BoxArray & | boxArray (int lev) const noexcept |
| Vector< Geometry > | Geom (int a_coarsest_lev, int a_finest_lev) const noexcept |
| Vector< BoxArray > | boxArray (int a_coarsest_lev, int a_finest_lev) const noexcept |
| Vector< DistributionMapping > | DistributionMap (int a_coarsest_lev, int a_finest_lev) const noexcept |
| Vector< Geometry > & | Geom () noexcept |
| Geometry & | Geom (int lev) noexcept |
| void | SetMaxGridSize (int new_mgs) noexcept |
| Override the max grid size constraint for all levels (scalar version). | |
| void | SetMaxGridSize (const IntVect &new_mgs) noexcept |
Override the max grid size constraint using explicit IntVect new_mgs. | |
| void | SetMaxGridSize (const Vector< int > &new_mgs) noexcept |
Override per-level max grid sizes using scalar-per-level vector new_mgs. | |
| void | SetMaxGridSize (const Vector< IntVect > &new_mgs) noexcept |
Override per-level max grid sizes using explicit IntVect-per-level vector new_mgs. | |
| void | SetBlockingFactor (int new_bf) noexcept |
| Override the blocking factor constraint for all levels (scalar version). | |
| void | SetBlockingFactor (const IntVect &new_bf) noexcept |
Override blocking factor using explicit IntVect new_bf. | |
| void | SetBlockingFactor (const Vector< int > &new_bf) noexcept |
Override per-level blocking factors using scalar-per-level vector new_bf. | |
| void | SetBlockingFactor (const Vector< IntVect > &new_bf) noexcept |
Override per-level blocking factors using explicit IntVect vector new_bf. | |
| void | SetGridEff (Real eff) noexcept |
Set the minimum acceptable grid efficiency to eff. | |
| void | SetNProper (int n) noexcept |
Set the number of cell blocks required for proper nesting to n. | |
| void | SetFinestLevel (int new_finest_level) noexcept |
Update the recorded finest level index to new_finest_level (without reallocating). | |
| void | SetDistributionMap (int lev, const DistributionMapping &dmap_in) noexcept |
Install a DistributionMapping for level lev. | |
| void | SetBoxArray (int lev, const BoxArray &ba_in) noexcept |
Install a BoxArray for level lev. | |
| void | SetGeometry (int lev, const Geometry &geom_in) noexcept |
Install a Geometry object for level lev. | |
| int | GetLevel (Box const &domain) const noexcept |
| Given domain box, return AMR level. Return -1 if there is no match. | |
| void | ClearDistributionMap (int lev) noexcept |
Clear the stored DistributionMapping for level lev. | |
| void | ClearBoxArray (int lev) noexcept |
Clear the stored BoxArray for level lev. | |
| int | nErrorBuf (int lev, int direction=0) const noexcept |
| Return the number of buffer cells (as a single integer) in error estimator. | |
| const IntVect & | nErrorBufVect (int lev) const noexcept |
| Return the number of buffer cells (as an IntVect) in error estimator. | |
| Real | gridEff () const noexcept |
| Return the minimum allowable grid efficiency. | |
| int | nProper () const noexcept |
| Return the number of cell blocks to define proper nesting. | |
| const IntVect & | blockingFactor (int lev) const noexcept |
| Return the blocking factor at level lev. | |
| const IntVect & | maxGridSize (int lev) const noexcept |
| Return the largest allowable grid. | |
| bool | LevelDefined (int lev) const noexcept |
Return true if valid grids/dmaps exist for level lev. | |
| bool | useFixedCoarseGrids () const noexcept |
| Should we keep the coarser grids fixed (and not regrid those levels) at all? | |
| int | useFixedUpToLevel () const noexcept |
| Up to what level should we keep the coarser grids fixed (and not regrid those levels)? | |
| void | ChopGrids (int lev, BoxArray &ba, int target_size) const |
Try to chop grids on level lev until BoxArray ba has at least target_size boxes. | |
| BoxArray | MakeBaseGrids () const |
| Make a level-0 BoxArray covering the whole domain (without installing it). | |
| 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]. | |
| void | MakeNewGrids (Real time=0.0) |
Convenience overload that rebuilds every level (including level 0) at time time. | |
| virtual void | MakeNewLevelFromScratch (int lev, Real time, const BoxArray &ba, const DistributionMapping &dm) |
| Hook invoked by MakeNewGrids() to build a fresh level. | |
| virtual void | ErrorEst (int lev, TagBoxArray &tags, Real time, int ngrow) |
Hook for tagging cells on level lev. | |
| virtual void | ManualTagsPlacement (int lev, TagBoxArray &tags, const Vector< IntVect > &bf_lev) |
Manual tagging hook. Tags are defined on level lev grids coarsened by bf_lev[lev]. | |
| virtual void | PostProcessBaseGrids (BoxArray &box_array) const |
| Allow derived classes to edit the base-level grids before installing them. | |
| virtual BoxArray | GetAreaNotToTag (int lev) |
Return a BoxArray that should never be tagged on level lev (e.g., buffer zones). | |
| Long | CountCells (int lev) const noexcept |
Count the total number of cells at level lev. | |
| virtual DistributionMapping | MakeDistributionMap (int lev, BoxArray const &ba) |
Build a distribution map for level lev grid layout ba (override to customize load balancing). | |
Protected Member Functions | |
| void | checkInput () |
| Validate AmrInfo inputs (throws if inconsistent). | |
| void | SetIterateToFalse () noexcept |
| Disable the iterate-on-new-grids loop for the next MakeNewGrids call. | |
| void | SetUseNewChop () noexcept |
| Force MakeNewGrids to use the newer chopping algorithm. | |
Protected Attributes | |
| int | finest_level |
| Current finest level. | |
| Vector< Geometry > | geom |
| Vector< DistributionMapping > | dmap |
| Vector< BoxArray > | grids |
| 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. | |
| Vector< IntVect > | ref_ratio {{IntVect(2)}} |
| Refinement ratios. | |
| Vector< IntVect > | blocking_factor {{IntVect(8)}} |
| Blocking factor in grid generation (by level). | |
| Vector< IntVect > | max_grid_size {{IntVect( 64 )}} |
| Maximum allowable grid size (by level). | |
| Vector< IntVect > | n_error_buf {{IntVect(1)}} |
| Buffer cells around each tagged cell. | |
| Real | grid_eff = static_cast<Real>(0.7) |
| Grid efficiency. | |
| int | n_proper = 1 |
| Cells required for proper nesting. | |
| 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 |
| int | max_grid_iterations = 4 |
Friends | |
| std::ostream & | operator<< (std::ostream &os, AmrMesh const &amr_mesh) |
| Stream a summary of the mesh hierarchy (level extents, cell counts, etc.). | |
| amrex::AmrMesh::AmrMesh | ( | ) |
Construct an empty mesh.
| 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 |
||
| ) |
Construct using legacy inputs (same signature as AmrCore).
| rb | Optional domain definition; nullptr uses defaults. |
| max_level_in | Maximum level count. |
| n_cell_in | Level-0 cell counts. |
| coord | Coordinate system index (defaults to Cartesian if not specified in ParmParse parameter geometry.coord_sys). |
| refrat | Optional refinement ratios per level. |
| is_per | Optional periodicity flags (defaults to non-periodic if not specified in ParmParse parameter geometry.is_periodic). |
| 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, 3 > const & | is_per | ||
| ) |
Construct with explicit domain and periodicity array.
| rb | Level-0 physical domain. |
| max_level_in | Maximum level count. |
| n_cell_in | Level-0 cell counts. |
| coord | Coordinate system index. |
| a_refrat | Per-level refinement ratios. |
| is_per | Array of periodicity flags (0 = nonperiodic, 1 = periodic). |
|
delete |
|
default |
|
virtualdefault |
Return the blocking factor at level lev.
|
inlinenoexcept |
|
protected |
Validate AmrInfo inputs (throws if inconsistent).
|
noexcept |
Clear the stored DistributionMapping for level lev.
Count the total number of cells at level lev.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinevirtual |
Hook for tagging cells on level lev.
| lev | Level index. |
| tags | Tag boxes (built on level lev). |
| time | Simulation time. |
| ngrow | Number of ghost layers filled in tags. |
Reimplemented in amrex::Amr, and amrex::AmrCore.
|
inlinenoexcept |
Return the finest level.
|
inlinenoexcept |
Return a BoxArray that should never be tagged on level lev (e.g., buffer zones).
Reimplemented in amrex::Amr.
Given domain box, return AMR level. Return -1 if there is no match.
|
inlinenoexcept |
Return the minimum allowable grid efficiency.
|
noexcept |
Return true if valid grids/dmaps exist for level lev.
| BoxArray amrex::AmrMesh::MakeBaseGrids | ( | ) | const |
Make a level-0 BoxArray covering the whole domain (without installing it).
|
virtual |
Build a distribution map for level lev grid layout ba (override to customize load balancing).
| 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].
Build new grids above level lbase using current error tags.
| lbase | Coarsest level to keep fixed. |
| time | Simulation time used when tagging. |
| new_finest | Output: resulting finest level index. |
| new_grids | Output: new BoxArrays for levels > lbase (vector sized finest+1). |
| void amrex::AmrMesh::MakeNewGrids | ( | Real | time = 0.0 | ) |
Convenience overload that rebuilds every level (including level 0) at time time.
|
inlinevirtual |
Hook invoked by MakeNewGrids() to build a fresh level.
| lev | Level index being created. |
| time | Simulation time used for initialization. |
| ba | BoxArray describing the level's grids. |
| dm | Distribution mapping describing ownership. |
Reimplemented in amrex::AmrCore, and amrex::Amr.
|
inlinevirtual |
Manual tagging hook. Tags are defined on level lev grids coarsened by bf_lev[lev].
| lev | Level index. |
| tags | Tag boxes to update. |
| bf_lev | Buffer sizes per level. |
Reimplemented in amrex::Amr.
Return the largest allowable grid.
|
inlinenoexcept |
Return the max level.
Return the maximum refinement ratio in any direction.
Return the number of buffer cells (as a single integer) in error estimator.
Return the number of buffer cells (as an IntVect) in error estimator.
|
inlinenoexcept |
Return the number of cell blocks to define proper nesting.
|
inlinevirtual |
Allow derived classes to edit the base-level grids before installing them.
For example, use this function if you want to remove covered grids on the coarsest refinement level.
This is called by MakeNewGrids() after computing the coarsest-level BoxArray and before invoking MakeNewLevelFromScratch().
| box_array | Base-level boxes (modifiable in place). |
Return refinement ratios between all levels.
Return the refinement ratio for level lev.
|
inlinenoexcept |
Override blocking factor using explicit IntVect new_bf.
Override per-level blocking factors using scalar-per-level vector new_bf.
Override per-level blocking factors using explicit IntVect vector new_bf.
|
inlinenoexcept |
Override the blocking factor constraint for all levels (scalar version).
| new_bf | Blocking factor to enforce in every direction. |
Install a BoxArray for level lev.
| lev | Level index. |
| ba_in | Grid layout to store. |
|
noexcept |
Install a DistributionMapping for level lev.
| lev | Level index being updated. |
| dmap_in | Distribution mapping to store. |
|
inlinenoexcept |
Update the recorded finest level index to new_finest_level (without reallocating).
|
inlinenoexcept |
Set the minimum acceptable grid efficiency to eff.
|
inlineprotectednoexcept |
Disable the iterate-on-new-grids loop for the next MakeNewGrids call.
|
inlinenoexcept |
Override the max grid size constraint using explicit IntVect new_mgs.
Override per-level max grid sizes using scalar-per-level vector new_mgs.
Override per-level max grid sizes using explicit IntVect-per-level vector new_mgs.
|
inlinenoexcept |
Override the max grid size constraint for all levels (scalar version).
| new_mgs | Maximum length in each direction. |
|
inlinenoexcept |
Set the number of cell blocks required for proper nesting to n.
|
inlineprotectednoexcept |
Force MakeNewGrids to use the newer chopping algorithm.
|
inlinenoexcept |
Should we keep the coarser grids fixed (and not regrid those levels) at all?
|
inlinenoexcept |
Up to what level should we keep the coarser grids fixed (and not regrid those levels)?
|
inlinenoexcept |
|
friend |
Stream a summary of the mesh hierarchy (level extents, cell counts, etc.).
| os | Destination stream. |
| amr_mesh | Mesh to describe. |
|
protected |
|
protected |
Current finest level.
|
protected |
|
protected |