Peano
Loading...
Searching...
No Matches
InitialCondition.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
3
4from .AbstractRungeKuttaDGActionSet import AbstractRungeKuttaDGActionSet
5
6import peano4
7import jinja2
8
10 TemplateInitialCondition = """
11 if ({{PREDICATE}}) {
12 logTraceIn( "touchCellFirstTime(...)---InitialCondition" );
13 int linearisedIndex = 0;
14 dfor( index, {{DG_ORDER}}+1 ) {
15 repositories::{{SOLVER_INSTANCE}}.initialCondition(
16 fineGridCell{{UNKNOWN_IDENTIFIER}}.value + linearisedIndex,
17 ::exahype2::dg::getQuadraturePoint(
18 marker.x(), marker.h(), index, repositories::{{SOLVER_INSTANCE}}.DGOrder, repositories::{{SOLVER_INSTANCE}}.QuadraturePoints1d
19 ),
20 marker.h(),
21 index,
22 {{GRID_IS_CONSTRUCTED}}
23 );
24 linearisedIndex += {{NUMBER_OF_UNKNOWNS}} + {{NUMBER_OF_AUXILIARY_VARIABLES}};
25 }
26
27 // relevant for tracing et al which kicks in if and only if cell has been
28 // updated
29 fineGridCell{{SOLVER_NAME}}CellLabel.setHasUpdated(true);
30
31 logTraceOut( "touchCellFirstTime(...)---InitialCondition" );
32 }
33"""
34
35 def __init__(self,solver,guard,grid_is_constructed):
36 super(InitialCondition,self).__init__(solver)
37 self.guard = guard
38 self.grid_is_constructed = grid_is_constructed
39
40
41 def get_body_of_operation(self,operation_name):
42 result = ""
43 if operation_name==peano4.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
44 d = {}
45 self._solver._init_dictionary_with_default_parameters(d)
46 self._solver.add_entries_to_text_replacement_dictionary(d)
47 d[ "PREDICATE" ] = self.guard
48 d[ "GRID_IS_CONSTRUCTED" ] = self.grid_is_constructed
49 result = jinja2.Template(self.TemplateInitialCondition).render(**d)
50 pass
51 return result
52
53
55 return __name__.replace(".py", "").replace(".", "_")
get_action_set_name(self)
You should replicate this function in each subclass, so you get meaningful action set names (otherwis...
__init__(self, solver, guard, grid_is_constructed)
solver: RungeKuttaDG Reference to creating class
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.