diff --git a/tests/diagnostic/job_1d.py.in b/tests/diagnostic/job_1d.py.in index 38a06d57b..dd503066f 100644 --- a/tests/diagnostic/job_1d.py.in +++ b/tests/diagnostic/job_1d.py.in @@ -1,8 +1,8 @@ #!/usr/bin/env python3 import os, sys -import phare.pharein as ph -from phare.pharein import ElectronModel +import pyphare.pharein as ph +from pyphare.pharein import ElectronModel from tests.simulator import basicSimulatorArgs, makeBasicModel from tests.diagnostic import dump_all_diags diff --git a/tests/diagnostic/job_2d.py.in b/tests/diagnostic/job_2d.py.in index 49e2456a3..2a35b35b8 100644 --- a/tests/diagnostic/job_2d.py.in +++ b/tests/diagnostic/job_2d.py.in @@ -1,8 +1,8 @@ #!/usr/bin/env python3 import os, sys -import phare.pharein as ph -from phare.pharein import ElectronModel +import pyphare.pharein as ph +from pyphare.pharein import ElectronModel from tests.simulator import basicSimulatorArgs, makeBasicModel from tests.diagnostic import dump_all_diags diff --git a/tests/diagnostic/test-diagnostics_2d.cpp b/tests/diagnostic/test-diagnostics_2d.cpp index 761532366..41cdee1ec 100644 --- a/tests/diagnostic/test-diagnostics_2d.cpp +++ b/tests/diagnostic/test-diagnostics_2d.cpp @@ -6,6 +6,8 @@ static std::string const job_file = "job_2d"; static std::string const out_dir = "phare_outputs/diags_2d/"; +// blocked by https://github.com/PHAREHUB/PHARE/pull/230 + TYPED_TEST(Simulator2dTest, fluid) { fluid_test(TypeParam{job_file}, out_dir); diff --git a/tests/diagnostic/test_diagnostics.h b/tests/diagnostic/test_diagnostics.h index afd5f0fce..946dcd5f0 100644 --- a/tests/diagnostic/test_diagnostics.h +++ b/tests/diagnostic/test_diagnostics.h @@ -132,16 +132,10 @@ struct Hi5Diagnostic HybridModel& model_; std::string out_; unsigned flags_; -<<<<<<< HEAD DiagnosticsManager dMan; Writer_t& writer; ModelView_t const& modelView; -======= - ModelView_t modelView{hierarchy_, model_}; - Writer_t writer{modelView, out_, flags_}; - DiagnosticsManager dMan{writer}; ->>>>>>> 19e8a70... 2d C++ diagnotic tests }; diff --git a/tests/diagnostic/test_diagnostics.ipp b/tests/diagnostic/test_diagnostics.ipp index edd9d2020..732959348 100644 --- a/tests/diagnostic/test_diagnostics.ipp +++ b/tests/diagnostic/test_diagnostics.ipp @@ -16,10 +16,10 @@ void fluid_test(Simulator&& sim, std::string out_dir) Hi5Diagnostic hi5{hierarchy, hybridModel, out_dir, NEW_HI5_FILE}; hi5.dMan.addDiagDict(hi5.fluid("/ions/density")) .addDiagDict(hi5.fluid("/ions/bulkVelocity")) - .addDiagDict(hi5.fluid("/ions/pop/ions_alpha/density")) - .addDiagDict(hi5.fluid("/ions/pop/ions_alpha/flux")) - .addDiagDict(hi5.fluid("/ions/pop/ions_protons/density")) - .addDiagDict(hi5.fluid("/ions/pop/ions_protons/flux")); + .addDiagDict(hi5.fluid("/ions/pop/alpha/density")) + .addDiagDict(hi5.fluid("/ions/pop/alpha/flux")) + .addDiagDict(hi5.fluid("/ions/pop/protons/density")) + .addDiagDict(hi5.fluid("/ions/pop/protons/flux")); sim.dump(hi5.dMan); } @@ -59,12 +59,12 @@ void particles_test(Simulator&& sim, std::string out_dir) { // scoped to destruct after dump Hi5Diagnostic hi5{hierarchy, hybridModel, out_dir, NEW_HI5_FILE}; - hi5.dMan.addDiagDict(hi5.particles("/ions/pop/ions_alpha/domain")) - .addDiagDict(hi5.particles("/ions/pop/ions_alpha/levelGhost")) - .addDiagDict(hi5.particles("/ions/pop/ions_alpha/patchGhost")) - .addDiagDict(hi5.particles("/ions/pop/ions_protons/domain")) - .addDiagDict(hi5.particles("/ions/pop/ions_protons/levelGhost")) - .addDiagDict(hi5.particles("/ions/pop/ions_protons/patchGhost")); + hi5.dMan.addDiagDict(hi5.particles("/ions/pop/alpha/domain")) + .addDiagDict(hi5.particles("/ions/pop/alpha/levelGhost")) + .addDiagDict(hi5.particles("/ions/pop/alpha/patchGhost")) + .addDiagDict(hi5.particles("/ions/pop/protons/domain")) + .addDiagDict(hi5.particles("/ions/pop/protons/levelGhost")) + .addDiagDict(hi5.particles("/ions/pop/protons/patchGhost")); sim.dump(hi5.dMan); } @@ -82,8 +82,8 @@ void allFromPython_test(Simulator&& sim, std::string out_dir) sim.dump(*sim.dMan); sim.dMan.reset(); - sim.modelView.reset(); - sim.writer.reset(); // keeps a handle and breaks the following readonly opening + // sim.modelView.reset(); + // sim.writer.reset(); // keeps a handle and breaks the following readonly opening auto& hybridModel = *sim.getHybridModel(); auto& hierarchy = *sim.hierarchy; diff --git a/tests/simulator/__init__.py b/tests/simulator/__init__.py index 8485bc996..b8982f6e0 100644 --- a/tests/simulator/__init__.py +++ b/tests/simulator/__init__.py @@ -1,6 +1,5 @@ -from pybindlibs import cpp import pyphare.pharein as ph, numpy as np from pyphare.pharein import ElectronModel @@ -131,6 +130,7 @@ def populate_simulation(dim, interp, **input): def cpp_splitter_type(dim, interp, n_particles): + from pybindlibs import cpp # includes static samrai lifecycle return getattr(cpp, "Splitter_" + str(dim) + "_" + str(interp)+ "_" + str(n_particles), diff --git a/tests/simulator/advance.py b/tests/simulator/advance.py deleted file mode 100644 index d33033640..000000000 --- a/tests/simulator/advance.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python3 -# -# formatted with black - -from pybindlibs import cpp -from tests.simulator import create_simulator -from pyphare.data.wrangler import DataWrangler -import unittest - -class AdvanceTest(unittest.TestCase): - - def tearDown(self): - cpp.reset() - - def test_1d(self): - - for interp in range(1, 2): - - self.dman, self.sim, self.hier = create_simulator(1, interp) - dw = DataWrangler(self.sim, self.hier) - - for pop, particles in dw.getPatchLevel(1).getParticles().items(): - print("pop :", pop) - for key, patches in particles.items(): - print("\tkey :", key) - for patch in patches: - print("\t\t", patch.patchID, "size:", patch.data.size()) - - print("ADVANCE") - self.sim.advance(.001) - - for pop, particles in dw.getPatchLevel(1).getParticles().items(): - print("pop :", pop) - for key, patches in particles.items(): - print("\tkey :", key) - for patch in patches: - print("\t\t", patch.patchID, "size:", patch.data.size()) - - del ( - dw, - self.dman, - self.sim, - self.hier, - ) - cpp.reset() - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/simulator/per_test.h b/tests/simulator/per_test.h index 76611ddf4..60e8efd66 100644 --- a/tests/simulator/per_test.h +++ b/tests/simulator/per_test.h @@ -33,7 +33,7 @@ struct HierarchyMaker -template +template struct TestSimulator : public HierarchyMaker<_dim>, public PHARE::Simulator<_dim, _interp, _nbRefinePart> { @@ -70,7 +70,8 @@ struct TestSimulator : public HierarchyMaker<_dim>, if (dict(job_py)["simulation"].contains("diagnostics")) { dMan = PHARE::diagnostic::DiagnosticsManagerResolver::make_shared( - *this->hierarchy, *this->getHybridModel(), dict()["simulation"]["diagnostics"]); + *this->hierarchy, *this->getHybridModel(), + dict(job_py)["simulation"]["diagnostics"]); } } @@ -87,7 +88,8 @@ struct /*[[deprecated]]*/ SimulatorTest : public ::testing::Test { }; -using Simulators = testing::Types, TestSimulator<1, 2>, TestSimulator<1, 3>>; +using Simulators + = testing::Types, TestSimulator<1, 2, 2>, TestSimulator<1, 3, 2>>; TYPED_TEST_SUITE(SimulatorTest, Simulators); @@ -96,7 +98,8 @@ template struct Simulator1dTest : public ::testing::Test { }; -using Simulators1d = testing::Types, TestSimulator<1, 2>, TestSimulator<1, 3>>; +using Simulators1d + = testing::Types, TestSimulator<1, 2, 2>, TestSimulator<1, 3, 2>>; TYPED_TEST_SUITE(Simulator1dTest, Simulators1d); @@ -104,7 +107,8 @@ template struct Simulator2dTest : public ::testing::Test { }; -using Simulators2d = testing::Types, TestSimulator<2, 2>, TestSimulator<2, 3>>; +using Simulators2d + = testing::Types, TestSimulator<2, 2, 8>, TestSimulator<2, 3, 8>>; TYPED_TEST_SUITE(Simulator2dTest, Simulators2d); /*