15 templateTouchFaceFirstTime=
"""
17 fineGridFace{{SOLVER_NAME}}.getType() == facedata::{{SOLVER_NAME}}::Type::Interior
19 repositories::{{SOLVER_INSTANCE}}.updateFace()
21 logTraceInWith2Arguments( "updateFaceSolution::Interior", fineGridFace{{SOLVER_NAME}}.getSolution(), marker.toString() );
23 // project the left/right projection into a temporary vector
24 tarch::la::Vector< 2*repositories::{{SOLVER_INSTANCE}}.FaceUnknownsSolution, double > projections;
25 // alias for number of solutions
26 const int nSols = repositories::{{SOLVER_INSTANCE}}.FaceUnknownsSolution;
27 for (int i=0; i<repositories::{{SOLVER_INSTANCE}}.FaceUnknownsSolution; i++) {
28 projections[i] = fineGridFace{{SOLVER_NAME}}.getLProjection(i);
29 projections[i+nSols] = fineGridFace{{SOLVER_NAME}}.getRProjection(i);
30 assertion3(projections[i]<1e10, fineGridFace{{SOLVER_NAME}}.getLProjection(), fineGridFace{{SOLVER_NAME}}.getRProjection(), marker.toString());
31 assertion3(projections[i+nSols]<1e10, fineGridFace{{SOLVER_NAME}}.getLProjection(), fineGridFace{{SOLVER_NAME}}.getRProjection(), marker.toString());
34 // multiply by Riemann matrix
35 auto faceSolutionUpdate = repositories::{{SOLVER_INSTANCE}}.applyRiemannMatrix( projections );
37 for (int i=0; i<repositories::{{SOLVER_INSTANCE}}.FaceUnknownsSolution; i++)
38 fineGridFace{{SOLVER_NAME}}.setSolution(
40 (1-repositories::{{SOLVER_INSTANCE}}.OmegaFace)*fineGridFace{{SOLVER_NAME}}.getSolution(i)
41 + repositories::{{SOLVER_INSTANCE}}.OmegaFace * faceSolutionUpdate(i)
44 fineGridFace{{SOLVER_NAME}}.setLProjection( 0.0 );
45 fineGridFace{{SOLVER_NAME}}.setRProjection( 0.0 );
46 logTraceOutWith1Argument( "updateFaceSolution::Interior", fineGridFace{{SOLVER_NAME}}.getSolution() );
50 fineGridFace{{SOLVER_NAME}}.getType() == facedata::{{SOLVER_NAME}}::Type::Boundary
52 repositories::{{SOLVER_INSTANCE}}.updateFace()
54 logTraceInWith2Arguments( "updateFaceSolution::InteriorPenalty", fineGridFace{{SOLVER_NAME}}.getLProjection(), fineGridFace{{SOLVER_NAME}}.getRProjection() );
55 // Essentially what we do here is fix the solution on the boundary to be
56 // the inner-side projection.
58 // skip halfway along the projection vector if we are on face 0 or 1
59 int startIndexProjection =
60 marker.getSelectedFaceNumber() < Dimensions ?
61 repositories::{{SOLVER_INSTANCE}}.NodesPerFace * repositories::{{SOLVER_INSTANCE}}.ProjectionsPerFaceNode :
64 if ( marker.getSelectedFaceNumber() < Dimensions )
65 fineGridFace{{SOLVER_NAME}}.setSolution(
66 repositories::{{SOLVER_INSTANCE}}.applyBoundaryConditionMatrix(
67 fineGridFace{{SOLVER_NAME}}.getRProjection()
72 fineGridFace{{SOLVER_NAME}}.setSolution(
73 repositories::{{SOLVER_INSTANCE}}.applyBoundaryConditionMatrix(
74 fineGridFace{{SOLVER_NAME}}.getLProjection()
78 logTraceOut( "updateFaceSolution::InteriorPenalty");
87 descend_invocation_order=0,
89 super( UpdateFaceSolution, self ).
__init__(
90 descend_invocation_order,
94 self.
d[
"SOLVER_INSTANCE"] = solver.instance_name()
95 self.
d[
"SOLVER_NAME"] = solver.typename()
99 if operation_name==peano4.solversteps.ActionSet.OPERATION_TOUCH_FACE_FIRST_TIME:
107 Configure name of generated C++ action set
109 This action set will end up in the directory observers with a name that
110 reflects how the observer (initialisation) is mapped onto this action
111 set. The name pattern is ObserverName2ActionSetIdentifier where this
112 routine co-determines the ActionSetIdentifier. We make is reflect the
116 return __name__.replace(
".py",
"").replace(
".",
"_") +
"_UpdateFaceSolution"
121 The action set that Peano will generate that corresponds to this class
122 should not be modified by users and can safely be overwritten every time
123 we run the Python toolkit.
131 We need the solver repository in this action set, as we directly access
132 the solver object. We also need access to Peano's d-dimensional loops.
136#include "../repositories/SolverRepository.h"
137#include "peano4/utils/Loop.h"
Action set (reactions to events)
user_should_modify_template(self)
The action set that Peano will generate that corresponds to this class should not be modified by user...
str templateTouchFaceFirstTime
get_includes(self)
We need the solver repository in this action set, as we directly access the solver object.
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.
__init__(self, solver, descend_invocation_order=0, parallel=True)
get_action_set_name(self)
Configure name of generated C++ action set.