Skip to content

Commit

Permalink
rebase oopsie
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipDeegan committed Jul 17, 2020
1 parent 032956f commit 68d926c
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 77 deletions.
4 changes: 2 additions & 2 deletions tests/diagnostic/job_1d.py.in
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions tests/diagnostic/job_2d.py.in
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 2 additions & 0 deletions tests/diagnostic/test-diagnostics_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 0 additions & 6 deletions tests/diagnostic/test_diagnostics.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,10 @@ struct Hi5Diagnostic
HybridModel& model_;
std::string out_;
unsigned flags_;
<<<<<<< HEAD

DiagnosticsManager<Writer_t> dMan;
Writer_t& writer;
ModelView_t const& modelView;
=======
ModelView_t modelView{hierarchy_, model_};
Writer_t writer{modelView, out_, flags_};
DiagnosticsManager<Writer_t> dMan{writer};
>>>>>>> 19e8a70... 2d C++ diagnotic tests
};


Expand Down
24 changes: 12 additions & 12 deletions tests/diagnostic/test_diagnostics.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ void fluid_test(Simulator&& sim, std::string out_dir)
Hi5Diagnostic<Hierarchy, HybridModel> 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);
}

Expand Down Expand Up @@ -59,12 +59,12 @@ void particles_test(Simulator&& sim, std::string out_dir)

{ // scoped to destruct after dump
Hi5Diagnostic<Hierarchy, HybridModel> 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);
}

Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/simulator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@


from pybindlibs import cpp
import pyphare.pharein as ph, numpy as np
from pyphare.pharein import ElectronModel

Expand Down Expand Up @@ -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),
Expand Down
49 changes: 0 additions & 49 deletions tests/simulator/advance.py

This file was deleted.

14 changes: 9 additions & 5 deletions tests/simulator/per_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct HierarchyMaker



template<size_t _dim, size_t _interp, size_t _nbRefinePart = 2>
template<size_t _dim, size_t _interp, size_t _nbRefinePart>
struct TestSimulator : public HierarchyMaker<_dim>,
public PHARE::Simulator<_dim, _interp, _nbRefinePart>
{
Expand Down Expand Up @@ -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"]);
}
}

Expand All @@ -87,7 +88,8 @@ struct /*[[deprecated]]*/ SimulatorTest : public ::testing::Test
{
};

using Simulators = testing::Types<TestSimulator<1, 1>, TestSimulator<1, 2>, TestSimulator<1, 3>>;
using Simulators
= testing::Types<TestSimulator<1, 1, 2>, TestSimulator<1, 2, 2>, TestSimulator<1, 3, 2>>;

TYPED_TEST_SUITE(SimulatorTest, Simulators);

Expand All @@ -96,15 +98,17 @@ template<typename Simulator>
struct Simulator1dTest : public ::testing::Test
{
};
using Simulators1d = testing::Types<TestSimulator<1, 1>, TestSimulator<1, 2>, TestSimulator<1, 3>>;
using Simulators1d
= testing::Types<TestSimulator<1, 1, 2>, TestSimulator<1, 2, 2>, TestSimulator<1, 3, 2>>;
TYPED_TEST_SUITE(Simulator1dTest, Simulators1d);


template<typename Simulator>
struct Simulator2dTest : public ::testing::Test
{
};
using Simulators2d = testing::Types<TestSimulator<2, 1>, TestSimulator<2, 2>, TestSimulator<2, 3>>;
using Simulators2d
= testing::Types<TestSimulator<2, 1, 8>, TestSimulator<2, 2, 8>, TestSimulator<2, 3, 8>>;
TYPED_TEST_SUITE(Simulator2dTest, Simulators2d);

/*
Expand Down

0 comments on commit 68d926c

Please sign in to comment.