N42E473LAYAM5NC4UXPM6WD37FLCUM26JCCKCARQEMXM7V6GWYNQC
7PAIPBWZYYNQN2YXNUNXVMUTVBT2SA7SVX5NMNKMBAE2OAOC63XQC
BJDGFYBMECTJG7BHLNHLSCUCBVYHAY6OGY37FIJP6JDGNDXQNQVAC
WV2J4VRLSW42SGIRDLF326LLC7L2ABAMSZ3YKABS532K27U3X3CAC
6PYEITKIMEZZLF2UZMYD5QJWQYCXKGWTRBE7OENW5EEAXAQSKHPQC
2DKSL6DKZAIYQUJGDULORCKU5K4Z5Z3W4RIKQYDSLKMCNQNDZFBAC
RCLGQ2LZMFVPBPTU2G55DJ6HZPOGGTPZRZCY54VGP6YLHANJ2LAQC
YIQN7NJTGEVKW7JZHL6CTH6EPCIXCNBYNURIGXPYZAOUX3VAJQMAC
IP77XGZUR377SMQSB35CZRWYJ4WYRXHEAORYSEEHX6BXFGJUO4BQC
FEMASUBNU32NSG4DNXZX54CGCA57PVRGYO46L3A6F2EJ4BCSJ3SAC
DJPITUE36JN2YUFH5ZO6M33SEROO5IDTTXIIL4CI7IHLMK6V5STQC
M5R6KQLXLGYSVKHVAX5AJKD6NYE6IM5Z6WVTR3BTKPJDNNKF3ARAC
WASO7G5FJXRXWNH2U2FLUNEKU6VE63OI3HUYP64BVD4LMD6KE7OQC
#warning "TODO: Get these from schedule.cxx"
struct TileBox {
array<int, dim> tile_min;
array<int, dim> tile_max;
};
void enter_level_mode(cGH *restrict cctkGH,
const GHExt::LevelData &restrict leveldata);
void leave_level_mode(cGH *restrict cctkGH,
const GHExt::LevelData &restrict leveldata);
void enter_local_mode(cGH *restrict cctkGH, TileBox &restrict tilebox,
const GHExt::LevelData &restrict leveldata,
const MFIter &mfi);
void leave_local_mode(cGH *restrict cctkGH, TileBox &restrict tilebox,
const GHExt::LevelData &restrict leveldata,
const MFIter &mfi);
file << "# 1:iteration"
<< "\t"
<< "2:time"
<< "\t"
<< "3:level"
<< "\t"
<< "4:component"
<< "\t"
<< "5:i"
<< "\t"
<< "6:j"
<< "\t"
<< "7:k"
<< "\t"
<< "8:x"
<< "\t"
<< "9:y"
<< "\t"
<< "10:z";
file << "# 1:iteration" << sep << "2:time" << sep << "3:level" << sep
<< "4:component" << sep << "5:i" << sep << "6:j" << sep << "7:k" << sep
<< "8:x" << sep << "9:y" << sep << "10:z";
for (MFIter mfi(*leveldata.mfab0); mfi.isValid(); ++mfi) {
TileBox tilebox;
enter_local_mode(const_cast<cGH *>(cctkGH), tilebox, leveldata, mfi);
GridPtrDesc1 grid(leveldata, groupdata, mfi);
const Array4<const CCTK_REAL> &vars = groupdata.mfab.at(tl)->array(mfi);
vector<GF3D1<const CCTK_REAL> > ptrs_;
ptrs_.reserve(groupdata.numvars);
for (int vi = 0; vi < groupdata.numvars; ++vi)
ptrs_.push_back(grid.gf3d(vars, vi));
// write_arrays(file, cctkGH, leveldata.level, mfi.index(), ptrs, grid);
Loop::loop_idx(cctkGH, where_t::everywhere, groupdata.indextype,
[&](const Loop::PointDesc &p) {
file << cctkGH->cctk_iteration << "\t"
<< cctkGH->cctk_time << "\t" << leveldata.level
<< "\t"
<< mfi.index()
// << "\t" << isghost
<< "\t" << (grid.lbnd[0] + p.i) << "\t"
<< (grid.lbnd[1] + p.j) << "\t"
<< (grid.lbnd[2] + p.k) << "\t" << p.x << "\t"
<< p.y << "\t" << p.z;
for (const auto &ptr_ : ptrs_)
file << "\t" << ptr_(p.I);
file << "\n";
});
leave_local_mode(const_cast<cGH *>(cctkGH), tilebox, leveldata, mfi);
const auto &geom = ghext->amrcore->Geom(leveldata.level);
const auto &mfab = *groupdata.mfab.at(tl);
for (MFIter mfi(mfab); mfi.isValid(); ++mfi) {
const Array4<const CCTK_REAL> &vars = mfab.array(mfi);
const auto &imin = vars.begin;
const auto &imax = vars.end;
for (int k = imin.z; k < imax.z; ++k) {
for (int j = imin.y; j < imax.y; ++j) {
for (int i = imin.x; i < imax.x; ++i) {
const array<int, dim> I{i, j, k};
array<CCTK_REAL, dim> x;
for (int d = 0; d < dim; ++d)
x[d] = geom.ProbLo(d) +
(I[d] + 0.5 * groupdata.indextype[d]) * geom.CellSize(d);
file << cctkGH->cctk_iteration << sep << cctkGH->cctk_time << sep
<< leveldata.level << sep << mfi.index() << sep << I[0] << sep
<< I[1] << sep << I[2] << sep << x[0] << sep << x[1] << sep
<< x[2];
for (int n = 0; n < groupdata.numvars; ++n)
file << sep << vars(i, j, k, n);
file << "\n";
}
}
}
file << "# 1:iteration"
<< "\t"
<< "2:time"
<< "\t"
<< "3:varname"
<< "\t"
<< "4:min"
<< "\t"
<< "5:max"
<< "\t"
<< "6:sum"
<< "\t"
<< "7:avg"
<< "\t"
<< "8:stddev"
<< "\t"
<< "9:volume"
<< "\t"
<< "10:maxabs"
<< "\t"
<< "11:L1norm"
<< "\t"
<< "12:L2norm"
file << "# 1:iteration" << sep << "2:time" << sep << "3:varname" << sep
<< "4:min" << sep << "5:max" << sep << "6:sum" << sep << "7:avg" << sep
<< "8:stddev" << sep << "9:volume" << sep << "10:maxabs" << sep
<< "11:L1norm" << sep << "12:L2norm"
file << cctk_iteration << "\t" << cctk_time << "\t"
<< CCTK_FullVarName(groupdata.firstvarindex + vi) << "\t"
<< red.min << "\t" << red.max << "\t" << red.sum << "\t"
<< red.avg() << "\t" << red.sdv() << "\t" << red.norm0() << "\t"
<< red.norm1() << "\t" << red.norm2() << "\t" << red.norm_inf()
<< "\n";
file << cctk_iteration << sep << cctk_time << sep
<< CCTK_FullVarName(groupdata.firstvarindex + vi) << sep << red.min
<< sep << red.max << sep << red.sum << sep << red.avg() << sep
<< red.sdv() << sep << red.norm0() << sep << red.norm1() << sep
<< red.norm2() << sep << red.norm_inf() << "\n";