14 relaxation_coefficient,
16 unknown_setter="setU",
17 unknown_getter="getU",
18 residual_setter="setResidual",
19 residual_getter="getResidual",
20 store_residual_persistently_and_update_in_touch_first = True,
27 vertex_data: DaStGen object
28 This object must have at least two attributes: A double value u and a double
31 kappa_expr: C++ code (string)
32 Material parameter. Pass in 1.0 if there's no jump anywhere.
37 self.
d[
"UNKNOWN" ] = vertex_data.name
38 self.
d[
"UNKNOWN_SETTER" ] = unknown_setter
39 self.
d[
"UNKNOWN_GETTER" ] = unknown_getter
40 self.
d[
"RESIDUAL_SETTER" ] = residual_setter
41 self.
d[
"RESIDUAL_GETTER" ] = residual_getter
42 self.
d[
"OMEGA" ] = relaxation_coefficient
43 self.
d[
"RHS" ] = rhs_expr
44 self.
d[
"GUARD" ] = guard
50 return " return std::vector< peano4::grid::GridControlEvent >();\n"
54 return __name__.replace(
".py",
"").replace(
".",
"_")
61 __Template_Constructor = jinja2.Template(
"""
62 _cellStiffnessMatrix = toolbox::finiteelements::StencilFactory::getLaplacian( 0.0, 1.0 );
70 Template_ResetResidual =
"""
71 fineGridVertex{{UNKNOWN}}.{{RESIDUAL_SETTER}}(0.0);
77 This is where you should interpolate
79 @todo Einbauen! Obwohl wir wissen, dass es ueberschrieben wird
82 Template_CreateHangingVertex =
"""
83 fineGridVertex{{UNKNOWN}}.{{RESIDUAL_SETTER}}(0.0);
87 Template_TouchCellFirstTime =
"""
89 const tarch::la::Vector<ThreePowerD,double> stencil = toolbox::finiteelements::getLaplacian(
92 const toolbox::finiteelements::ElementWiseAssemblyMatrix A = toolbox::finiteelements::getElementWiseAssemblyMatrix(
96 tarch::la::Vector<TwoPowerD,double> u;
97 for (int i=0; i<TwoPowerD; i++) {
98 u(i) = fineGridVertices{{UNKNOWN}}(i).{{UNKNOWN_GETTER}}();
101 tarch::la::Vector<TwoPowerD,double> r = A * u;
103 for (int i=0; i<TwoPowerD; i++) {
104 fineGridVertices{{UNKNOWN}}(i).{{RESIDUAL_SETTER}}(
105 fineGridVertices{{UNKNOWN}}(i).{{RESIDUAL_GETTER}}() + r(i)
112 Template_UpdateValue =
"""
113 const tarch::la::Vector<ThreePowerD,double> stencil = toolbox::finiteelements::getLaplacian(
116 const double diag = stencil(ThreePowerD/2);
117 const double residual = {{RHS}} * tarch::la::volume(marker.h()) - fineGridVertex{{UNKNOWN}}.{{RESIDUAL_GETTER}}();
118 fineGridVertex{{UNKNOWN}}.{{UNKNOWN_SETTER}}(
119 fineGridVertex{{UNKNOWN}}.{{UNKNOWN_GETTER}}()
121 {{OMEGA}} * residual / diag
124 if ( marker.coincidesWithCoarseGridVertex() ) {
125 tarch::la::Vector<Dimensions,int> parent = marker.getRelativePositionWithinFatherCell() / 3;
126 coarseGridVertices{{UNKNOWN}}( peano4::utils::dLinearised(parent,2) ).{{UNKNOWN_SETTER}}(
127 fineGridVertex{{UNKNOWN}}.{{UNKNOWN_GETTER}}()
133 Template_CreatePersistentVertex =
"""
138 if operation_name==ActionSet.OPERATION_TOUCH_VERTEX_FIRST_TIME:
140logTraceIn( "touchVertexFirstTime()" );
146logTraceOut( "touchVertexFirstTime()" );
148 if operation_name==ActionSet.OPERATION_CREATE_HANGING_VERTEX:
150logTraceIn( "createHangingVertex()" );
154logTraceOut( "createHangingVertex()" );
156 if operation_name==ActionSet.OPERATION_CREATE_PERSISTENT_VERTEX:
158logTraceIn( "createPersistentVertex()" );
162logTraceOut( "createPersistentVertex()" );
164 if operation_name==ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
166logTraceIn( "touchCellFirstTime()" );
170logTraceOut( "touchCellFirstTime()" );
172 if operation_name==ActionSet.OPERATION_TOUCH_VERTEX_LAST_TIME:
174logTraceIn( "touchVertexLastTime()" );
179logTraceOut( "touchVertexLastTime()" );
186 toolbox::finiteelements::ElementWiseAssemblyMatrix _cellStiffnessMatrix;
192#include "toolbox/finiteelements/ElementMatrix.h"
193#include "toolbox/finiteelements/StencilFactory.h"
195#include "peano4/utils/Loop.h"
Action set (reactions to events)