Peano
Loading...
Searching...
No Matches
InitialiseNewCells.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 .InitialCondition import InitialCondition
4
5import peano4.api
6
7
9 """!
10
11 Set the initial condition within cells which the mesh refinement creates
12
13 Same as InitialCondition, i.e. the action set invokes the solver's
14 exahype2.api.InitPointWisely term per volume, but it plugs into
15 createCell() instead of touchCellFirstTime(). It hence initialises
16 exactly those cells which a mesh sweep adds to the mesh, while existing
17 cells keep their data.
18
19 """
20
21 def __init__(self, solver, guard):
22 """!
23
24 @param solver: exahype2.api.Solver
25 Has to have an InitPointWisely PDE term registered.
26
27 @param guard: str
28 C++ boolean expression, evaluated per new cell.
29
30 """
31 super().__init__(solver, guard)
32
33 def get_body_of_operation(self, operation_name):
34 if operation_name == peano4.api.solversteps.ActionSet.OPERATION_CREATE_CELL:
35 return (
36 super()
38 peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME
39 )
40 .replace(
41 "touchCellFirstTime(...)---InitialCondition",
42 "createCell(...)---InitialiseNewCells",
43 )
44 )
45 return ""
46
47 def get_guard_of_operation(self, operation_name):
48 if operation_name == peano4.api.solversteps.ActionSet.OPERATION_CREATE_CELL:
49 return self.guard
50 return "true"
51
53 return __name__.replace(".py", "").replace(".", "_")
Fill a Finite Volume patch's initial condition, one volume at a time, by calling the solver's exahype...
Set the initial condition within cells which the mesh refinement creates.
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...
get_guard_of_operation(self, operation_name)
Return the guard of an operation.