12 @todo There's documentation missing
16 templateTouchCellFirstTime=
"""
18 all we need to do here is project updated solution u^c onto the faces
22 fineGridCell{{SOLVER_NAME}}.getType() != celldata::{{SOLVER_NAME}}::Type::Coarse
24 repositories::{{SOLVER_INSTANCE}}.projectOntoFaces()
26 // apply cell to face projection, store it in faceProjections
27 // no tricky indexing needed here, since the whole of the cell
28 // solution vector is in scope here.
29 tarch::la::Vector< repositories::{{SOLVER_INSTANCE}}.FaceUnknownsProjection * TwoTimesD, double > faceProjections =
30 repositories::{{SOLVER_INSTANCE}}. getFaceFromCellMatrix(marker.x(), marker.h()) * fineGridCell{{SOLVER_NAME}}.getSolution();
32 logTraceInWith3Arguments("ProjectOntoFace", marker.toString(), faceProjections, fineGridCell{{SOLVER_NAME}}.getSolution());
34 // write these values into the faces themselves
35 for (int f=0; f<TwoTimesD; f++)
37 logTraceInWith2Arguments("ProjectOntoFaces::FaceLoop", f, fineGridFaces{{SOLVER_NAME}}(f).getProjection())
39 This loop is crucial - we have a lot of redundant zeros and we don't wanna overwrite eg negative
40 projections when we are dealing with face 0. So, some tricky indexing needed
42 // skip halfway along the projection vector if we are on face 0 or 1
43 int startIndexProjection =
45 repositories::{{SOLVER_INSTANCE}}.NodesPerFace * repositories::{{SOLVER_INSTANCE}}.ProjectionsPerFaceNode :
48 // previously, this loop would go up to total number of projections.
49 // but we only want half this number, since we skip the projections
50 // that should be written to by the other face
51 for (int p=0; p<repositories::{{SOLVER_INSTANCE}}.NodesPerFace * repositories::{{SOLVER_INSTANCE}}.ProjectionsPerFaceNode; p++)
53 fineGridFaces{{SOLVER_NAME}}(f).setProjection(
54 p + startIndexProjection,
55 faceProjections( f*repositories::{{SOLVER_INSTANCE}}.FaceUnknownsProjection + p + startIndexProjection )
58 logTraceOutWith2Arguments("ProjectOntoFaces::FaceLoop", f, fineGridFaces{{SOLVER_NAME}}(f).getProjection())
62 logTraceOut("ProjectOntoFace");
69 descend_invocation_order=0,
71 super( ProjectOntoFaces, self ).
__init__(
72 descend_invocation_order,
76 self.
d[
"SOLVER_INSTANCE"] = solver.instance_name()
77 self.
d[
"SOLVER_NAME"] = solver.typename()
81 if operation_name==peano4.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
89 Configure name of generated C++ action set
91 This action set will end up in the directory observers with a name that
92 reflects how the observer (initialisation) is mapped onto this action
93 set. The name pattern is ObserverName2ActionSetIdentifier where this
94 routine co-determines the ActionSetIdentifier. We make is reflect the
98 return __name__.replace(
".py",
"").replace(
".",
"_") +
"_ProjectOntoFaces"
103 The action set that Peano will generate that corresponds to this class
104 should not be modified by users and can safely be overwritten every time
105 we run the Python toolkit.
113 We need the solver repository in this action set, as we directly access
114 the solver object. We also need access to Peano's d-dimensional loops.
118#include "../repositories/SolverRepository.h"
119#include "peano4/utils/Loop.h"
str templateTouchCellFirstTime
get_action_set_name(self)
Configure name of generated C++ action set.
get_includes(self)
We need the solver repository in this action set, as we directly access the solver object.
user_should_modify_template(self)
The action set that Peano will generate that corresponds to this class should not be modified by user...
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)
Action set (reactions to events)