Peano
Loading...
Searching...
No Matches
kernels.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
4
def
create_halo_layer_construction_with_interpolation_for_reconstructed_patch(solver):
5
"""
6
This is a straightforward modification of ReconstructPatchAndApplyFunctor._Template_TouchCellFirstTime_Fill_Halos
7
in the blockstructured toolkit.
8
"""
9
return
"""
10
//
11
// Bring in the auxiliary patches, i.e., befill halo.
12
//
13
for(int d=0; d<Dimensions; d++) {{
14
logTraceInWith1Argument( "touchCellFirstTime(...)::loopOverFace", d );
15
//
16
// d-loop over all dimensions except d. The vector k's entry d is set
17
// to 0. We start with the left/bottom face, i.e. the one closer to the
18
// coordinate system's origin.
19
//
20
dfore(k,{DOFS_PER_AXIS},d,0) {{
21
std::pair<double,double> oldNewWeightsLeft = ::exahype2::getInterpolationWeights(
22
fineGridFaces"""
+ solver +
"""FaceLabel(d).getOldTimeStamp(0),
23
fineGridFaces"""
+ solver +
"""FaceLabel(d).getNewTimeStamp(0),
24
fineGridCell"""
+ solver +
"""CellLabel.getTimeStamp()
25
);
26
std::pair<double,double> oldNewWeightsRight = ::exahype2::getInterpolationWeights(
27
fineGridFaces"""
+ solver +
"""FaceLabel(d+Dimensions).getOldTimeStamp(1),
28
fineGridFaces"""
+ solver +
"""FaceLabel(d+Dimensions).getNewTimeStamp(1),
29
fineGridCell"""
+ solver +
"""CellLabel.getTimeStamp()
30
);
31
32
for (int i=0; i<{OVERLAP}; i++) {{
33
tarch::la::Vector<Dimensions,int> destinationCell = k + tarch::la::Vector<Dimensions,int>({OVERLAP});
34
tarch::la::Vector<Dimensions,int> sourceCell = k;
35
destinationCell(d) = i;
36
sourceCell(d) = i;
37
38
int destinationCellSerialised = peano4::utils::dLinearised(destinationCell,{DOFS_PER_AXIS} + 2*{OVERLAP});
39
int sourceCellSerialised = serialisePatchIndex(sourceCell,d);
40
41
for (int unknown=0; unknown<{NUMBER_OF_UNKNOWNS}; unknown++) {{
42
oldQWithHalo[destinationCellSerialised*{NUMBER_OF_UNKNOWNS}+unknown]
43
= oldNewWeightsLeft.first * fineGridFaces"""
+ solver +
"""QOld(d).value[ sourceCellSerialised*{NUMBER_OF_UNKNOWNS}+unknown ]
44
+ oldNewWeightsLeft.second * fineGridFaces"""
+ solver +
"""QNew(d).value[ sourceCellSerialised*{NUMBER_OF_UNKNOWNS}+unknown ];
45
{ASSERTION_WITH_7_ARGUMENTS}(
46
{ASSERTION_PREFIX_FOR_HALO} or
47
oldQWithHalo[ destinationCellSerialised*{NUMBER_OF_UNKNOWNS}+unknown ]==oldQWithHalo[ destinationCellSerialised*{NUMBER_OF_UNKNOWNS}+unknown ],
48
sourceCell, destinationCell, unknown, d, marker.toString(), _treeNumber, marker.toString()
49
);
50
}}
51
52
destinationCell(d) = i+{DOFS_PER_AXIS}+{OVERLAP};
53
sourceCell(d) = i+{OVERLAP};
54
55
destinationCellSerialised = peano4::utils::dLinearised(destinationCell,{DOFS_PER_AXIS} + 2*{OVERLAP});
56
sourceCellSerialised = serialisePatchIndex(sourceCell,d);
57
for (int unknown=0; unknown<{NUMBER_OF_UNKNOWNS}; unknown++) {{
58
oldQWithHalo[destinationCellSerialised*{NUMBER_OF_UNKNOWNS}+unknown]
59
= oldNewWeightsLeft.first * fineGridFaces"""
+ solver +
"""QOld(d+Dimensions).value[ sourceCellSerialised*{NUMBER_OF_UNKNOWNS}+unknown ]
60
+ oldNewWeightsLeft.second * fineGridFaces"""
+ solver +
"""QNew(d+Dimensions).value[ sourceCellSerialised*{NUMBER_OF_UNKNOWNS}+unknown ];
61
{ASSERTION_WITH_7_ARGUMENTS}(
62
{ASSERTION_PREFIX_FOR_HALO} or
63
oldQWithHalo[ destinationCellSerialised*{NUMBER_OF_UNKNOWNS}+unknown ]==oldQWithHalo[ destinationCellSerialised*{NUMBER_OF_UNKNOWNS}+unknown ],
64
sourceCell, destinationCell, unknown, d, marker.toString(), _treeNumber, marker.toString()
65
);
66
}}
67
}}
68
}}
69
logTraceOut("touchCellFirstTime(...)::loopOverFace");
70
}}
71
"""
python
exahype2
solvers
fv
kernels.py
Generated on Tue Nov 3 2026 16:05:41 for Peano by
1.9.8