Peano
Loading...
Searching...
No Matches
RollOverUpdatedFace.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 peano4.api.solversteps.ActionSet import ActionSet
4
5import peano4.api
6import jinja2
7
8
10 """!
11
12 Copy patch_overlap_update - the face overlap
13 exahype2.api.rkfd4.actionsets.ProjectPatchOntoFaces has just written the
14 latest projection into - onto patch_overlap_current_time_step, the
15 persistent face data toolbox.blockstructured.api.ReconstructPatchWithHalo
16 reads from to rebuild a patch's halo. Both halves of the face overlap
17 (left and right, relative to the face's normal) are copied in full,
18 unconditionally subject only to guard.
19
20 The class is a copy of exahype2.api.fv.actionsets.RollOverUpdatedFace,
21 as rkfd4 does not depend on the Finite Volume package. On the C++ side,
22 it still uses exahype2::fv::copyHalfOfHalo(), as the copy does not
23 depend on the discretisation and there is no Finite Differences
24 counterpart.
25
26 """
27
28 TemplateHandleFace = jinja2.Template(
29 """
30 const int normal = marker.getSelectedFaceNumber() % Dimensions;
31
32 logTraceInWith2Arguments( "touchFaceLastTime(...)---RollOverUpdatedFace", marker.toString(), normal );
33
34 ::exahype2::fv::copyHalfOfHalo(
35 {{UNKNOWNS}},
36 {{DOFS_PER_AXIS}},
37 {{OVERLAP}},
38 normal,
39 false, // left half
40 {{UPDATE_ACCESSOR}}.value,
41 {{CURRENT_TIME_STEP_ACCESSOR}}.value
42 );
43 ::exahype2::fv::copyHalfOfHalo(
44 {{UNKNOWNS}},
45 {{DOFS_PER_AXIS}},
46 {{OVERLAP}},
47 normal,
48 true, // right half
49 {{UPDATE_ACCESSOR}}.value,
50 {{CURRENT_TIME_STEP_ACCESSOR}}.value
51 );
52
53 logTraceOut( "touchFaceLastTime(...)---RollOverUpdatedFace" );
54"""
55 )
56
58 self, patch_overlap_current_time_step, patch_overlap_update, guard, includes
59 ):
60 """!
61
62 @param patch_overlap_current_time_step: peano4.api.datamodel.Patch
63 The persistent face overlap to roll patch_overlap_update into,
64 i.e. solver._patch_overlap_current_time_step.
65
66 @param patch_overlap_update: peano4.api.datamodel.Patch
67 The face overlap exahype2.api.rkfd4.actionsets.ProjectPatchOntoFaces
68 has just written the latest projection into, i.e.
69 solver._patch_overlap_update. Its dim[1] is assumed to equal the
70 cell patch's grid cells per axis, i.e. patch_overlap_update and
71 patch_overlap_current_time_step have to be face-associated
72 overlaps of a cell patch in the sense of
73 exahype2.api.rkfd4.actionsets.ProjectPatchOntoFaces.
74
75 @param guard: str
76 C++ boolean expression, evaluated per face in touchFaceLastTime,
77 guarding whether that face's overlap is rolled over.
78
79 @param includes: str
80 Additional includes this action set's generated code needs -
81 callers typically pass solver._get_default_includes() +
82 solver.user_solver_includes.
83
84 """
85 super().__init__(descend_invocation_order=1, parallel=False)
86 self.additional_includes = includes
87 self.d = {}
88 self.d["GUARD"] = guard
89 self.d["UNKNOWNS"] = str(patch_overlap_update.no_of_unknowns)
90 self.d["DOFS_PER_AXIS"] = str(patch_overlap_update.dim[1])
91 self.d["OVERLAP"] = str(int(patch_overlap_update.dim[0] / 2))
92 self.d["UPDATE_ACCESSOR"] = "fineGridFace" + patch_overlap_update.name
93 self.d["CURRENT_TIME_STEP_ACCESSOR"] = (
94 "fineGridFace" + patch_overlap_current_time_step.name
95 )
96
97 def get_body_of_operation(self, operation_name):
98 result = ""
99 if (
100 operation_name
101 == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_FACE_LAST_TIME
102 ):
103 result = self.TemplateHandleFace.render(**self.d)
104 return result
105
106 def get_guard_of_operation(self, operation_name):
107 if (
108 operation_name
109 == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_FACE_LAST_TIME
110 ):
111 return self.d["GUARD"]
112 return "true"
113
115 return __name__.replace(".py", "").replace(".", "_")
116
118 return False
119
120 def get_includes(self):
121 return (
122 """
123#include <functional>
124#include "exahype2/fv/PatchUtils.h"
125"""
127 )
Copy patch_overlap_update - the face overlap exahype2.api.rkfd4.actionsets.ProjectPatchOntoFaces has ...
user_should_modify_template(self)
Is the user allowed to modify the output.
__init__(self, patch_overlap_current_time_step, patch_overlap_update, guard, includes)
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.
get_guard_of_operation(self, operation_name)
Return the guard of an operation.
Action set (reactions to events)
Definition ActionSet.py:6