3 #include <AMReX_Config.H>
14 #ifdef AMREX_USE_BITTREE
15 #include <Bittree_BittreeAmr.h>
29 #if defined(AMREX_USE_GPU)
72 const int* is_per =
nullptr);
101 [[nodiscard]]
int MaxRefRatio (
int lev)
const noexcept;
116 r.reserve(a_finest_lev-a_coarsest_lev+1);
117 for (
int lev = a_coarsest_lev; lev <= a_finest_lev; ++lev) {
118 r.push_back(
geom[lev]);
124 r.reserve(a_finest_lev-a_coarsest_lev+1);
125 for (
int lev = a_coarsest_lev; lev <= a_finest_lev; ++lev) {
132 r.reserve(a_finest_lev-a_coarsest_lev+1);
133 for (
int lev = a_coarsest_lev; lev <= a_finest_lev; ++lev) {
134 r.push_back(
dmap[lev]);
185 [[nodiscard]]
int GetLevel (
Box const& domain)
const noexcept;
191 [[nodiscard]]
int nErrorBuf (
int lev,
int direction = 0) const noexcept {
return n_error_buf[lev][direction]; }
208 [[nodiscard]]
bool LevelDefined (
int lev)
const noexcept;
262 [[nodiscard]] Long
CountCells (
int lev)
const noexcept;
273 #ifdef AMREX_USE_BITTREE
274 bool use_bittree =
false;
275 std::unique_ptr<bittree::BittreeAmr> btmesh;
289 const RealBox* rb =
nullptr,
int coord = -1,
290 const int* is_per =
nullptr);
296 std::ostream&
operator<< (std::ostream& os, AmrMesh
const& amr_mesh);
#define AMREX_D_PICK(a, b, c)
Definition: AMReX_SPACE.H:151
#define AMREX_D_DECL(a, b, c)
Definition: AMReX_SPACE.H:104
Definition: AMReX_AmrMesh.H:62
void SetBlockingFactor(const Vector< IntVect > &new_bf) noexcept
Definition: AMReX_AmrMesh.H:170
const IntVect & nErrorBufVect(int lev) const noexcept
Return the number of buffer cells (as an IntVect) in error estimator.
Definition: AMReX_AmrMesh.H:194
const DistributionMapping & DistributionMap(int lev) const noexcept
Definition: AMReX_AmrMesh.H:111
AmrMesh()
Definition: AMReX_AmrMesh.cpp:18
Vector< Geometry > geom
Definition: AMReX_AmrMesh.H:269
Vector< Geometry > & Geom() noexcept
Definition: AMReX_AmrMesh.H:139
virtual void MakeNewLevelFromScratch(int, Real, const BoxArray &, const DistributionMapping &)
Definition: AMReX_AmrMesh.H:244
int maxLevel() const noexcept
Return the max level.
Definition: AMReX_AmrMesh.H:92
void SetIterateToFalse() noexcept
Definition: AMReX_AmrMesh.H:283
unsigned int num_setdm
Definition: AMReX_AmrMesh.H:278
const Vector< BoxArray > & boxArray() const noexcept
Definition: AMReX_AmrMesh.H:108
const IntVect & maxGridSize(int lev) const noexcept
Return the largest allowable grid.
Definition: AMReX_AmrMesh.H:206
void SetBlockingFactor(const Vector< int > &new_bf) noexcept
Definition: AMReX_AmrMesh.H:164
const Vector< Geometry > & Geom() const noexcept
Definition: AMReX_AmrMesh.H:106
const Vector< IntVect > & refRatio() const noexcept
Return refinement ratios between all levels.
Definition: AMReX_AmrMesh.H:104
void SetBoxArray(int lev, const BoxArray &ba_in) noexcept
Definition: AMReX_AmrMesh.cpp:406
AmrMesh(AmrMesh &&rhs)=default
unsigned int num_setba
Definition: AMReX_AmrMesh.H:279
void SetDistributionMap(int lev, const DistributionMapping &dmap_in) noexcept
Definition: AMReX_AmrMesh.cpp:399
Vector< DistributionMapping > DistributionMap(int a_coarsest_lev, int a_finest_lev) const noexcept
Definition: AMReX_AmrMesh.H:130
void SetMaxGridSize(int new_mgs) noexcept
Definition: AMReX_AmrMesh.H:142
bool LevelDefined(int lev) const noexcept
Definition: AMReX_AmrMesh.cpp:441
AmrMesh & operator=(const AmrMesh &rhs)=delete
void SetUseNewChop() noexcept
Definition: AMReX_AmrMesh.H:284
const BoxArray & boxArray(int lev) const noexcept
Definition: AMReX_AmrMesh.H:112
static void ProjPeriodic(BoxList &blout, const Box &domain, Array< int, AMREX_SPACEDIM > const &is_per)
Definition: AMReX_AmrMesh.cpp:1047
int useFixedUpToLevel() const noexcept
Up to what level should we keep the coarser grids fixed (and not regrid those levels)?
Definition: AMReX_AmrMesh.H:214
int finestLevel() const noexcept
Return the finest level.
Definition: AMReX_AmrMesh.H:95
int GetLevel(Box const &domain) const noexcept
Given domain box, return AMR level. Return -1 if there is no match.
Definition: AMReX_AmrMesh.cpp:419
void SetGridEff(Real eff) noexcept
Definition: AMReX_AmrMesh.H:174
int finest_level
Current finest level.
Definition: AMReX_AmrMesh.H:268
Real gridEff() const noexcept
Return the minimum allowable grid efficiency.
Definition: AMReX_AmrMesh.H:197
IntVect refRatio(int lev) const noexcept
Return the refinement ratio for level lev.
Definition: AMReX_AmrMesh.H:98
friend std::ostream & operator<<(std::ostream &os, AmrMesh const &amr_mesh)
Definition: AMReX_AmrMesh.cpp:1236
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.
Definition: AMReX_AmrMesh.cpp:467
virtual void ErrorEst(int, TagBoxArray &, Real, int)
Tag cells for refinement. TagBoxArray tags is built on level lev grids.
Definition: AMReX_AmrMesh.H:247
int MaxRefRatio(int lev) const noexcept
Return the maximum refinement ratio in any direction.
Definition: AMReX_AmrMesh.cpp:389
virtual ~AmrMesh()=default
const Vector< DistributionMapping > & DistributionMap() const noexcept
Definition: AMReX_AmrMesh.H:107
Geometry & Geom(int lev) noexcept
Definition: AMReX_AmrMesh.H:140
void checkInput()
Definition: AMReX_AmrMesh.cpp:1118
void SetMaxGridSize(const IntVect &new_mgs) noexcept
Definition: AMReX_AmrMesh.H:145
virtual BoxArray GetAreaNotToTag(int)
Definition: AMReX_AmrMesh.H:260
int Verbose() const noexcept
Definition: AMReX_AmrMesh.H:89
int nProper() const noexcept
Return the number of cells to define proper nesting.
Definition: AMReX_AmrMesh.H:200
AmrMesh(const AmrMesh &rhs)=delete
void SetGeometry(int lev, const Geometry &geom_in) noexcept
Definition: AMReX_AmrMesh.cpp:413
Vector< Geometry > Geom(int a_coarsest_lev, int a_finest_lev) const noexcept
Definition: AMReX_AmrMesh.H:114
void SetFinestLevel(int new_finest_level) noexcept
Set ref_ratio would require rebuilding Geometry objects.
Definition: AMReX_AmrMesh.H:179
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)
Definition: AMReX_AmrMesh.cpp:75
Vector< DistributionMapping > dmap
Definition: AMReX_AmrMesh.H:270
void SetBlockingFactor(int new_bf) noexcept
Definition: AMReX_AmrMesh.H:158
virtual void ManualTagsPlacement(int, TagBoxArray &, const Vector< IntVect > &)
Manually tag. Note that tags is built on level lev grids coarsened by bf_lev[lev].
Definition: AMReX_AmrMesh.H:250
virtual DistributionMapping MakeDistributionMap(int lev, BoxArray const &ba)
Definition: AMReX_AmrMesh.cpp:447
BoxArray MakeBaseGrids() const
Make a level 0 grids covering the whole domain. It does NOT install the new grids.
Definition: AMReX_AmrMesh.cpp:521
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->gr...
Definition: AMReX_AmrMesh.cpp:548
int nErrorBuf(int lev, int direction=0) const noexcept
Return the number of buffer cells (as a single integer) in error estimator.
Definition: AMReX_AmrMesh.H:191
virtual void PostProcessBaseGrids(BoxArray &) const
Definition: AMReX_AmrMesh.H:258
void SetMaxGridSize(const Vector< IntVect > &new_mgs) noexcept
Definition: AMReX_AmrMesh.H:154
Long CountCells(int lev) const noexcept
Definition: AMReX_AmrMesh.cpp:1231
void SetBlockingFactor(const IntVect &new_bf) noexcept
Definition: AMReX_AmrMesh.H:161
const Geometry & Geom(int lev) const noexcept
Definition: AMReX_AmrMesh.H:110
void SetMaxGridSize(const Vector< int > &new_mgs) noexcept
Definition: AMReX_AmrMesh.H:148
Vector< BoxArray > grids
Definition: AMReX_AmrMesh.H:271
void SetNProper(int n) noexcept
Definition: AMReX_AmrMesh.H:175
bool useFixedCoarseGrids() const noexcept
Should we keep the coarser grids fixed (and not regrid those levels) at all?
Definition: AMReX_AmrMesh.H:211
Vector< BoxArray > boxArray(int a_coarsest_lev, int a_finest_lev) const noexcept
Definition: AMReX_AmrMesh.H:122
const IntVect & blockingFactor(int lev) const noexcept
Return the blocking factor at level lev.
Definition: AMReX_AmrMesh.H:203
void ClearDistributionMap(int lev) noexcept
Definition: AMReX_AmrMesh.cpp:429
void ClearBoxArray(int lev) noexcept
Definition: AMReX_AmrMesh.cpp:435
A collection of Boxes stored in an Array.
Definition: AMReX_BoxArray.H:549
A class for managing a List of Boxes that share a common IndexType. This class implements operations ...
Definition: AMReX_BoxList.H:52
Calculates the distribution of FABs to MPI processes.
Definition: AMReX_DistributionMapping.H:41
Rectangular problem domain geometry.
Definition: AMReX_Geometry.H:73
A Box with real dimensions. A RealBox is OK iff volume >= 0.
Definition: AMReX_RealBox.H:21
An array of TagBoxes.
Definition: AMReX_TagBox.H:150
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition: AMReX_Vector.H:27
Definition: AMReX_Amr.cpp:49
IntVectND< AMREX_SPACEDIM > IntVect
Definition: AMReX_BaseFwd.H:30
std::ostream & operator<<(std::ostream &os, AmrMesh const &amr_mesh)
Definition: AMReX_AmrMesh.cpp:1236
std::array< T, N > Array
Definition: AMReX_Array.H:24
Definition: AMReX_AmrMesh.H:20
int n_proper
Cells required for proper nesting.
Definition: AMReX_AmrMesh.H:39
bool refine_grid_layout
Definition: AMReX_AmrMesh.H:47
bool use_fixed_coarse_grids
Definition: AMReX_AmrMesh.H:41
Vector< IntVect > ref_ratio
Refinement ratios.
Definition: AMReX_AmrMesh.H:25
bool use_new_chop
Definition: AMReX_AmrMesh.H:56
Real grid_eff
Grid efficiency.
Definition: AMReX_AmrMesh.H:37
bool iterate_on_new_grids
Definition: AMReX_AmrMesh.H:57
bool check_input
Definition: AMReX_AmrMesh.H:55
Vector< IntVect > n_error_buf
Buffer cells around each tagged cell.
Definition: AMReX_AmrMesh.H:35
int max_level
Maximum allowed level.
Definition: AMReX_AmrMesh.H:23
IntVect refine_grid_layout_dims
Definition: AMReX_AmrMesh.H:53
Vector< IntVect > max_grid_size
Maximum allowable grid size (by level).
Definition: AMReX_AmrMesh.H:30
int use_fixed_upto_level
Definition: AMReX_AmrMesh.H:40
int verbose
Definition: AMReX_AmrMesh.H:21
Vector< IntVect > blocking_factor
Blocking factor in grid generation (by level).
Definition: AMReX_AmrMesh.H:27