15 relaxation_coefficient,
17 unknown_setter="setU",
18 unknown_getter="getU",
19 residual_setter="setResidual",
20 residual_getter="getResidual",
21 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
49 return " return std::vector< peano4::grid::GridControlEvent >();\n"
53 return __name__.replace(
".py",
"").replace(
".",
"_")
60 __Template_Constructor = jinja2.Template(
"""
61 _cellStiffnessMatrix = toolbox::finiteelements::StencilFactory::getLaplacian( 0.0, 1.0 );
69 Template_ResetResidual =
"""
70 fineGridVertex{{UNKNOWN}}.{{RESIDUAL_SETTER}}(0.0);
76 This is where you should interpolate
78 @todo Einbauen! Obwohl wir wissen, dass es ueberschrieben wird
81 Template_CreateHangingVertex =
"""
82 fineGridVertex{{UNKNOWN}}.{{RESIDUAL_SETTER}}(0.0);
86 Template_TouchCellFirstTime =
"""
87 const tarch::la::Vector<ThreePowerD,double> stencil = toolbox::finiteelements::getLaplacian(
90 const toolbox::finiteelements::ElementWiseAssemblyMatrix A = toolbox::finiteelements::getElementWiseAssemblyMatrix(
94 tarch::la::Vector<TwoPowerD,double> u;
95 for (int i=0; i<TwoPowerD; i++) {
96 u(i) = fineGridVertices{{UNKNOWN}}(i).{{UNKNOWN_GETTER}}();
99 tarch::la::Vector<TwoPowerD,double> r = A * u;
101 for (int i=0; i<TwoPowerD; i++) {
102 fineGridVertices{{UNKNOWN}}(i).{{RESIDUAL_SETTER}}(
103 fineGridVertices{{UNKNOWN}}(i).{{RESIDUAL_GETTER}}() + r(i)
109 Template_UpdateValue =
"""
110 const tarch::la::Vector<ThreePowerD,double> stencil = toolbox::finiteelements::getLaplacian(
113 const double diag = stencil(ThreePowerD/2);
114 const double residual = {{RHS}} * tarch::la::volume(marker.h()) - fineGridVertex{{UNKNOWN}}.{{RESIDUAL_GETTER}}();
115 fineGridVertex{{UNKNOWN}}.{{UNKNOWN_SETTER}}(
116 fineGridVertex{{UNKNOWN}}.{{UNKNOWN_GETTER}}()
118 {{OMEGA}} * residual / diag
121 if ( marker.coincidesWithCoarseGridVertex() ) {
122 tarch::la::Vector<Dimensions,int> parent = marker.getRelativePositionWithinFatherCell() / 3;
123 coarseGridVertices{{UNKNOWN}}( peano4::utils::dLinearised(parent,2) ).{{UNKNOWN_SETTER}}(
124 fineGridVertex{{UNKNOWN}}.{{UNKNOWN_GETTER}}()
130 Template_CreatePersistentVertex =
"""
135 if operation_name==ActionSet.OPERATION_TOUCH_VERTEX_FIRST_TIME:
137logTraceIn( "touchVertexFirstTime()" );
143logTraceOut( "touchVertexFirstTime()" );
145 if operation_name==ActionSet.OPERATION_CREATE_HANGING_VERTEX:
147logTraceIn( "createHangingVertex()" );
151logTraceOut( "createHangingVertex()" );
153 if operation_name==ActionSet.OPERATION_CREATE_PERSISTENT_VERTEX:
155logTraceIn( "createPersistentVertex()" );
159logTraceOut( "createPersistentVertex()" );
161 if operation_name==ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
163logTraceIn( "touchCellFirstTime()" );
167logTraceOut( "touchCellFirstTime()" );
169 if operation_name==ActionSet.OPERATION_TOUCH_VERTEX_LAST_TIME:
171logTraceIn( "touchVertexLastTime()" );
176logTraceOut( "touchVertexLastTime()" );
183 toolbox::finiteelements::ElementWiseAssemblyMatrix _cellStiffnessMatrix;
189#include "toolbox/finiteelements/ElementMatrix.h"
190#include "toolbox/finiteelements/StencilFactory.h"
192#include "peano4/utils/Loop.h"
Action set (reactions to events)