Skip to content

Commit

Permalink
even more
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipDeegan committed Jun 6, 2024
1 parent fe6973b commit 204f53e
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 21 deletions.
5 changes: 5 additions & 0 deletions tests/diagnostic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ cmake_minimum_required (VERSION 3.20.1)

project(test-diagnostics)

if(NOT ${PHARE_PROJECT_DIR} STREQUAL ${CMAKE_BINARY_DIR})
file(GLOB PYFILES "*.py")
file(COPY ${PYFILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
endif()

set(SOURCES_INC
${PROJECT_SOURCE_DIR}/test_diagnostics.hpp
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from tests.simulator import basicSimulatorArgs, makeBasicModel
from tests.diagnostic import dump_all_diags

out = "phare_outputs/diags_1d/"
out = "phare_outputs/diags_1d/1"
simInput = {"diag_options": {"format": "phareh5", "options": {"dir": out, "mode" : "overwrite"}}}

ph.Simulation(**basicSimulatorArgs(dim = 1, interp = 1, **simInput))
Expand Down
14 changes: 14 additions & 0 deletions tests/diagnostic/job_1d_2core.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env python3

import pyphare.pharein as ph
from pyphare.pharein import ElectronModel
from tests.simulator import basicSimulatorArgs, makeBasicModel
from tests.diagnostic import dump_all_diags

out = "phare_outputs/diags_1d/2"
simInput = {"diag_options": {"format": "phareh5", "options": {"dir": out, "mode" : "overwrite"}}}

ph.Simulation(**basicSimulatorArgs(dim = 1, interp = 1, **simInput))
model = makeBasicModel()
ElectronModel(closure="isothermal",Te = 0.12)
dump_all_diags(model.populations)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from tests.simulator import basicSimulatorArgs, makeBasicModel
from tests.diagnostic import dump_all_diags

out = "phare_outputs/diags_2d/"
out = "phare_outputs/diags_2d/1"
simInput = {"diag_options": {"format": "phareh5", "options": {"dir": out, "mode" : "overwrite"}}}

ph.Simulation(**basicSimulatorArgs(dim = 2, interp = 1, **simInput))
Expand Down
14 changes: 14 additions & 0 deletions tests/diagnostic/job_2d_2core.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env python3

import pyphare.pharein as ph
from pyphare.pharein import ElectronModel
from tests.simulator import basicSimulatorArgs, makeBasicModel
from tests.diagnostic import dump_all_diags

out = "phare_outputs/diags_2d/2"
simInput = {"diag_options": {"format": "phareh5", "options": {"dir": out, "mode" : "overwrite"}}}

ph.Simulation(**basicSimulatorArgs(dim = 2, interp = 1, **simInput))
model = makeBasicModel()
ElectronModel(closure="isothermal",Te = 0.12)
dump_all_diags(model.populations)
16 changes: 7 additions & 9 deletions tests/diagnostic/test-diagnostics_1d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,28 @@

#include "test_diagnostics.ipp"

static std::string const job_file = "job_1d";
void static out_dir()
{
return std::string{"phare_outputs/diags_2d/" + std::to_string() PHARE::core::mpi::rank()};
}
static std::string const job_file = "job_1d_" + std::to_string(PHARE::core::mpi::size()) + "core";
static std::string const out_dir = "phare_outputs/diags_1d/" + std::to_string(PHARE::core::mpi::size());


TYPED_TEST(Simulator1dTest, fluid)
{
fluid_test(TypeParam{job_file}, out_dir());
fluid_test(TypeParam{job_file}, out_dir);
}

TYPED_TEST(Simulator1dTest, particles)
{
particles_test(TypeParam{job_file}, out_dir());
particles_test(TypeParam{job_file}, out_dir);
}

TYPED_TEST(Simulator1dTest, electromag)
{
electromag_test(TypeParam{job_file}, out_dir());
electromag_test(TypeParam{job_file}, out_dir);
}

TYPED_TEST(Simulator1dTest, allFromPython)
{
allFromPython_test(TypeParam{job_file}, out_dir());
allFromPython_test(TypeParam{job_file}, out_dir);
}


Expand Down
16 changes: 6 additions & 10 deletions tests/diagnostic/test-diagnostics_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,28 @@

#include "test_diagnostics.ipp"

static std::string const job_file = "job_2d";

void static out_dir()
{
return std::string{"phare_outputs/diags_2d/" + std::to_string() PHARE::core::mpi::rank()};
}
static std::string const job_file = "job_2d_" + std::to_string(PHARE::core::mpi::size()) + "core";
static std::string const out_dir = "phare_outputs/diags_2d/" + std::to_string(PHARE::core::mpi::size());


TYPED_TEST(Simulator2dTest, fluid)
{
fluid_test(TypeParam{job_file}, out_dir());
fluid_test(TypeParam{job_file}, out_dir);
}

TYPED_TEST(Simulator2dTest, particles)
{
particles_test(TypeParam{job_file}, out_dir());
particles_test(TypeParam{job_file}, out_dir);
}

TYPED_TEST(Simulator2dTest, electromag)
{
electromag_test(TypeParam{job_file}, out_dir());
electromag_test(TypeParam{job_file}, out_dir);
}

TYPED_TEST(Simulator2dTest, allFromPython)
{
allFromPython_test(TypeParam{job_file}, out_dir());
allFromPython_test(TypeParam{job_file}, out_dir);
}


Expand Down

0 comments on commit 204f53e

Please sign in to comment.