3from .AbstractFVActionSet
import AbstractFVActionSet
8def wait_for_patch_interior_update(solver, task_number) -> str:
11 C++ code which waits for the task updating the patch interior
13 The code waits only if the cell holds a task number, and never in the
14 very first time step, where the task number has not been set yet (@see
15 exahype2.api.fv.actionsets.SpawnTaskToUpdateCellInterior). Afterwards,
16 it releases the task number.
18 @param solver: exahype2.api.Solver
19 The solver the patch interior belongs to.
21 @param task_number: peano4.api.datamodel.DaStGen2
22 Cell data holding the task number.
25 data = f
"fineGridCell{task_number.name}"
28 not tarch::la::equals(repositories::{solver.get_name_of_global_instance()}.getAdmissibleTimeStepSize(), 0.0)
30 {data}.getTaskNumber()>=0
32 tarch::multicore::waitForTask( {data}.getTaskNumber() );
33 {data}.getTaskEnumerator().releaseNumber( {data}.getTaskNumber() );
34 {data}.setTaskNumber( tarch::multicore::TaskEnumerator::NoNumber );
40#include "tarch/la/ScalarOperations.h"
41#include "tarch/multicore/multicore.h"
42#include "tarch/multicore/TaskEnumerator.h"
49 Discard the patch interior
51 Counterpart of exahype2.api.fv.actionsets.InsertPatchInterior
52 (@see exahype2.api.fv.RusanovWithOptimisticExplicitEuler).
54 If the patch interior is updated by a task (@see
55 exahype2.api.fv.actionsets.SpawnTaskToUpdateCellInterior), the action
56 set waits for this task, as it would otherwise still write into the
57 patch interior while the next task is spawned. It does nothing with the
58 task's outcome afterwards. If the patch interior is not updated by a
59 task, the action set does nothing at all.
63 def __init__(self, solver, guard, task_number=None):
66 @param solver: exahype2.api.Solver
67 The solver the patch interior belongs to.
70 C++ boolean expression, evaluated per cell in touchCellFirstTime,
71 guarding whether that cell's patch interior is discarded.
73 @param task_number: peano4.api.datamodel.DaStGen2
74 Cell data holding the number of the task updating the patch
75 interior, or None if the patch interior is not updated by a task.
78 AbstractFVActionSet.__init__(self, solver)
85 and operation_name == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME
93 result += WAIT_INCLUDES
97 if operation_name == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
102 return __name__.replace(
".py",
"").replace(
".",
"_")
Discard the patch interior.
__init__(self, solver, guard, task_number=None)
get_guard_of_operation(self, operation_name)
Return the guard of an operation.
get_action_set_name(self)
You should replicate this function in each subclass, so you get meaningful action set names (otherwis...
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.
get_includes(self)
Return include statements that you need.