TVBD244E7Q7WV44CRBTFST535NUP3JAZH6OLL4IKDR3OWEXSU7HAC
2XYZZL42IEZHGDJA6NDKGSQKGJP24LOTLFJ6RNHOKWHHSUYIHGKQC
MSBBCXVGD3GRLE5KAI6BKAFRV7SQUWI2SNN43AJAUD3ISRCEXY6QC
722HZ7UFINNE3YKSYKP2NHZ5XEG5QQLQHSKC7PREJZR3EX6RDYUAC
RTNZAS3UPI6GG3KY4Z5WVXJ4R2YF5427BB6WAV3GHRS5W7XPOSUQC
QN2UTSQP4IMCMVXZNR24J22N24ASGXF6EWXQ2P3VWVQERUPFAFDQC
PQB3EKQ6MBCXPTW4HB7SGMSTOTYMB3EFZX2573OFCQI6PSOEKCSQC
KG47IF4CPCUT3BHS34WDRHTH5HYMBTY4OSTB3X7APR2E5ZJ32IYQC
U77PE56ICORZNQW33NXGSEMW7GDHCSSZ4EXB6OHBJSHEG6WHYSSQC
S7LV6VRMBSJPJ765HYMGC5IZ4LCQRJ7VH3D3E36PD6LHVGPQWNYAC
OJZWEAJRLOA5FZAC6FMGBQ6XFQFDNO55IRWLFWDAYWM54MUIU5LAC
RCLGQ2LZMFVPBPTU2G55DJ6HZPOGGTPZRZCY54VGP6YLHANJ2LAQC
VAF66DTVLDWNG7N2PEQYEH4OH5SPSMFBXKPR2PU67IIM6CVPCJ7AC
BVR7DVINVPQG7PA6Z7QYVYNQ43YZL7XCC6AOMSMWMGAAB2Q43STAC
KQNKYNRSWOY2K7M5PY362RJT4CRUJVECVSCNGKSJJBPYI3NU4GDQC
CCTK_REAL refinement_level TYPE=gf
{
refinement_level
} "Refinement level"
: AmrMesh(rb, max_level_in, n_cell_in, coord, ref_ratios, is_per) {}
CactusAmrMesh::CactusAmrMesh(const RealBox &rb, int max_level_in,
: AmrCore(rb, max_level_in, n_cell_in, coord, ref_ratios, is_per) {}
CactusAmrCore::CactusAmrCore(const RealBox &rb, int max_level_in,
// refine centre
const Box &dom = Geom(level).Domain();
Box nbx;
for (int d = 0; d < dim; ++d) {
int md = (dom.bigEnd(d) + dom.smallEnd(d) + 1) / 2;
int rd = (dom.bigEnd(d) - dom.smallEnd(d) + 1) / 2;
// mark one fewer cells; AMReX seems to add one cell
nbx.setSmall(d, md - rd / (1 << (level + 1)) + 1);
nbx.setBig(d, md + rd / (1 << (level + 1)) - 2);
}
cout << "nbx: " << nbx << "\n";
const BoxArray &ba = boxArray(level);
tags.setVal(intersect(ba, nbx), TagBox::SET);
return;
// // refine centre
// const Box &dom = Geom(level).Domain();
// Box nbx;
// for (int d = 0; d < dim; ++d) {
// int md = (dom.bigEnd(d) + dom.smallEnd(d) + 1) / 2;
// int rd = (dom.bigEnd(d) - dom.smallEnd(d) + 1) / 2;
// // mark one fewer cells; AMReX seems to add one cell
// nbx.setSmall(d, md - rd / (1 << (level + 1)) + 1);
// nbx.setBig(d, md + rd / (1 << (level + 1)) - 2);
// }
// cout << "EE nbx: " << nbx << "\n";
// const BoxArray &ba = boxArray(level);
// tags.setVal(intersect(ba, nbx), TagBox::SET);
}
void CactusAmrCore::MakeNewLevelFromScratch(int lev, Real time,
const BoxArray &ba,
const DistributionMapping &dm) {
CCTK_VINFO("MakeNewLevelFromScratch level %d", lev);
}
void CactusAmrCore::MakeNewLevelFromCoarse(int lev, Real time,
const BoxArray &ba,
const DistributionMapping &dm) {
CCTK_VINFO("MakeNewLevelFromCoarse level %d", lev);
int new_finest = -999;
Vector<BoxArray> new_grids;
ghext->amrmesh->MakeNewGrids(0, time, new_finest, new_grids);
cout << "level=" << level << "\n";
cout << "new_finest=" << new_finest << "\n";
assert(new_finest == level - 1 || new_finest == level);
ghext->amrmesh->SetFinestLevel(new_finest);
ghext->amrMesh->SetBoxArray(level, new_grids.at(level));
ghext->amrMesh->SetDistributionMap(...);
ghext->amrcore->regrid(0, time);
int numlevels = ghext->amrcore->finestLevel() + 1;
int maxnumlevels = ghext->amrcore->maxLevel() + 1;
cout << "CRG numlevels=" << numlevels << "\n";
cout << "CRG maxnumlevels=" << maxnumlevels << "\n";
assert(numlevels >= 0 && numlevels <= maxnumlevels);
assert(numlevels <= level + 1);
// virtual void ManualTagsPlacement(int lev, TagBoxArray &tags,
// const Vector<IntVect> &bf_lev) override;
// virtual BoxArray GetAreaNotToTag(int lev) override;
virtual void MakeNewLevelFromScratch(int lev, Real time, const BoxArray &ba,
const DistributionMapping &dm) override;
virtual void MakeNewLevelFromCoarse(int lev, Real time, const BoxArray &ba,
const DistributionMapping &dm) override;
virtual void RemakeLevel(int lev, Real time, const BoxArray &ba,
const DistributionMapping &dm) override;
virtual void ClearLevel(int lev) override;
#include <cctk.h>
#include <cctk_Arguments.h>
#include <cctk_Parameters.h>
namespace AMReX {
using namespace std;
extern "C" void AMReX_SetLevel(CCTK_ARGUMENTS) {
DECLARE_CCTK_ARGUMENTS;
DECLARE_CCTK_PARAMETERS;
int levfac = cctk_levfac[0];
int lev = 0;
while (levfac > 1) {
levfac >>= 1;
lev += 1;
}
for (int k = 0; k < cctk_lsh[2]; ++k) {
for (int j = 0; j < cctk_lsh[1]; ++j) {
#pragma omp simd
for (int i = 0; i < cctk_lsh[0]; ++i) {
const int idx = CCTK_GFINDEX3D(cctkGH, i, j, k);
refinement_level[idx] = lev;
}
}
}
}
} // namespace AMReX
cout << "old_numlevels=" << old_numlevels << "\n";
cout << "new_numlevels=" << new_numlevels << "\n";
cout << "max_numlevels=" << int(ghext->amrmesh->maxLevel() + 1) << "\n";
cout << "I old_numlevels=" << old_numlevels << "\n";
cout << "I new_numlevels=" << new_numlevels << "\n";
cout << "I max_numlevels=" << int(ghext->amrcore->maxLevel() + 1) << "\n";