Peano
Loading...
Searching...
No Matches
test_refine_erase_pointwisely.py
Go to the documentation of this file.
1"""Unit tests for the point-wise refinement criterion
2(@ref exahype2.api.RefineErasePointwisely)."""
3
4import exahype2.api
5
6
8 assert exahype2.api.RefineErasePointwisely.SIGNATURE == (
9 "const double* __restrict__ Q, "
10 "const tarch::la::Vector<Dimensions, double>& x, "
11 "double t, "
12 "::exahype2::RefinementCommand* __restrict__ refinementCommand"
13 )
14
15
18 declaration = term.generator.generate_declaration()
19 assert declaration.startswith("virtual void refineErasePointwisely(")
20 assert (
21 "::exahype2::RefinementCommand* __restrict__ refinementCommand" in declaration
22 )
23 assert declaration.rstrip().endswith(") = 0;")
24
25
27 body = "if (Q[0] > 1.0) *refinementCommand = ::exahype2::RefinementCommand::Refine;"
28 term = exahype2.api.RefineErasePointwisely(implementation=body)
29 definition = term.generator.generate_out_of_class_definitions(
30 "probe::AbstractProbe"
31 )
32 assert definition.startswith("void probe::AbstractProbe::refineErasePointwisely(")
33 assert body in definition
34
35
38 assert "override" in term.generator.generate_stub_declaration()
39 stub = term.generator.generate_stub_definition("probe::Probe")
40 assert stub.startswith("void probe::Probe::refineErasePointwisely(")
41 assert "not implemented yet" in stub
42
43
45 solver = exahype2.api.Solver("Probe", 4, 0)
46 solver.add_pde_term(exahype2.api.RefineErasePointwisely(implementation=""))
47 assert any(
49 for term in solver.pde_terms
50 )
Point-wise refinement criterion: given the solution Q at a single degree of freedom,...
Abstract base class for all ExaHyPE 2 solvers.
Definition Solver.py:17