3from .AbstractFVActionSet
import AbstractFVActionSet
4from .DiscardPatchInterior
import wait_for_patch_interior_update, WAIT_INCLUDES
12 Insert the patch interior into the patch
14 Copies solver._patch_interior, i.e. the result of
15 exahype2.api.fv.actionsets.UpdateCellInterior, into the patch interior
16 of solver._patch. Afterwards, the first entry of solver._max_eigenvalue_and_time_step_sizes
17 holds the maximum of its first entry (the maximum eigenvalue of the
18 shell) and its third entry (the maximum eigenvalue of the patch
19 interior), i.e. the maximum eigenvalue of the whole patch (@see
20 exahype2.api.fv.RusanovWithOptimisticExplicitEuler).
22 If the patch interior is updated by a task (@see
23 exahype2.api.fv.actionsets.SpawnTaskToUpdateCellInterior), the action
24 set first waits for this task.
28 def __init__(self, solver, patch_size, overlap, guard, task_number=None):
31 @param solver: exahype2.api.Solver
32 Has to have solver._patch, solver._patch_interior and
33 solver._max_eigenvalue_and_time_step_sizes set - @see
34 exahype2.api.fv.RusanovWithOptimisticExplicitEuler.
36 @param patch_size: int
37 Number of Finite Volumes per axis within one patch.
40 Thickness of the shell, i.e. the patch interior has
41 patch_size-2*overlap Finite Volumes per axis.
44 C++ boolean expression, evaluated per cell in touchCellFirstTime,
45 guarding whether that cell's patch interior is inserted.
47 @param task_number: peano4.api.datamodel.DaStGen2
48 Cell data holding the number of the task updating the patch
49 interior. If given, the action set waits for this task before it
50 copies the patch interior. None if the patch interior is not
54 AbstractFVActionSet.__init__(self, solver)
62 if operation_name == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
63 unknowns = self.
_solver.unknowns + self.
_solver.auxiliary_variables
65 max_eigenvalue = f
"fineGridCell{self._solver._max_eigenvalue_and_time_step_sizes.name}"
69 dfor(interiorVolume,{interior_size}) {{
70 tarch::la::Vector<Dimensions,int> patchVolume = interiorVolume + tarch::la::Vector<Dimensions,int>({self.overlap});
71 int interiorVolumeSerialised = peano4::utils::dLinearised(interiorVolume,{interior_size});
72 int patchVolumeSerialised = peano4::utils::dLinearised(patchVolume,{self.patch_size});
73 for (int j=0; j<{unknowns}; j++) {{
74 fineGridCell{self._solver._patch.name}.value[patchVolumeSerialised*{unknowns}+j] = fineGridCell{self._solver._patch_interior.name}.value[interiorVolumeSerialised*{unknowns}+j];
78 {max_eigenvalue}.setMaxEigenvalue( 0, std::max( {max_eigenvalue}.getMaxEigenvalue(0), {max_eigenvalue}.getMaxEigenvalue(2) ) );
83 if operation_name == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
89#include "peano4/utils/Loop.h"
92 result += WAIT_INCLUDES
96 return __name__.replace(
".py",
"").replace(
".",
"_")
Insert the patch interior into the patch.
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.
get_action_set_name(self)
You should replicate this function in each subclass, so you get meaningful action set names (otherwis...
__init__(self, solver, patch_size, overlap, guard, task_number=None)
get_guard_of_operation(self, operation_name)
Return the guard of an operation.
get_includes(self)
Return include statements that you need.