Skip to content

Commit

Permalink
Updated Add Component APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Apr 1, 2024
1 parent f329e60 commit 67cd6cf
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 21 deletions.
8 changes: 0 additions & 8 deletions src/Particle/ParticleContainer.H
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ void make_ParticleContainer_and_Iterators (py::module &m, std::string allocstr)
.def_property_readonly("num_runtime_int_comps", &ParticleContainerType::NumRuntimeIntComps,
"The number of runtime Int components in SoA")


.def_property_readonly("num_position_components", [](const py::object&){ return AMREX_SPACEDIM; })
.def_property_readonly("byte_spread", &ParticleContainerType::ByteSpread)

Expand All @@ -211,13 +210,6 @@ void make_ParticleContainer_and_Iterators (py::module &m, std::string allocstr)
.def("add_int_comp", &ParticleContainerType::template AddIntComp<bool>,
py::arg("communicate")=true, "add a new runtime component with type Int")

.def("resize_runtime_real_comp", &ParticleContainerType::ResizeRuntimeRealComp,
py::arg("new_size"), py::arg("communicate"),
"Resize the Real runtime components (SoA)")
.def("resize_runtime_int_comp", &ParticleContainerType::ResizeRuntimeIntComp,
py::arg("new_size"), py::arg("communicate"),
"Resize the Int runtime components (SoA)")

.def_property_readonly("finest_level", &ParticleContainerBase::finestLevel)

// ParticleContainer ( const ParticleContainer &) = delete;
Expand Down
1 change: 0 additions & 1 deletion src/amrex/StructOfArrays.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ def soa_to_numpy(self, copy=False):
real_comp_names = self.soa_real_comps(self.num_real_comps, rotate=False)

for idx_real in range(self.num_real_comps):
print(idx_real, real_comp_names[idx_real], self.get_real_data(idx_real).size())
soa_view.real[real_comp_names[idx_real]] = self.get_real_data(
idx_real
).to_numpy(copy=copy)
Expand Down
14 changes: 2 additions & 12 deletions tests/test_particleContainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ def particle_container(Npart, std_geometry, distmap, boxarr, std_real_box):
pc.add_int_comp(True)
pc.add_int_comp(True)

# can be removed after
# https://github.com/AMReX-Codes/amrex/pull/3615
pc.resize_runtime_real_comp(1, True)
pc.resize_runtime_int_comp(2, True)

# assign some values to runtime components
for lvl in range(pc.finest_level + 1):
for pti in pc.iterator(pc, level=lvl):
Expand All @@ -83,11 +78,6 @@ def soa_particle_container(Npart, std_geometry, distmap, boxarr, std_real_box):
pc.add_int_comp(True)
pc.add_int_comp(True)

# can be removed after
# https://github.com/AMReX-Codes/amrex/pull/3615
pc.resize_runtime_real_comp(1, True)
pc.resize_runtime_int_comp(2, True)

# assign some values to runtime components
for lvl in range(pc.finest_level + 1):
for pti in pc.iterator(pc, level=lvl):
Expand Down Expand Up @@ -454,7 +444,7 @@ def test_pc_df(particle_container, Npart):
print(df.columns)
print(df)

assert len(df.columns) == 12
assert len(df.columns) == 14


@pytest.mark.skipif(
Expand Down Expand Up @@ -545,4 +535,4 @@ def test_pc_df_mpi(particle_container, Npart):
print(df.columns)
print(df)

assert len(df.columns) == 12
assert len(df.columns) == 14

0 comments on commit 67cd6cf

Please sign in to comment.