11TaskMarkerIdentifier =
"TaskMarker"
16 return task_name +
"MeshNumber"
20 full_qualified_enumerator_type = "tarch::multicore::TaskEnumerator
",
21 enumerator_include = """ #include "tarch/multicore/TaskEnumerator.h" """
27 This marker can be used for vertices. The numbers are then typically used
28 for some kind of task system or external referencing. Similar systems are
29 also used linear algebra, i.e. where you enumerate mesh entities, but this
30 one is different as a vertex holds information about its adjacent cells'
33 If you want to use the action sets from this file, you have to run create
34 markers for the vertices and the cells, and you have to add them to the
37 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38 cell_marker_for_tasks = peano4.api.toolbox.api.EnumerateCellsAndVertices.create_cell_marker(current_species_set.name)
39 vertex_marker_for_tasks = peano4.api.toolbox.api.EnumerateCellsAndVertices.create_vertex_marker(current_species_set.name)
41 self._project.datamodel.add_cell(cell_marker_for_tasks)
42 self._project.datamodel.add_vertex(vertex_marker_for_tasks)
43 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45 Furthermore, you have to add the use_vertex and use_cell instructions to
46 each observer (algorithm step) before you add the action sets to the sets
49 Please note that this marker not only holds an index for the vertex. It
50 also hosts the markers of the adjacent cells.
54 dastgen_marker.data.add_attribute(
57 initval=UndefinedNumber,
60 dastgen_marker.data.add_attribute(
62 name=
"AdjacentCellNumber", cardinality=
"TwoPowerD"
65 dastgen_marker.data.add_attribute(
68 type=full_qualified_enumerator_type,
69 include=enumerator_include,
70 qualifier=dastgen2.attributes.Attribute.Qualifier.STATIC,
79 Create cell marker for tasking
81 This marker can be used for cells.
83 @see create_vertex_marker() for some usage information.
87 dastgen_marker.data.add_attribute(
90 initval=UndefinedNumber,
93 dastgen_marker.data.add_attribute(
96 type=
"tarch::Enumerator",
97 include=
""" #include "tarch/Enumerator.h" """,
98 qualifier=dastgen2.attributes.Attribute.Qualifier.STATIC,
101 return dastgen_marker
107 Gives each mesh entity a unique number
109 Also ensure that a vertex knows about the numbers of the adjacent cells.
110 The numbers are unique per rank, but not unique globally. We achieve
111 uniqueness by relying on the tarch::Enumerator.
121 Initialise assignment
123 @param task_name: String
124 The name of the task (attribute tied to the mesh entity) to be
128 super( AssignNumbersToMesh, self ).
__init__()
135 Very simple operation which basically resets all data
139 operation_name == ActionSet.OPERATION_CREATE_PERSISTENT_VERTEX
140 or operation_name == ActionSet.OPERATION_CREATE_HANGING_VERTEX
143 fineGridVertex{}.setNumber(tarch::Enumerator::NoNumber);
144 for (int i=0; i<TwoPowerD; i++) {{
145 fineGridVertex{}.setAdjacentCellNumber(i,tarch::Enumerator::NoNumber);
153 operation_name == ActionSet.OPERATION_DESTROY_PERSISTENT_VERTEX
154 or operation_name == ActionSet.OPERATION_DESTROY_HANGING_VERTEX
157 fineGridVertex{}.getEnumerator().releaseNumber( fineGridVertex{}.getNumber() );
162 if operation_name == ActionSet.OPERATION_TOUCH_VERTEX_FIRST_TIME:
164 if ( fineGridVertex{}.getNumber()==tarch::Enumerator::NoNumber ) {{
165 fineGridVertex{}.setNumber( fineGridVertex{}.getEnumerator().getNumber() );
166 logDebug( "touchVertexFirstTime(...)", "set number " << fineGridVertex{}.toString() );
175 if operation_name == ActionSet.OPERATION_CREATE_CELL:
177 fineGridCell{}.setNumber(tarch::Enumerator::NoNumber);
181 if operation_name == ActionSet.OPERATION_DESTROY_CELL:
183 fineGridCell{}.getEnumerator().releaseNumber( fineGridCell{}.getNumber() );
188 if operation_name == ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
190 if ( fineGridCell{}.getNumber()==tarch::Enumerator::NoNumber ) {{
191 fineGridCell{}.setNumber( fineGridCell{}.getEnumerator().getNumber() );
192 logDebug( "touchCellFirstTime(...)", "set number " << fineGridCell{}.toString() );
194 for (int i=0; i<TwoPowerD; i++) {{
195 fineGridVertices{}(i).setAdjacentCellNumber(
197 fineGridCell{}.getNumber()
211 return " return std::vector< peano4::grid::GridControlEvent >();\n"
214 return __name__.replace(
".py",
"").replace(
".",
"_") +
"_AssignNumbersToMesh"
221#include "tarch/Enumerator.h"
228 Clear all the numbers on the mesh
230 We set all entries to AdjacentCellNumber.
240 Very simple operation which basically resets all data
243 if operation_name == ActionSet.OPERATION_TOUCH_VERTEX_FIRST_TIME:
245 fineGridVertex{}.setNumber(tarch::Enumerator::NoNumber);
246 for (int i=0; i<TwoPowerD; i++) fineGridVertex{}.setAdjacentCellNumber(i,tarch::Enumerator::NoNumber);
247 logDebug( "touchVertexFirstTime(...)", "reset " << fineGridVertex{}.toString() );
254 if operation_name == ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
256 fineGridCell{}.setNumber(tarch::Enumerator::NoNumber);
257 logDebug( "touchCellFirstTime(...)", "reset " << fineGridCell{}.toString() );
266 return " return std::vector< peano4::grid::GridControlEvent >();\n"
269 return __name__.replace(
".py",
"").replace(
".",
"_") +
"_ClearNumbersOnMesh"
276#include "tarch/Enumerator.h"
Wrapper around user-defined attribute.
Default superclass for any data model in Peano which is stored within the grid.
Action set (reactions to events).