9 Refine the mesh - solver-agnostic - down to a regular grid of a given
12 Unlike the dynamic mesh refinement action sets that evaluate a solver's
13 adaptivity criterion (@ref exahype2.api.AdaptivityCriterion, see
14 @ref exahype2.api.blockstructured.DynamicMeshRefinement), this action set
15 does not evaluate any solver data (there is none yet while the grid is
16 still being built): it only ever looks at a cell's size and decides to
17 refine or keep based on cell_size alone. That is what makes it
18 "generic" - solver-independent - and hence a candidate to sit in
19 peano4.api.actionsets rather than one of the discretisation- or
20 extension-specific actionsets packages (e.g. exahype2.api.fv.actionsets).
22 The resulting C++ file will be really simplistic, basically consisting of
23 only a few lines of code in the touchVertexFirstTime operation, the beginTraversal()
24 event and the routine that returns the grid control events.
31 descend_invocation_order=0,
38 @param cell_size: float
39 Upper bound on the edge length of the cells of the regular grid.
40 Peano refines every cell whose edge length is greater than or equal
41 to cell_size, i.e. the resulting cells are strictly smaller than
42 cell_size. Peano always refines the root cell at least once.
45 C++ boolean expression. The action set only returns its
46 refinement instruction for the next traversal if the expression
47 holds. Otherwise, it does not ask for any refinement, i.e. the
48 mesh construction pauses. The expression is evaluated in
49 createGridControlEventsForNextTraversal(). By default, the action
53 Include statements required by guard.
56 super().
__init__(descend_invocation_order, parallel)
66if ( not ({self.guard}) ) {{
67 return std::vector< peano4::grid::GridControlEvent >();
70const std::vector< peano4::grid::GridControlEvent > result = {{
71 peano4::grid::GridControlEvent(
72 peano4::grid::GridControlEvent::RefinementControl::Refine,
73 tarch::la::Vector<Dimensions,double>( -0.5 * std::numeric_limits<double>::max() ),
74 tarch::la::Vector<Dimensions,double>( std::numeric_limits<double>::max() ),
75 tarch::la::Vector<Dimensions,double>( {self.cell_size} )
87 return __name__.replace(
".py",
"").replace(
".",
"_")
Refine the mesh - solver-agnostic - down to a regular grid of a given resolution.
__init__(self, float cell_size, descend_invocation_order=0, parallel=True, str guard="true", str includes="")
get_body_of_createGridControlEventsForNextTraversal(self)
Return the grid control events that this action set wants to trigger.
get_action_set_name(self)
Return unique action set name.
user_should_modify_template(self)
Is the user allowed to modify the output.
get_includes(self)
Return include statements that you need.
Action set (reactions to events)
The Python-side model of "what happens during one mesh sweep".