Peano 4
Loading...
Searching...
No Matches
SpreadLimiterStatus.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 .AbstractLimiterActionSet import AbstractLimiterActionSet
5
6import peano4.solversteps
7import jinja2
9 TemplateSpreadLimiterStatus = """
10
11 if ( {{PREDICATE}} ) {
12
13 if(fineGridCell{{SOLVER_NAME}}CellLabel.getTroubled_Marker()==celldata::{{SOLVER_NAME}}CellLabel::Troubled_Marker::TROUBLED) return;
14
15 bool hasTroubledNeighbour = false;
16 for(int d=0; d<2*Dimensions; d++){
17 hasTroubledNeighbour |= fineGridFaces{{SOLVER_NAME}}FaceLabel(d).getTroubled_Marker()==facedata::{{SOLVER_NAME}}FaceLabel::Troubled_Marker::TROUBLED;
18 }
19
20 if(hasTroubledNeighbour){
21 fineGridCell{{SOLVER_NAME}}CellLabel.setTroubled_Marker(celldata::{{SOLVER_NAME}}CellLabel::Troubled_Marker::LIMITER_TO_REGULAR);
22 for(int d=0; d<2*Dimensions; d++){
23 fineGridFaces{{SOLVER_NAME}}FaceLabel(d).setTroubled_Marker(
24 std::max(fineGridFaces{{SOLVER_NAME}}FaceLabel(d).getTroubled_Marker(),
25 facedata::{{SOLVER_NAME}}FaceLabel::Troubled_Marker::LIMITER_TO_REGULAR
26 )
27 );
28 }
29 }
30
31 }
32
33"""
34
35 def __init__(self,solver,guard):
36 super(SpreadLimiterStatus,self).__init__(solver)
37 self.guard = guard
38
39 def get_body_of_operation(self,operation_name):
40 result = ""
41 if operation_name==peano4.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
42 d = {}
43 self._solver._init_dictionary_with_default_parameters(d)
44 self._solver.add_entries_to_text_replacement_dictionary(d)
45 d[ "PREDICATE" ] = self.guard
46 result = jinja2.Template(self.TemplateSpreadLimiterStatus).render(**d)
47 pass
48 return result
49
50
52 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)
solver: Ader-DG Reference to creating class
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.