Peano
Loading...
Searching...
No Matches
peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet Class Reference

Producer-side wrapper around an action set, which spawns touchCellFirstTime() as a task. More...

Inheritance diagram for peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet:
Collaboration diagram for peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet:

Public Member Functions

 __init__ (self, ActionSet action_set, str task_labels_name, str task_number_attribute_name, str previous_task_number_attribute_name, list face_enumerators=[], list vertex_enumerators=[])
 
 get_constructor_body (self)
 Define a tailored constructor body.
 
 get_destructor_body (self)
 
 get_static_initialisations (self, full_qualified_classname)
 
 get_body_of_createGridControlEventsForNextTraversal (self)
 Return the grid control events that this action set wants to trigger.
 
 get_body_of_prepareTraversal (self)
 
 get_body_of_unprepareTraversal (self)
 
 get_body_of_operation (self, operation_name)
 Return actual C++ code snippets to be inserted into C++ code.
 
 get_implementation_of_operation (self, operation_name)
 Delegate to the wrapped action set besides the events listed in the class description.
 
 get_action_set_name (self)
 Return unique action set name.
 
 user_should_modify_template (self)
 Is the user allowed to modify the output.
 
 get_attributes (self)
 Return attributes as copied and pasted into the generated class.
 
 get_includes (self)
 Return include statements that you need.
 
- Public Member Functions inherited from peano4.api.solversteps.ActionSet.ActionSet
 get_implementation_of_createGridControlEventsForNextTraversal (self)
 Return the C++ implementation of createGridControlEventsForNextTraversal()
 
 get_implementation_of_prepareTraversal (self)
 Return the C++ implementation of prepareTraversal()
 
 get_implementation_of_unprepareTraversal (self)
 Return the C++ implementation of unprepareTraversal()
 
 get_guard_of_operation (self, operation_name)
 Return the guard of an operation.
 
bool may_run_in_background_task (self)
 May a task graph compiler move touchCellFirstTime() into a task.
 

Data Fields

 action_set
 
- Data Fields inherited from peano4.api.solversteps.ActionSet.ActionSet
 descend_invocation_order
 
 parallel
 

Protected Member Functions

str _lambda_captures (self)
 Capture list of the spawned task's lambda: Everything by value, and the vertex and face enumerators as copies of their data under the same name.
 
str _accessor (self, str attribute_name)
 

Protected Attributes

 _task_labels_name
 
 _task_number_attribute_name
 
 _previous_task_number_attribute_name
 
 _face_enumerators
 
 _vertex_enumerators
 

Additional Inherited Members

- Static Public Attributes inherited from peano4.api.solversteps.ActionSet.ActionSet
int descend_invocation_order = 0
 
bool parallel = False
 
str OPERATION_BEGIN_TRAVERSAL = "beginTraversal"
 
str OPERATION_END_TRAVERSAL = "endTraversal"
 
str OPERATION_CREATE_PERSISTENT_VERTEX = "createPersistentVertex"
 
str OPERATION_DESTROY_PERSISTENT_VERTEX = "destroyPersistentVertex"
 
str OPERATION_CREATE_HANGING_VERTEX = "createHangingVertex"
 
str OPERATION_DESTROY_HANGING_VERTEX = "destroyHangingVertex"
 
str OPERATION_CREATE_PERSISTENT_FACE = "createPersistentFace"
 
str OPERATION_DESTROY_PERSISTENT_FACE = "destroyPersistentFace"
 
str OPERATION_CREATE_HANGING_FACE = "createHangingFace"
 
str OPERATION_DESTROY_HANGING_FACE = "destroyHangingFace"
 
str OPERATION_CREATE_CELL = "createCell"
 
str OPERATION_DESTROY_CELL = "destroyCell"
 
str OPERATION_TOUCH_VERTEX_FIRST_TIME = "touchVertexFirstTime"
 
str OPERATION_TOUCH_VERTEX_LAST_TIME = "touchVertexLastTime"
 
str OPERATION_TOUCH_FACE_FIRST_TIME = "touchFaceFirstTime"
 
str OPERATION_TOUCH_FACE_LAST_TIME = "touchFaceLastTime"
 
str OPERATION_TOUCH_CELL_FIRST_TIME = "touchCellFirstTime"
 
str OPERATION_TOUCH_CELL_LAST_TIME = "touchCellLastTime"
 

Detailed Description

Producer-side wrapper around an action set, which spawns touchCellFirstTime() as a task.

The wrapper delegates all events to the wrapped action set with the following exceptions:

  • touchCellFirstTime() evaluates the wrapped action set's guard. If the guard holds, the wrapper takes a new task number from the task enumerator, stores it in the cell's task label and spawns the wrapped action set's body as a task with this number. If the guard does not hold, the task label is set to tarch::multicore::TaskEnumerator::NoNumber.
  • createCell() furthermore initialises the task label with NoNumber.

The task enumerator is a static attribute of the task labels, i.e. it is shared by all producers and consumers which use these labels.

The spawned task captures its environment by value ([=]). Cell data managed via smart pointers (e.g. peano4.api.datamodel.PatchToDoubleArrayWithSmartPointer) is copied shallowly, i.e. the task writes into the cell's data. Plain arrays are copied deeply, i.e. writes are lost.

Enumerators over vertices and faces hold pointers into Peano's stacks, which are invalid once touchCellFirstTime() has terminated. The task therefore captures each enumerator which its body might use as peano4::datamanagement::FaceHeapDataEnumerator or peano4::datamanagement::VertexHeapDataEnumerator under the same name. These enumerators hold copies of the faces or vertices. The copies are shallow if the data is managed via smart pointers.

peano4.api.taskgraph.compiler.CellTaskProducerConsumer warns about data which is not managed via smart pointers.

All other events, including unprepareTraversal(), endTraversal() and the touch...LastTime() events, remain within the producer. They are hence invoked before the spawned tasks have necessarily terminated. peano4.api.taskgraph.compiler.CellTaskProducerConsumer therefore only splits tasks whose action sets do not realise these events, unless the task explicitly allows it (peano4.api.taskgraph.Task.Task.may_spawn_background_tasks).

Definition at line 6 of file SpawnCellTaskActionSet.py.

Constructor & Destructor Documentation

◆ __init__()

peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.__init__ (   self,
ActionSet  action_set,
str  task_labels_name,
str  task_number_attribute_name,
str  previous_task_number_attribute_name,
list   face_enumerators = [],
list   vertex_enumerators = [] 
)
Parameters
action_setpeano4.api.solversteps.ActionSet The wrapped action set.
task_labels_namestr Name of the DaStGen2 cell data type holding the task labels. The generated observer passes it into the event as fineGridCell<name>.
task_number_attribute_namestr Name of the attribute within the task labels which holds the task number.
previous_task_number_attribute_namestr or None Name of the attribute holding the task number of the task spawned by the previous action set of the same producer. The spawned task depends on this task, so the action sets' bodies are executed in their original order. If None, the task has no incoming dependencies.
face_enumerators[str] Names of the face enumerators, e.g. fineGridFacesQ, which the task captures as peano4::datamanagement::FaceHeapDataEnumerator.
vertex_enumerators[str] Names of the vertex enumerators, e.g. fineGridVerticesQ, which the task captures as peano4::datamanagement::VertexHeapDataEnumerator.

Reimplemented from peano4.api.solversteps.ActionSet.ActionSet.

Definition at line 52 of file SpawnCellTaskActionSet.py.

References peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.__init__().

Referenced by peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.__init__().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ _accessor()

str peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet._accessor (   self,
str  attribute_name 
)
protected

Definition at line 115 of file SpawnCellTaskActionSet.py.

◆ _lambda_captures()

str peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet._lambda_captures (   self)
protected

Capture list of the spawned task's lambda: Everything by value, and the vertex and face enumerators as copies of their data under the same name.

Definition at line 98 of file SpawnCellTaskActionSet.py.

References peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet._face_enumerators, and peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet._vertex_enumerators.

◆ get_action_set_name()

peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.get_action_set_name (   self)

Return unique action set name.

Returns a description (word) for the mapping which is also used as class name for the generated type. As a consequence, the result should be one word (if possible) and uppercase. Also, every subclass should overwrite this routine.

The generator will take the result and construct eventually classes similar to MyStep2Dummy.h and MyStep2Dummy.cpp or similar for the example below, where we return Dummy.

Reimplemented from peano4.api.solversteps.ActionSet.ActionSet.

Definition at line 182 of file SpawnCellTaskActionSet.py.

References peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.action_set, and peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.get_action_set_name().

Referenced by peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.get_action_set_name().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_attributes()

peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.get_attributes (   self)

Return attributes as copied and pasted into the generated class.

Please note that action sets are not persistent, i.e. there is one object creation per grid sweep per tree.

Reimplemented from peano4.api.solversteps.ActionSet.ActionSet.

Definition at line 188 of file SpawnCellTaskActionSet.py.

References peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.action_set, and peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.get_attributes().

Referenced by peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.get_attributes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_body_of_createGridControlEventsForNextTraversal()

peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.get_body_of_createGridControlEventsForNextTraversal (   self)

Return the grid control events that this action set wants to trigger.

Please consult the documentation of grid control events for details on what these events are and how they are used.

Reimplemented from peano4.api.solversteps.ActionSet.ActionSet.

Definition at line 127 of file SpawnCellTaskActionSet.py.

References peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.action_set, and peano4.api.solversteps.ActionSet.ActionSet.get_implementation_of_createGridControlEventsForNextTraversal().

Referenced by peano4.api.solversteps.ActionSet.ActionSet.get_implementation_of_createGridControlEventsForNextTraversal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_body_of_operation()

peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.get_body_of_operation (   self,
  operation_name 
)

Return actual C++ code snippets to be inserted into C++ code.

See class' string constants starting with OPERATION_ for possible values of operation_name. The snippet is executed if and only if the guard returned by get_guard_of_operation() holds, i.e. the body should not evaluate the guard itself. See the section "Guard and body" in the class documentation.

Reimplemented from peano4.api.solversteps.ActionSet.ActionSet.

Definition at line 136 of file SpawnCellTaskActionSet.py.

Referenced by peano4.api.solversteps.ActionSet.ActionSet.get_implementation_of_operation().

Here is the caller graph for this function:

◆ get_body_of_prepareTraversal()

peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.get_body_of_prepareTraversal (   self)

◆ get_body_of_unprepareTraversal()

peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.get_body_of_unprepareTraversal (   self)

◆ get_constructor_body()

peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.get_constructor_body (   self)

Define a tailored constructor body.

By default, the constructor of an action set is empty. If you you assign attributes to your action set, you however might want to initialise them here. We do not support initialisation lists, to all has to be done via setters unless you create attributes on the heap.

The constructor's signature will look similar to

   EnumerateAndInitSolution2petsc_actionsets_InitVertexDoFs0(int treeNumber);

where the treeNumber is -1 if this is the global instance of the action set owned by a rank, or a number greater or equal 0 if this action set is a clone of the glocal action set that's used by one tree traversal.

See also
get_attributes() to add attributes to your action set

Reimplemented from peano4.api.solversteps.ActionSet.ActionSet.

Definition at line 118 of file SpawnCellTaskActionSet.py.

References peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.action_set, and peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.get_constructor_body().

Referenced by peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.get_constructor_body().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_destructor_body()

peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.get_destructor_body (   self)

◆ get_implementation_of_operation()

peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.get_implementation_of_operation (   self,
  operation_name 
)

◆ get_includes()

peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.get_includes (   self)

Return include statements that you need.

All of these includes will eventually end up in the header of the generated C++ code.

Reimplemented from peano4.api.solversteps.ActionSet.ActionSet.

Definition at line 191 of file SpawnCellTaskActionSet.py.

References peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.action_set, and peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.get_includes().

Referenced by peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.get_includes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_static_initialisations()

peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.get_static_initialisations (   self,
  full_qualified_classname 
)

◆ user_should_modify_template()

peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet.user_should_modify_template (   self)

Is the user allowed to modify the output.

Return whether you expect the user to modify the generated code. If this is the case, then the API places the generated output in the directory actions. Otherwise, it goes into the observer directory and will be overwritten in each and every Python run.

Reimplemented from peano4.api.solversteps.ActionSet.ActionSet.

Definition at line 185 of file SpawnCellTaskActionSet.py.

Field Documentation

◆ _face_enumerators

peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet._face_enumerators
protected

◆ _previous_task_number_attribute_name

peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet._previous_task_number_attribute_name
protected

◆ _task_labels_name

peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet._task_labels_name
protected

Definition at line 92 of file SpawnCellTaskActionSet.py.

◆ _task_number_attribute_name

peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet._task_number_attribute_name
protected

Definition at line 93 of file SpawnCellTaskActionSet.py.

◆ _vertex_enumerators

peano4.api.taskgraph.compiler.SpawnCellTaskActionSet.SpawnCellTaskActionSet._vertex_enumerators
protected

◆ action_set


The documentation for this class was generated from the following file: