Skip to content

Commit

Permalink
also modify python layer
Browse files Browse the repository at this point in the history
  • Loading branch information
atmyers committed Jul 21, 2023
1 parent 07b44fd commit c20cd5d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
4 changes: 1 addition & 3 deletions examples/expanding_beam/run_expanding.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
import amrex.space3d as amr
from impactx import ImpactX, RefPart, distribution, elements

pp_amr = amr.ParmParse("amr")
pp_amr.addarr("n_cell", [56, 56, 48])

sim = ImpactX()

# set numerical parameters and IO control
sim.n_cell = [56, 56, 48]
sim.particle_shape = 2 # B-spline order
sim.space_charge = True
sim.dynamic_size = True
Expand Down
5 changes: 2 additions & 3 deletions src/initialization/InitAmrCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ namespace details
{
amrex::ParmParse pp_amr("amr");

// Domain index space
amrex::Vector<int> n_cell;
pp_amr.getarr("n_cell", n_cell);
// Domain index space - we use dummy values here, then fix later
amrex::Vector<int> n_cell = {AMREX_D_DECL(256,256,256)};
amrex::Box domain(amrex::IntVect(0), amrex::IntVect(n_cell));

// Domain physical size
Expand Down
6 changes: 3 additions & 3 deletions src/python/ImpactX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ void init_ImpactX (py::module& m)
pp_amr.getarr("n_cell", n_cell);
return n_cell;
},
[](ImpactX & /* ix */, std::array<int, AMREX_SPACEDIM> /* n_cell */) {
throw std::runtime_error("setting n_cell is not yet implemented");
/*
[](ImpactX & /* ix */, std::array<int, AMREX_SPACEDIM> n_cell) {
amrex::ParmParse pp_amr("amr");
amrex::Vector<int> const n_cell_v(n_cell.begin(), n_cell.end());
pp_amr.addarr("n_cell", n_cell_v);

// note, this must be done *before* initGrids is called
/*
int const max_level = ix.maxLevel();
for (int lev=0; lev<=max_level; lev++) {
ix.ClearLevel(lev);
Expand Down

0 comments on commit c20cd5d

Please sign in to comment.