9 Redoing this class for discontinuous galerkin solver.
11 This time, we store values only in the cells and just
12 determine the type of vertex we see.
14 templateTouchVertexFirstTime =
"""
16 //logTraceInWith3Arguments("InitDofsDG::touchVertexFirstTime", marker.toString(), isOnBoundary(marker.x()), fineGridVertex{{SOLVER_NAME}}.toString());
18 vertexdata::{{SOLVER_NAME}}::Type dofType = repositories::{{SOLVER_INSTANCE}}.getVertexDoFType(marker.x(),marker.h());
23 case vertexdata::{{SOLVER_NAME}}::Type::Interior:
25 if ( marker.willBeRefined() )
27 fineGridVertex{{SOLVER_NAME}}.setType( vertexdata::{{SOLVER_NAME}}::Type::Coarse );
32 fineGridVertex{{SOLVER_NAME}}.setType( vertexdata::{{SOLVER_NAME}}::Type::Interior );
37 case vertexdata::{{SOLVER_NAME}}::Type::Coarse:
38 assertionMsg(false, "should not be returned by user" );
41 case vertexdata::{{SOLVER_NAME}}::Type::Undefined:
42 assertionMsg(false, "should not be returned by user" );
47 //logTraceOutWith2Arguments("InitDofsDG::touchVertexFirstTime", marker.toString(), fineGridVertex{{SOLVER_NAME}}.toString());
50 templateTouchCellFirstTime =
"""
51 logTraceInWith2Arguments("InitDofs::touchCellFirstTime", marker.toString(), fineGridCell{{SOLVER_NAME}}.toString());
53 celldata::{{SOLVER_NAME}}::Type dofType = repositories::{{SOLVER_INSTANCE}}.getCellDoFType(marker.x(),marker.h());
57 case celldata::{{SOLVER_NAME}}::Type::Outside:
59 if ( marker.willBeRefined() ) // make it coarse
61 fineGridCell{{SOLVER_NAME}}.setType( celldata::{{SOLVER_NAME}}::Type::Coarse );
65 fineGridCell{{SOLVER_NAME}}.setType( celldata::{{SOLVER_NAME}}::Type::Outside );
70 case celldata::{{SOLVER_NAME}}::Type::Interior:
72 if ( marker.willBeRefined() )
74 fineGridCell{{SOLVER_NAME}}.setType( celldata::{{SOLVER_NAME}}::Type::Coarse );
78 fineGridCell{{SOLVER_NAME}}.setType( celldata::{{SOLVER_NAME}}::Type::Interior );
80 // create vectors to send to implementation
81 tarch::la::Vector< repositories::{{SOLVER_INSTANCE}}.CellUnknowns, double > value;
82 tarch::la::Vector< repositories::{{SOLVER_INSTANCE}}.CellUnknowns, double > rhs;
84 repositories::{{SOLVER_INSTANCE}}.initCell(marker.x(), marker.h(), value, rhs);
86 logTraceInWith5Arguments("touchCellFirstTime::Interior", fineGridCell{{SOLVER_NAME}}.getSolution(), fineGridCell{{SOLVER_NAME}}.getRhs(), marker.toString(), value, rhs);
88 // adding junk data to the solution and rhs for development purposes
89 for (int i=0; i<repositories::{{SOLVER_INSTANCE}}.CellUnknowns; i++)
91 fineGridCell{{SOLVER_NAME}}.setSolution(i,value(i));
92 fineGridCell{{SOLVER_NAME}}.setRhs(i,rhs(i));
95 logTraceOutWith2Arguments("touchCellFirstTime::Interior", fineGridCell{{SOLVER_NAME}}.getSolution(), fineGridCell{{SOLVER_NAME}}.getRhs());
102 logTraceOutWith2Arguments("InitDofs::touchCellFirstTime", marker.toString(), fineGridCell{{SOLVER_NAME}}.toString());
105 templatetouchFaceFirstTime =
"""
106 logTraceInWith2Arguments("InitDofs::touchFaceFirstTime", marker.toString(), fineGridFace{{SOLVER_NAME}}.toString());
108 facedata::{{SOLVER_NAME}}::Type dofType = repositories::{{SOLVER_INSTANCE}}.getFaceDoFType(marker.x(),marker.h());
112 case facedata::{{SOLVER_NAME}}::Type::Outside:
114 if ( marker.willBeRefined() ) // make it coarse
116 fineGridFace{{SOLVER_NAME}}.setType( facedata::{{SOLVER_NAME}}::Type::Coarse );
120 fineGridFace{{SOLVER_NAME}}.setType( facedata::{{SOLVER_NAME}}::Type::Outside );
124 case facedata::{{SOLVER_NAME}}::Type::Interior:
126 if ( marker.willBeRefined() )
128 fineGridFace{{SOLVER_NAME}}.setType( facedata::{{SOLVER_NAME}}::Type::Coarse );
132 fineGridFace{{SOLVER_NAME}}.setType( facedata::{{SOLVER_NAME}}::Type::Interior );
134 // vectors to be passed into face
135 tarch::la::Vector< repositories::{{SOLVER_INSTANCE}}.FaceUnknownsSolution, double > sol;
136 tarch::la::Vector< repositories::{{SOLVER_INSTANCE}}.FaceUnknownsProjection, double > projection;
139 repositories::{{SOLVER_INSTANCE}}.initFace(marker.x(), marker.h(), sol, projection);
142 fineGridFace{{SOLVER_NAME}}.setSolution(sol);
143 fineGridFace{{SOLVER_NAME}}.setProjection(projection);
148 case facedata::{{SOLVER_NAME}}::Type::Boundary:
150 if ( marker.willBeRefined() )
152 fineGridFace{{SOLVER_NAME}}.setType( facedata::{{SOLVER_NAME}}::Type::Coarse );
156 fineGridFace{{SOLVER_NAME}}.setType( facedata::{{SOLVER_NAME}}::Type::Boundary );
158 // vectors to be passed into face
159 tarch::la::Vector< repositories::{{SOLVER_INSTANCE}}.FaceUnknownsSolution, double > sol;
160 tarch::la::Vector< repositories::{{SOLVER_INSTANCE}}.FaceUnknownsProjection, double > projection;
163 repositories::{{SOLVER_INSTANCE}}.initFace(marker.x(), marker.h(), sol, projection);
166 fineGridFace{{SOLVER_NAME}}.setSolution(sol);
167 fineGridFace{{SOLVER_NAME}}.setProjection(projection);
174 logTraceOutWith2Arguments("InitDofs::touchFaceFirstTime", marker.toString(), fineGridFace{{SOLVER_NAME}}.toString());
179 super( InitDofsDG, self ).
__init__()
181 self.
d[
"SOLVER_INSTANCE"] = solver.instance_name()
182 self.
d[
"SOLVER_NAME"] = solver.typename()
187 if operation_name==peano4.solversteps.ActionSet.OPERATION_TOUCH_VERTEX_FIRST_TIME:
190 if operation_name==peano4.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
193 if operation_name==peano4.solversteps.ActionSet.OPERATION_TOUCH_FACE_FIRST_TIME:
201 Configure name of generated C++ action set
203 This action set will end up in the directory observers with a name that
204 reflects how the observer (initialisation) is mapped onto this action
205 set. The name pattern is ObserverName2ActionSetIdentifier where this
206 routine co-determines the ActionSetIdentifier. We make is reflect the
210 return __name__.replace(
".py",
"").replace(
".",
"_")
215 The action set that Peano will generate that corresponds to this class
216 should not be modified by users and can safely be overwritten every time
217 we run the Python toolkit.
225 We need the solver repository in this action set, as we directly access
226 the solver object. We also need access to Peano's d-dimensional loops.
230#include "../repositories/SolverRepository.h"
231#include "peano4/utils/Loop.h"
Redoing this class for discontinuous galerkin solver.
str templateTouchCellFirstTime
str templatetouchFaceFirstTime
str templateTouchVertexFirstTime
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.
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_action_set_name(self)
Configure name of generated C++ action set.
Action set (reactions to events)