1"""Unit tests for multiple plotters per solver (@ref exahype2.api.Solver.Solver.add_plotter())
2and the checkpoints (@ref exahype2.api.fv.WriteCheckpoint, @ref exahype2.api.rkfd4.WriteCheckpoint)."""
18 solver.add_pde_term(exahype2.api.DirichletBoundaryConditions(implementation=
""))
23 solver, patch_size=9, rk_order=2
30 exahype2_project = types.SimpleNamespace(periodic_BC=[periodic] * 3)
32 for plotter
in solver.plotters:
33 plotter.construct_output(exahype2_project, peano_project, graph)
39 generator(
"probe::AbstractProbe")
40 for existing, generator
in solver._abstract_solver_methods
41 if existing == declaration
43 assert len(matches) == 1, declaration
52 assert [p.name
for p
in solver.plotters] == [
62 with pytest.raises(ValueError):
66 with pytest.raises(ValueError):
73 with pytest.raises(ValueError):
79 assert solver.plotter
is None
82 with pytest.raises(RuntimeError):
85 solver.plotter = checkpoint
86 assert solver.plotters == [checkpoint]
88 assert solver.plotters == []
100 solver._add_wants_to_plot_to_solver()
101 solver._add_wants_to_plot_to_solver()
104 "double _nextPlotAsVTKFileTimeStamp = 0.0;"
105 in solver._abstract_solver_attributes
108 "double _nextWriteCheckpointTimeStamp = 0.5;"
109 in solver._abstract_solver_attributes
112 solver,
"void finishPlotAsVTKFile();"
115 assert "isPlotAsVTKFileActive() or isWriteCheckpointActive()" in wants_to_plot
124 solver,
"std::string toCheckpointMetaData() const override;"
126 assert definition.count(
"toCheckpointMetaDataEntry(") == 2
128 'toCheckpointMetaDataEntry("nextWriteCheckpointTimeStamp", _nextWriteCheckpointTimeStamp)'
136 plotter.add_plot_filter((0.0, 0.0), (0.5, 0.5))
137 solver.add_plotter(plotter)
139 (action_set,) = graph.tasks[0].action_sets
140 assert action_set.d[
"SELECT_DOFS"] == [1, 2, 4]
141 assert action_set.d[
"PLOTTED_UNKNOWNS"] ==
"3"
142 assert action_set.d[
"DESCRIPTION"] ==
"j[0], j[1], c"
143 assert "marker.overlaps" in action_set.d[
"GUARD_PREDICATE"]
144 assert action_set.get_guard_of_operation(
"touchCellFirstTime").startswith(
145 "repositories::instanceOfProbe.isPlotAsVTKFileActive()"
152 assert not hasattr(checkpoint,
"add_plot_filter")
153 with pytest.raises(TypeError):
157@pytest.mark.parametrize("scheme,halo", [("fv", 1), (
"fd4", 2)])
159 solver =
_solver(scheme, dirichlet=
True)
165 graph =
_plot_graph(solver, tmp_path, periodic=
False)
166 names = sorted(task.name
for task
in graph.tasks)
168 "Probe_Apply Dirichlet BCs for WriteCheckpoint",
169 "Probe_WriteCheckpoint_Reconstruct",
170 "Probe_WriteCheckpoint_Write checkpoint",
172 active =
"repositories::instanceOfProbe.isWriteCheckpointActive()"
173 for task
in graph.tasks:
174 for action_set
in task.action_sets:
176 "touchCellFirstTime",
177 "touchFaceFirstTime",
180 guard = action_set.get_guard_of_operation(operation)
181 assert guard ==
"true" or active
in guard, (task.name, operation, guard)
183 (write,) = [t
for t
in graph.tasks
if t.name.endswith(
"Write checkpoint")]
184 (action_set,) = write.action_sets
185 assert action_set.d[
"DOFS_PER_AXIS"] == str(9 + 2 * halo)
186 assert action_set.d[
"UNKNOWNS"] ==
"5"
187 assert action_set.d[
"SELECT_DOFS"]
is None
188 assert action_set.d[
"PATCH_SCALING"] == (9 + 2 * halo) / 9
189 assert action_set.d[
"PRECISION"] == 17
190 assert action_set.d[
"WRITER_PRECISION"] == 17
191 assert action_set.d[
"METADATA_EVALUATION"] == (
192 "repositories::instanceOfProbe.toCheckpointMetaData()"
194 assert "finishWriteCheckpoint();" in action_set.get_body_of_unprepareTraversal()
The conservative flux F(Q) of a hyperbolic PDE.
Point-wise initial condition: given the physical position of a single degree of freedom,...
The maximum absolute eigenvalue of the flux Jacobian in a given direction, i.e.
Abstract base class for all ExaHyPE 2 solvers.
Plotting counterpart to RusanovWithExplicitEuler: maps the patch data of a Finite Volume scheme with ...
Finite Volumes with a Rusanov Riemann solver and explicit Euler time stepping, realised over a block-...
Write checkpoints of a Finite Volume solver.
Fourth-order central Finite Differences with explicit Runge-Kutta time stepping, realised over a bloc...
Write checkpoints of the fourth-order Finite Differences.
Represents a Peano 4 project.
Holds a sequence of Task instances.
The task graph abstraction allows users to formalise their solver steps over small task graphs which ...
test_checkpoint_has_neither_filters_nor_quantities()
test_plotter_names_have_to_be_unique_identifiers()
_solver(scheme="fv", dirichlet=False)
test_checkpoint_reconstructs_and_writes_patch_with_halo(tmp_path, scheme, halo)
_method_definition(solver, declaration)
test_vtk_plotter_selects_quantities(tmp_path)
test_plotters_get_names_from_class_and_counter()
_plot_graph(solver, tmp_path, periodic=True)
test_plotters_must_not_share_files()
test_checkpoint_meta_data_lists_added_attributes(tmp_path)
test_each_plotter_gets_own_bookkeeping_and_wants_to_plot_combines_them(tmp_path)
test_plotter_shorthand_replaces_all_plotters()