Skip to content

Commit 188828a

Browse files
committed
rm datawrangler/etc
1 parent fc34c08 commit 188828a

File tree

6 files changed

+13
-641
lines changed

6 files changed

+13
-641
lines changed

src/python3/cpp_simulator.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11

22
#include "python3/cpp_simulator.hpp"
3+
#include "core/utilities/meta/meta_utilities.hpp"
34

45
#if !defined(PHARE_CPP_MOD_NAME)
56
#define PHARE_CPP_MOD_NAME cpp
67
#endif
78

8-
namespace py = pybind11;
9-
109
namespace PHARE::pydata
1110
{
1211
PYBIND11_MODULE(PHARE_CPP_MOD_NAME, m)
@@ -18,9 +17,5 @@ PYBIND11_MODULE(PHARE_CPP_MOD_NAME, m)
1817
declareDim<3>(m);
1918

2019
core::apply(core::possibleSimulators(), [&](auto const& simType) { declare_all(m, simType); });
21-
22-
declarePatchData<std::vector<double>, 1>(m, "PatchDataVectorDouble_1D");
23-
declarePatchData<std::vector<double>, 2>(m, "PatchDataVectorDouble_2D");
24-
declarePatchData<std::vector<double>, 3>(m, "PatchDataVectorDouble_3D");
2520
}
2621
} // namespace PHARE::pydata

src/python3/cpp_simulator.hpp

Lines changed: 12 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,26 @@
11
#ifndef PHARE_PYTHON_CPP_SIMULATOR_HPP
22
#define PHARE_PYTHON_CPP_SIMULATOR_HPP
33

4-
#include <vector>
5-
#include <cstddef>
64

7-
#include "core/def/phare_mpi.hpp"
5+
#include "phare/phare.hpp"
86

97
#include "core/utilities/mpi_utils.hpp"
10-
#include "core/data/particles/particle.hpp"
11-
#include "core/utilities/meta/meta_utilities.hpp"
8+
129
#include "amr/wrappers/hierarchy.hpp"
13-
#include "phare/phare.hpp"
14-
#include "simulator/simulator.hpp"
1510

16-
#include "python3/pybind_def.hpp"
17-
#include "pybind11/stl.h"
18-
#include "pybind11/numpy.h"
19-
#include "pybind11/chrono.h"
20-
#include "pybind11/complex.h"
21-
#include "pybind11/functional.h"
11+
// #include "simulator/simulator.hpp"
2212

2313
#include "python3/particles.hpp"
24-
#include "python3/patch_data.hpp"
25-
#include "python3/patch_level.hpp"
26-
#include "python3/data_wrangler.hpp"
2714

15+
#include "pybind11/numpy.h"
2816

17+
#include <cstddef>
2918

3019
namespace py = pybind11;
3120

3221
namespace PHARE::pydata
3322
{
34-
template<typename Type, std::size_t dimension>
35-
void declarePatchData(py::module& m, std::string key)
36-
{
37-
using PatchDataType = PatchData<Type, dimension>;
38-
py::class_<PatchDataType>(m, key.c_str())
39-
.def_readonly("patchID", &PatchDataType::patchID)
40-
.def_readonly("origin", &PatchDataType::origin)
41-
.def_readonly("lower", &PatchDataType::lower)
42-
.def_readonly("upper", &PatchDataType::upper)
43-
.def_readonly("nGhosts", &PatchDataType::nGhosts)
44-
.def_readonly("data", &PatchDataType::data);
45-
}
23+
4624

4725
template<std::size_t dim>
4826
void declareDim(py::module& m)
@@ -57,9 +35,6 @@ void declareDim(py::module& m)
5735
.def_readwrite("charge", &CP::charge)
5836
.def_readwrite("v", &CP::v)
5937
.def("size", &CP::size);
60-
61-
name = "PatchData" + name;
62-
declarePatchData<CP, dim>(m, name.c_str());
6338
}
6439

6540
template<typename Simulator, typename PyClass>
@@ -84,47 +59,12 @@ void declare_etc(py::module& m)
8459
constexpr auto interp = _interp{}();
8560
constexpr auto nbRefinedPart = _nbRefinedPart{}();
8661

87-
std::string type_string = "_" + std::to_string(dim) + "_" + std::to_string(interp) + "_"
88-
+ std::to_string(nbRefinedPart);
89-
90-
using Sim = Simulator<dim, interp, nbRefinedPart>;
91-
using DW = DataWrangler<dim, interp, nbRefinedPart>;
92-
std::string name = "DataWrangler" + type_string;
93-
py::class_<DW, std::shared_ptr<DW>>(m, name.c_str())
94-
.def(py::init<std::shared_ptr<Sim> const&, std::shared_ptr<amr::Hierarchy> const&>())
95-
.def(py::init<std::shared_ptr<ISimulator> const&, std::shared_ptr<amr::Hierarchy> const&>())
96-
.def("sync_merge", &DW::sync_merge)
97-
.def("getPatchLevel", &DW::getPatchLevel)
98-
.def("getNumberOfLevels", &DW::getNumberOfLevels);
99-
100-
using PL = PatchLevel<dim, interp, nbRefinedPart>;
101-
name = "PatchLevel_" + type_string;
102-
103-
py::class_<PL, std::shared_ptr<PL>>(m, name.c_str())
104-
.def("getEM", &PL::getEM)
105-
.def("getE", &PL::getE)
106-
.def("getB", &PL::getB)
107-
.def("getBx", &PL::getBx)
108-
.def("getBy", &PL::getBy)
109-
.def("getBz", &PL::getBz)
110-
.def("getEx", &PL::getEx)
111-
.def("getEy", &PL::getEy)
112-
.def("getEz", &PL::getEz)
113-
.def("getVix", &PL::getVix)
114-
.def("getViy", &PL::getViy)
115-
.def("getViz", &PL::getViz)
116-
.def("getDensity", &PL::getDensity)
117-
.def("getBulkVelocity", &PL::getBulkVelocity)
118-
.def("getPopDensities", &PL::getPopDensities)
119-
.def("getPopFluxes", &PL::getPopFlux)
120-
.def("getFx", &PL::getFx)
121-
.def("getFy", &PL::getFy)
122-
.def("getFz", &PL::getFz)
123-
.def("getParticles", &PL::getParticles, py::arg("userPopName") = "all");
62+
std::string const type_string = "_" + std::to_string(dim) + "_" + std::to_string(interp) + "_"
63+
+ std::to_string(nbRefinedPart);
12464

12565
using _Splitter
12666
= PHARE::amr::Splitter<_dim, _interp, core::RefinedParticlesConst<nbRefinedPart>>;
127-
name = "Splitter" + type_string;
67+
std::string name = "Splitter" + type_string;
12868
py::class_<_Splitter, std::shared_ptr<_Splitter>>(m, name.c_str())
12969
.def(py::init<>())
13070
.def_property_readonly_static("weight", [](py::object) { return _Splitter::weight; })
@@ -169,15 +109,15 @@ void declare_all(py::module& m, std::tuple<Dimension, InterpOrder, NbRefinedPart
169109
});
170110
}
171111

172-
void declare_essential(py::module& m)
112+
void inline declare_essential(py::module& m)
173113
{
174114
py::class_<SamraiLifeCycle, std::shared_ptr<SamraiLifeCycle>>(m, "SamraiLifeCycle")
175115
.def(py::init<>())
176116
.def("reset", &SamraiLifeCycle::reset);
177117

178118
py::class_<PHARE::amr::Hierarchy, std::shared_ptr<PHARE::amr::Hierarchy>>(m, "AMRHierarchy");
179-
m.def("make_hierarchy", []() { return PHARE::amr::Hierarchy::make(); });
180119

120+
m.def("make_hierarchy", []() { return PHARE::amr::Hierarchy::make(); });
181121
m.def("mpi_size", []() { return core::mpi::size(); });
182122
m.def("mpi_rank", []() { return core::mpi::rank(); });
183123
m.def("mpi_barrier", []() { core::mpi::barrier(); });
@@ -189,7 +129,7 @@ void declare_essential(py::module& m)
189129

190130
// https://stackoverflow.com/a/51061314/795574
191131
// ASAN detects leaks by default, even in system/third party libraries
192-
inline const char* __asan_default_options()
132+
inline char const* __asan_default_options()
193133
{
194134
return "detect_leaks=0";
195135
}

src/python3/data_wrangler.hpp

Lines changed: 0 additions & 185 deletions
This file was deleted.

0 commit comments

Comments
 (0)