Peano
Loading...
Searching...
No Matches
test_gradient_refinement.py
Go to the documentation of this file.
1"""Unit tests for the gradient-based refinement criterion
2(@ref exahype2.api.GradientRefinement)."""
3
4import exahype2.api
5
6
15 assert exahype2.api.GradientRefinement.SIGNATURE == (
16 "const double* __restrict__ gradient, "
17 "int normal, "
18 "::exahype2::RefinementCommand* __restrict__ refinementCommand"
19 )
20
21
23 declaration = exahype2.api.GradientRefinement().generator.generate_declaration()
24 assert declaration.startswith("virtual void refineEraseWithGradient(")
25 assert declaration.rstrip().endswith(") = 0;")
26
27
29 body = "if (gradient[0] > 1.0) *refinementCommand = ::exahype2::RefinementCommand::Refine;"
30 term = exahype2.api.GradientRefinement(implementation=body)
31 definition = term.generator.generate_out_of_class_definitions(
32 "probe::AbstractProbe"
33 )
34 assert definition.startswith("void probe::AbstractProbe::refineEraseWithGradient(")
35 assert body in definition
36
37
39 stub = exahype2.api.GradientRefinement().generator.generate_stub_definition(
40 "probe::Probe"
41 )
42 assert stub.startswith("void probe::Probe::refineEraseWithGradient(")
43 assert 'logTraceInWith1Argument("refineEraseWithGradient(...)", normal);' in stub
44 assert "not implemented yet" in stub
Base class of all the PDE terms which decide where to refine or coarsen the mesh.
Gradient-based refinement criterion: given a one-sided difference quotient of the solution along one ...
Point-wise refinement criterion: given the solution Q at a single degree of freedom,...