8 This class comes last in the pecking order so that we restrict the residual
9 after we've finished computing it in the solver itself...
11 templateTouchVertexFirstTime=
"""
13 repositories::{{SOLVER_INSTANCE}}.restrictToNextLevel()
15 fineGridVertex{{SOLVER_NAME}}.getLevel() == repositories::{{SOLVER_INSTANCE}}.getActiveLevel() - 1
17 for (int i=0; i<{{VERTEX_CARDINALITY}}; i++) {
19 fineGridVertex{{SOLVER_NAME}}.setOldU( i, 0.0 );
20 fineGridVertex{{SOLVER_NAME}}.setU( i, 0.0 );
21 fineGridVertex{{SOLVER_NAME}}.setRhs( i, 0.0 );
26 templateTouchVertexLastTime=
"""
27 // Perform some actual restriction.
29 repositories::{{SOLVER_INSTANCE}}.restrictToNextLevel()
31 fineGridVertex{{SOLVER_NAME}}.getLevel() == repositories::{{SOLVER_INSTANCE}}.getActiveLevel()
33 mghype::matrixfree::solvers::cgmultigrid::restrictToNextLevel<{{SOLVER_NAME}}>(
34 repositories::{{SOLVER_INSTANCE}}.getRestrictionMatrix(marker.x(), marker.h()),
35 coarseGridVertices{{SOLVER_NAME}},
36 fineGridVertex{{SOLVER_NAME}},
44 descend_invocation_order=0,
47 descend_invocation_order,
51 self.
d[
"SOLVER_INSTANCE"] = solver.instance_name()
52 self.
d[
"SOLVER_NAME"] = solver.typename()
53 self.
d[
"VERTEX_CARDINALITY"] = solver._unknowns_per_vertex_node
57 if operation_name==peano4.solversteps.ActionSet.OPERATION_TOUCH_VERTEX_FIRST_TIME:
60 if operation_name==peano4.solversteps.ActionSet.OPERATION_TOUCH_VERTEX_LAST_TIME:
68 The action set that Peano will generate that corresponds to this class
69 should not be modified by users and can safely be overwritten every time
70 we run the Python toolkit.
78 We need the solver repository in this action set, as we directly access
79 the solver object. We also need access to Peano's d-dimensional loops.
83#include "repositories/SolverRepository.h"
84#include "peano4/utils/Loop.h"
85#include "mghype/matrixfree/solvers/CGMultigrid.h"
91 Configure name of generated C++ action set
93 This action set will end up in the directory observers with a name that
94 reflects how the observer (initialisation) is mapped onto this action
95 set. The name pattern is ObserverName2ActionSetIdentifier where this
96 routine co-determines the ActionSetIdentifier. We make is reflect the
100 return __name__.replace(
".py",
"").replace(
".",
"_") +
"_Restrict"
This class comes last in the pecking order so that we restrict the residual after we've finished comp...
get_includes(self)
We need the solver repository in this action set, as we directly access the solver object.
get_action_set_name(self)
Configure name of generated C++ action set.
str templateTouchVertexFirstTime
user_should_modify_template(self)
The action set that Peano will generate that corresponds to this class should not be modified by user...
str templateTouchVertexLastTime
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=False)
Action set (reactions to events)