Skip to content

Commit

Permalink
CarpetX: Set up ParmParse options earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
eschnett committed Sep 5, 2023
1 parent ef3e128 commit e625c7b
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions CarpetX/src/driver.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1209,31 +1209,6 @@ GHExt::PatchData::PatchData(const int patch) : patch(patch) {
symmetries[0][1] == symmetry_t::periodic,
symmetries[0][2] == symmetry_t::periodic};

// Set blocking factors via parameter table since AmrMesh needs to
// know them when its constructor is running, but there are no
// constructor arguments for them
amrex::ParmParse pp;
pp.add("amr.max_grid_size_x", max_grid_size_x);
pp.add("amr.max_grid_size_y", max_grid_size_y);
pp.add("amr.max_grid_size_z", max_grid_size_z);
pp.add("amr.refine_grid_layout", refine_grid_layout);
pp.add("amr.blocking_factor_x", blocking_factor_x);
pp.add("amr.blocking_factor_y", blocking_factor_y);
pp.add("amr.blocking_factor_z", blocking_factor_z);
pp.add("amr.grid_eff", grid_efficiency);
if (poison_undefined_values) {
// Tell AMReX to initialize FArrayBoxes with nans
pp.add("fab.do_initval", true);
pp.add("fab.init_snan", true);
amrex::FArrayBox::set_do_initval(true);
amrex::FArrayBox::set_initval(
std::numeric_limits<amrex::Real>::signaling_NaN());
}
// Set tile size
pp.addarr(
"fabarray.mfiter_tile_size",
std::vector<int>{max_tile_size_x, max_tile_size_y, max_tile_size_z});

amrcore = make_unique<CactusAmrCore>(patch, domain, max_num_levels - 1,
ncells, coord, reffacts, is_periodic);

Expand Down Expand Up @@ -2338,13 +2313,39 @@ void *SetupGH(tFleshConfig *fc, int convLevel, cGH *restrict cctkGH) {

// Initialize AMReX
amrex::ParmParse pp;

// Don't catch Unix signals. If signals are caught, we don't get
// core files.
pp.add("amrex.signal_handling", 0);
// Throw exceptions for failing AMReX assertions. With exceptions,
// we get core files.
pp.add("amrex.throw_exception", 1);

// Set blocking factors via parameter table since AmrMesh needs to
// know them when its constructor is running, but there are no
// constructor arguments for them
amrex::ParmParse pp;
pp.add("amr.max_grid_size_x", max_grid_size_x);
pp.add("amr.max_grid_size_y", max_grid_size_y);
pp.add("amr.max_grid_size_z", max_grid_size_z);
pp.add("amr.refine_grid_layout", refine_grid_layout);
pp.add("amr.blocking_factor_x", blocking_factor_x);
pp.add("amr.blocking_factor_y", blocking_factor_y);
pp.add("amr.blocking_factor_z", blocking_factor_z);
pp.add("amr.grid_eff", grid_efficiency);
if (poison_undefined_values) {
// Tell AMReX to initialize FArrayBoxes with nans
pp.add("fab.do_initval", true);
pp.add("fab.init_snan", true);
amrex::FArrayBox::set_do_initval(true);
amrex::FArrayBox::set_initval(
std::numeric_limits<amrex::Real>::signaling_NaN());
}
// Set tile size
pp.addarr(
"fabarray.mfiter_tile_size",
std::vector<int>{max_tile_size_x, max_tile_size_y, max_tile_size_z});

std::vector<char *> args;
for (std::size_t n = 0; n < 100; ++n)
if (amrex_parameters[n][0])
Expand Down

0 comments on commit e625c7b

Please sign in to comment.