Peano
Loading...
Searching...
No Matches
UpdateCellShell.py
Go to the documentation of this file.
1# This file is part of the ExaHyPE2 project. For conditions of distribution and
2# use, please see the copyright notice at www.peano-framework.org
3from .AbstractFVActionSet import AbstractFVActionSet
4
5import peano4.api
6
7
9 """!
10
11 Update the shell of a Finite Volume patch
12
13 Counterpart of exahype2.api.fv.actionsets.UpdateCell which updates only
14 the shell of the patch (@see
15 exahype2.api.fv.RusanovWithOptimisticExplicitEuler). It reads the
16 halo-augmented reconstruction solver._patch_with_halo, invokes the
17 shell compute kernel, and writes the shell of solver._patch. The patch
18 interior of solver._patch remains unchanged. The kernel does not return any
19 eigenvalue, as exahype2.api.fv.actionsets.ComputeMaxEigenvalue determines
20 it for the whole patch afterwards.
21
22 """
23
24 def __init__(self, solver, guard):
25 """!
26
27 @param solver: exahype2.api.Solver
28 Has to have solver._patch, solver._patch_with_halo,
29 and solver.compute_kernel_call_on_shell
30 set - @see exahype2.api.fv.RusanovWithOptimisticExplicitEuler.
31
32 @param guard: str
33 C++ boolean expression, evaluated per cell in touchCellFirstTime,
34 guarding whether that cell's shell is updated.
35
36 """
37 AbstractFVActionSet.__init__(self, solver)
38 self.guard = guard
39
40 def get_body_of_operation(self, operation_name):
41 result = ""
42 if operation_name == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
43 result = f"""
44 double timeStamp = repositories::{self._solver.get_name_of_global_instance()}.getMinTimeStamp();
45 double timeStepSize = repositories::{self._solver.get_name_of_global_instance()}.getMinTimeStepSize();
46 ::exahype2::CellData patchData(fineGridCell{self._solver._patch_with_halo.name}.value, marker.x(), marker.h(), timeStamp, timeStepSize, fineGridCell{self._solver._patch.name}.value);
47 {self._solver.compute_kernel_call_on_shell}
48"""
49 return result
50
51 def get_guard_of_operation(self, operation_name):
52 if operation_name == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
53 return self.guard
54 return "true"
55
57 return __name__.replace(".py", "").replace(".", "_")
Update the shell of a Finite Volume patch.
get_action_set_name(self)
You should replicate this function in each subclass, so you get meaningful action set names (otherwis...
get_guard_of_operation(self, operation_name)
Return the guard of an operation.
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.