12Initialise degrees of freedom associated with the cells and Faces.
14Much the same as the old code to init DoFs on vertices, except here
15we also make the call to the localtoglobalmap. ie we both init the
16degrees of freedom and the global mapping for indices on faces and cells
21 @todo This is a left-over. Not yet maintained
24 // lambda to determine the pair of vertices that determine
25 // whether face i is on the boundary or not
26 // eg if vertices 0 and 1 are both dirichlet, then face 1 must
28 auto getCrucialIndices = [](int i) -> const std::pair<int,int>{
29 static constexpr std::pair<int,int> v0 = {0,2};
30 static constexpr std::pair<int,int> v1 = {0,1};
31 static constexpr std::pair<int,int> v2 = {1,3};
32 static constexpr std::pair<int,int> v3 = {2,3};
34 else if (i==1) return v1;
35 else if (i==2) return v2;
36 else if (i==3) return v3;
37 else throw std::runtime_error("invalid index passed!");
40 if (!marker.willBeRefined()){
41 logTraceIn( "touchFaceFirstTime(...)---InitialCondition" );
43 int faceNumber = marker.getSelectedFaceNumber();
44 std::pair<int,int> crucialIndices = getCrucialIndices(faceNumber);
46 fineGridVertices{{SOLVER_NAME}}(crucialIndices.first).getType() == vertexdata::{{SOLVER_NAME}}::Type::Dirichlet
48 fineGridVertices{{SOLVER_NAME}}(crucialIndices.second).getType() == vertexdata::{{SOLVER_NAME}}::Type::Dirichlet
50 fineGridFace{{SOLVER_NAME}}.setType(facedata::{{SOLVER_NAME}}::Type::Boundary);
53 fineGridFace{{SOLVER_NAME}}.setType(facedata::{{SOLVER_NAME}}::Type::Interior);
56 //init vectors for value and rhs. modify them in initFace()
57 tarch::la::Vector<{{FACE_CARDINALITY}}, double> value;
58 tarch::la::Vector<{{FACE_CARDINALITY}}, double> rhs;
60 repositories::{{SOLVER_INSTANCE}}.initFace(
67 //place these values into the mesh
68 fineGridFace{{SOLVER_NAME}}.setValue( value );
69 fineGridFace{{SOLVER_NAME}}.setRhs( rhs );
71 logTraceOut( "touchFaceFirstTime(...)---InitialCondition" );
81Initialise vertex-associated degrees of freedom
83The initialisation requires a solver object, as we have to know what C++
84object this solver will produce.
86solver: petsc.solvers.CollocatedLowOrderDiscretisation or similar solver where
87 degrees of freedom are assigned exclusively to the vertices.
90 super( InitFaceAndCellDoFs, self ).
__init__()
92 self.
d[
"SOLVER_INSTANCE"] = solver.instance_name()
93 self.
d[
"SOLVER_NAME"] = solver.typename()
105 if operation_name==peano4.solversteps.ActionSet.OPERATION_TOUCH_FACE_FIRST_TIME:
109 if operation_name==peano4.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
110 result = jinja2.Template(self.TemplateInitCell).render(**self.
d)
119 Configure name of generated C++ action set
121 This action set will end up in the directory observers with a name that
122 reflects how the observer (initialisation) is mapped onto this action
123 set. The name pattern is ObserverName2ActionSetIdentifier where this
124 routine co-determines the ActionSetIdentifier. We make is reflect the
128 return __name__.replace(
".py",
"").replace(
".",
"_")
134 The action set that Peano will generate that corresponds to this class
135 should not be modified by users and can safely be overwritten every time
136 we run the Python toolkit.
154Consult petsc.Project for details
158#include "../repositories/SolverRepository.h"
Initialise degrees of freedom associated with the cells and Faces.
get_includes(self)
Consult petsc.Project for details.
get_action_set_name(self)
Configure name of generated C++ action set.
__init__(self, solver)
Initialise vertex-associated degrees of freedom.
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.
get_constructor_body(self)
Define a tailored constructor body.
get_attributes(self)
Return attributes as copied and pasted into the generated class.
user_should_modify_template(self)
The action set that Peano will generate that corresponds to this class should not be modified by user...
Action set (reactions to events)