10def create_dynamic_mesh_refinement_action_set(
14 min_volume_size: float =
None,
15 max_volume_size: float =
None,
16 hand_events_to_peano: bool =
False,
17 veto_erase: bool =
False,
21 Create the action set which evaluates the solver's adaptivity criterion
23 The numerical schemes and the setup do not evaluate any criterion if the
24 solver has none, i.e. they then add no action set at all. Otherwise, the
25 criterion's type determines the action set:
27 - exahype2.api.RefineErasePointwisely yields an
28 exahype2.api.blockstructured.DynamicMeshRefinement;
29 - exahype2.api.GradientRefinement yields an
30 exahype2.api.blockstructured.DynamicMeshRefinementWithGradients.
32 @param solver: exahype2.api.Solver
33 The solver whose criterion is evaluated. It may have at most one
34 adaptivity criterion (@ref exahype2.api.AdaptivityCriterion).
36 @param patch_size: int
37 Number of volumes per axis within one patch.
40 C++ boolean expression, evaluated per cell, guarding whether the
41 criterion is evaluated for that cell.
43 @param min_volume_size: float
44 See exahype2.api.blockstructured.DynamicMeshRefinement.
46 @param max_volume_size: float
47 See exahype2.api.blockstructured.DynamicMeshRefinement.
49 @param hand_events_to_peano: bool
50 See exahype2.api.blockstructured.DynamicMeshRefinement.
52 @param veto_erase: bool
53 See exahype2.api.blockstructured.DynamicMeshRefinement.
55 @return The action set, or None if the solver has no adaptivity
59 criterion = get_adaptivity_criterion(solver)
62 if isinstance(criterion, RefineErasePointwisely):
63 action_set_type = DynamicMeshRefinement
64 elif isinstance(criterion, GradientRefinement):
65 action_set_type = DynamicMeshRefinementWithGradients
68 f
"No action set evaluates adaptivity criteria of type {type(criterion).__name__}"
70 return action_set_type(
74 min_volume_size=min_volume_size,
75 max_volume_size=max_volume_size,
76 hand_events_to_peano=hand_events_to_peano,
77 veto_erase=veto_erase,