4 int required_coarsening_level,
5 int max_coarsening_level,
6 int ngrow,
bool build_coarse_level_by_coarsening,
9 m_build_coarse_level_by_coarsening(build_coarse_level_by_coarsening),
15 max_coarsening_level =
std::max(required_coarsening_level,max_coarsening_level);
16 max_coarsening_level =
std::min(30,max_coarsening_level);
18 int ngrow_finest =
std::max(ngrow,0);
19 for (
int i = 1; i <= required_coarsening_level; ++i) {
25 m_ngrow.push_back(ngrow_finest);
26 m_gslevel.reserve(max_coarsening_level+1);
30 for (
int ilev = 1; ilev <= max_coarsening_level; ++ilev)
32 bool coarsenable =
m_geom.back().Domain().coarsenable(2,2);
34 if (ilev <= required_coarsening_level) {
35 amrex::Abort(
"IndexSpaceImp: domain is not coarsenable at level "+std::to_string(ilev));
41 int ng = (ilev > required_coarsening_level) ? 0 :
m_ngrow.back()/2;
48 if (ilev <= required_coarsening_level) {
49 if (build_coarse_level_by_coarsening) {
50 amrex::Abort(
"Failed to build required coarse EB level "+std::to_string(ilev));
71 int i = std::distance(m_domain.begin(), it);
80 int i = std::distance(m_domain.begin(), it);
88 if (num_new_fine_levels <= 0) {
return; }
90 if (m_num_coarsen_opt > 0) {
91 m_num_coarsen_opt += num_new_fine_levels;
95 num_new_fine_levels-1, num_new_fine_levels-1,
96 m_ngrow[0], m_build_coarse_level_by_coarsening,
97 m_extend_domain_face, m_num_coarsen_opt);
99 fine_isp.
m_gslevel.reserve(m_domain.size()+num_new_fine_levels);
100 for (
int i = 0; i < m_domain.size(); ++i) {
101 fine_isp.
m_gslevel.emplace_back(std::move(m_gslevel[i]));
105 m_geom.insert(m_geom.begin(), fine_isp.
m_geom.begin(), fine_isp.
m_geom.end());
106 m_domain.insert(m_domain.begin(), fine_isp.
m_domain.begin(), fine_isp.
m_domain.end());
107 m_ngrow.insert(m_ngrow.begin(), fine_isp.
m_ngrow.begin(), fine_isp.
m_ngrow.end());
110 template <
typename G>
114 if (num_new_coarse_levels <= 0) {
return; }
116 auto nlevs_old =
int(m_gslevel.size());
117 int nlevs_new = nlevs_old + num_new_coarse_levels;
120 new_gslevel.reserve(nlevs_new);
123 new_geom.reserve(nlevs_new);
126 new_domain.reserve(nlevs_new);
129 new_ngrow.reserve(nlevs_new);
131 for (
int ilev = 0; ilev < num_new_coarse_levels; ++ilev) {
132 int rr = 1 << (num_new_coarse_levels-ilev);
134 new_domain.push_back(new_geom.back().Domain());
135 new_ngrow.push_back(m_ngrow[0]);
139 for (
int ilev = 0; ilev < nlevs_old; ++ilev) {
140 new_gslevel.emplace_back(std::move(m_gslevel[ilev]));
141 new_geom.push_back (m_geom [ilev]);
142 new_domain.push_back(m_domain[ilev]);
143 new_ngrow.push_back (m_ngrow [ilev]);
151 for (
int ilev = num_new_coarse_levels-1; ilev >= 0; --ilev) {
152 m_gslevel[ilev].buildCutCellMask(m_gslevel[ilev+1]);
#define AMREX_ALWAYS_ASSERT(EX)
Definition: AMReX_BLassert.H:50
Definition: AMReX_EB2_Level.H:115
Definition: AMReX_EB2.H:71
const Level & getLevel(const Geometry &geom) const final
Definition: AMReX_EB2_IndexSpaceI.H:68
Vector< GShopLevel< G > > m_gslevel
Definition: AMReX_EB2.H:103
Vector< int > m_ngrow
Definition: AMReX_EB2.H:106
void addFineLevels(int num_new_fine_levels) final
Definition: AMReX_EB2_IndexSpaceI.H:86
Vector< Geometry > m_geom
Definition: AMReX_EB2.H:104
void addRegularCoarseLevels(int num_new_coarse_levels) final
Definition: AMReX_EB2_IndexSpaceI.H:112
Vector< Box > m_domain
Definition: AMReX_EB2.H:105
const Geometry & getGeometry(const Box &dom) const final
Definition: AMReX_EB2_IndexSpaceI.H:77
Definition: AMReX_EB2_Level.H:33
Rectangular problem domain geometry.
Definition: AMReX_Geometry.H:73
const Box & Domain() const noexcept
Returns our rectangular domain.
Definition: AMReX_Geometry.H:210
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition: AMReX_Vector.H:27
AMREX_EXPORT int max_grid_size
Definition: AMReX_EB2.cpp:23
AMREX_EXPORT bool extend_domain_face
Definition: AMReX_EB2.cpp:24
AMREX_EXPORT int num_coarsen_opt
Definition: AMReX_EB2.cpp:25
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void swap(T &a, T &b) noexcept
Definition: AMReX_algoim_K.H:113
@ min
Definition: AMReX_ParallelReduce.H:18
@ max
Definition: AMReX_ParallelReduce.H:17
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 end(BoxND< dim > const &box) noexcept
Definition: AMReX_Box.H:1890
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > refine(const BoxND< dim > &b, int ref_ratio) noexcept
Definition: AMReX_Box.H:1342
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 begin(BoxND< dim > const &box) noexcept
Definition: AMReX_Box.H:1881
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > coarsen(const BoxND< dim > &b, int ref_ratio) noexcept
Coarsen BoxND by given (positive) refinement ratio. NOTE: if type(dir) = CELL centered: lo <- lo/rati...
Definition: AMReX_Box.H:1304
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition: AMReX.cpp:225
const int[]
Definition: AMReX_BLProfiler.cpp:1664