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 maximum eigenvalue of
19 the shell goes into the first entry of solver._max_eigenvalue_and_time_step_sizes.
20
21 """
22
23 def __init__(self, solver, guard):
24 """!
25
26 @param solver: exahype2.api.Solver
27 Has to have solver._patch, solver._patch_with_halo,
28 solver._max_eigenvalue_and_time_step_sizes and solver.compute_kernel_call_on_shell
29 set - @see exahype2.api.fv.RusanovWithOptimisticExplicitEuler.
30
31 @param guard: str
32 C++ boolean expression, evaluated per cell in touchCellFirstTime,
33 guarding whether that cell's shell is updated.
34
35 """
36 AbstractFVActionSet.__init__(self, solver)
37 self.guard = guard
38
39 def get_body_of_operation(self, operation_name):
40 result = ""
41 if operation_name == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
42 result = f"""
43 double timeStamp = repositories::{self._solver.get_name_of_global_instance()}.getMinTimeStamp();
44 double timeStepSize = repositories::{self._solver.get_name_of_global_instance()}.getMinTimeStepSize();
45 ::exahype2::CellData patchData(fineGridCell{self._solver._patch_with_halo.name}.value, marker.x(), marker.h(), timeStamp, timeStepSize, fineGridCell{self._solver._patch.name}.value);
46 {self._solver.compute_kernel_call_on_shell}
47
48 fineGridCell{self._solver._max_eigenvalue_and_time_step_sizes.name}.setMaxEigenvalue( 0, patchData.maxEigenvalue[0] );
49"""
50 return result
51
52 def get_guard_of_operation(self, operation_name):
53 if operation_name == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
54 return self.guard
55 return "true"
56
58 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.