diff --git a/src/Particle/ParticleContainer.H b/src/Particle/ParticleContainer.H index 887ad72b..5dfcdc36 100644 --- a/src/Particle/ParticleContainer.H +++ b/src/Particle/ParticleContainer.H @@ -192,13 +192,13 @@ void make_ParticleContainer_and_Iterators (py::module &m, std::string allocstr) .def_property_readonly_static("NArrayReal", [](const py::object&){return ParticleContainerType::NArrayReal; }) .def_property_readonly_static("NArrayInt", [](const py::object&){return ParticleContainerType::NArrayInt; }) - .def_property_readonly("NumRealComps", &ParticleContainerType::NumRealComps, + .def_property_readonly("num_real_comps", &ParticleContainerType::NumRealComps, "The number of compile-time and runtime Real components in SoA") - .def_property_readonly("NumIntComps", &ParticleContainerType::NumIntComps, + .def_property_readonly("num_int_comps", &ParticleContainerType::NumIntComps, "The number of compile-time and runtime int components in SoA") - .def_property_readonly("NumRuntimeRealComps", &ParticleContainerType::NumRuntimeRealComps, + .def_property_readonly("num_runtime_real_comps", &ParticleContainerType::NumRuntimeRealComps, "The number of runtime Real components in SoA") - .def_property_readonly("NumRuntimeIntComps", &ParticleContainerType::NumRuntimeIntComps, + .def_property_readonly("num_runtime_int_comps", &ParticleContainerType::NumRuntimeIntComps, "The number of runtime Int components in SoA") .def_property_readonly("finest_level", &ParticleContainerBase::finestLevel) @@ -231,8 +231,8 @@ void make_ParticleContainer_and_Iterators (py::module &m, std::string allocstr) .def("numLocalTilesAtLevel", &ParticleContainerType::numLocalTilesAtLevel) - .def("reserveData", &ParticleContainerType::reserveData) - .def("resizeData", &ParticleContainerType::resizeData) + .def("reserve_data", &ParticleContainerType::reserveData) + .def("resize_data", &ParticleContainerType::resizeData) // void InitFromAsciiFile (const std::string& file, int extradata, // const IntVect* Nrep = nullptr); diff --git a/src/Particle/StructOfArrays.cpp b/src/Particle/StructOfArrays.cpp index c26ad19c..9b8ba9ae 100644 --- a/src/Particle/StructOfArrays.cpp +++ b/src/Particle/StructOfArrays.cpp @@ -24,9 +24,9 @@ void make_StructOfArrays(py::module &m, std::string allocstr) py::class_(m, soa_name.c_str()) .def(py::init()) .def("define", &SOAType::define) - .def("NumRealComps", &SOAType::NumRealComps, + .def_property_readonly("num_real_comps", &SOAType::NumRealComps, "Get the number of compile-time + runtime Real components") - .def("NumIntComps", &SOAType::NumIntComps, + .def_property_readonly("num_int_comps", &SOAType::NumIntComps, "Get the number of compile-time + runtime Int components") // compile-time components diff --git a/src/amrex/StructOfArrays.py b/src/amrex/StructOfArrays.py index f007909c..c22a90e1 100644 --- a/src/amrex/StructOfArrays.py +++ b/src/amrex/StructOfArrays.py @@ -32,10 +32,10 @@ def soa_to_numpy(self, copy=False): if self.size() == 0: raise ValueError("SoA is empty.") - for idx_real in range(self.NumRealComps()): + for idx_real in range(self.num_real_comps): soa_view.real.append(self.GetRealData(idx_real).to_numpy(copy=copy)) - for idx_int in range(self.NumIntComps()): + for idx_int in range(self.num_int_comps): soa_view.int.append(self.GetIntData(idx_int).to_numpy(copy=copy)) return soa_view @@ -70,10 +70,10 @@ def soa_to_cupy(self, copy=False): if self.size() == 0: raise ValueError("SoA is empty.") - for idx_real in range(self.NumRealComps()): + for idx_real in range(self.num_real_comps): soa_view.real.append(self.GetRealData(idx_real).to_cupy(copy=copy)) - for idx_int in range(self.NumIntComps()): + for idx_int in range(self.num_int_comps): soa_view.int.append(self.GetIntData(idx_int).to_cupy(copy=copy)) return soa_view diff --git a/tests/test_particleContainer.py b/tests/test_particleContainer.py index 9f1897e4..f4ef1423 100644 --- a/tests/test_particleContainer.py +++ b/tests/test_particleContainer.py @@ -129,7 +129,7 @@ def test_pc_init(): # lvl = 0 for lvl in range(pc.finest_level + 1): print(f"at level {lvl}:") - for pti in amr.ParIter_1_1_2_1_default(pc, level=lvl): + for pti in pc.iterator(pc, level=lvl): print("...") assert pti.num_particles == 1 assert pti.num_real_particles == 1 @@ -158,7 +158,7 @@ def test_pc_init(): # read-only for lvl in range(pc.finest_level + 1): - for pti in amr.ParConstIter_1_1_2_1_default(pc, level=lvl): + for pti in pc.const_iterator(pc, level=lvl): assert pti.num_particles == 1 assert pti.num_real_particles == 1 assert pti.num_neighbor_particles == 0 diff --git a/tests/test_soa.py b/tests/test_soa.py index 24c6911f..0edaaf78 100644 --- a/tests/test_soa.py +++ b/tests/test_soa.py @@ -8,15 +8,15 @@ def test_soa_init(): soa = amr.StructOfArrays_2_1_default() print("--test init --") - print("num real components", soa.NumRealComps()) - print("num int components", soa.NumIntComps()) - assert soa.NumRealComps() == 2 and soa.NumIntComps() == 1 + print("num real components", soa.num_real_comps) + print("num int components", soa.num_int_comps) + assert soa.num_real_comps == 2 and soa.num_int_comps == 1 soa.define(1, 3) print("--test define --") - print("num real components", soa.NumRealComps()) - print("num int components", soa.NumIntComps()) - assert soa.NumRealComps() == 3 and soa.NumIntComps() == 4 + print("num real components", soa.num_real_comps) + print("num int components", soa.num_int_comps) + assert soa.num_real_comps == 3 and soa.num_int_comps == 4 print("num particles", soa.numParticles()) print("num real particles", soa.numRealParticles()) print("num totalparticles", soa.numTotalParticles())