Peano
Loading...
Searching...
No Matches
Cleanup.py
Go to the documentation of this file.
1# This file is part of the Peano project. For conditions of distribution and
2# use, please see the copyright notice at www.peano-framework.org
3from peano4.solversteps.ActionSet import ActionSet
4
5import jinja2
6import peano4
7
8
11 self,
12 particle_set,
13 ):
14 """!
15 Cleanup action set
16
17 As the final grid traversal, clean up after yourself. At the moment, this
18 entails deleting particles properly.
19
20 """
21 self._particle_set = particle_set
22 self.d = {}
23 self.d["PARTICLE"] = particle_set.particle_model.name
24 self.d["PARTICLES_CONTAINER"] = particle_set.name
25 self.d[
26 "MARKER_NAME"
28 particle_set.name
29 )
30
31 return
32
34 return False
35
36 __Template_TouchVertexLastTime = jinja2.Template(
37 """
38 fineGridVertex{{PARTICLES_CONTAINER}}.deleteParticles();
39 """
40 )
41
42 def get_body_of_operation(self, operation_name):
43 result = "\n"
44 if operation_name == ActionSet.OPERATION_TOUCH_VERTEX_LAST_TIME:
45 result = self.__Template_TouchVertexLastTime.render(**self.d)
46 return result
47
49 return __name__.replace(".py", "").replace(".", "_")
50
51 def get_includes(self):
52 result = jinja2.Template(
53 """
54#include "vertexdata/{{PARTICLES_CONTAINER}}.h"
55#include "globaldata/{{PARTICLE}}.h"
56"""
57 )
58 return result.render(**self.d)
Action set (reactions to events)
Definition ActionSet.py:6
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.
Definition Cleanup.py:42
__init__(self, particle_set)
Cleanup action set.
Definition Cleanup.py:13
user_should_modify_template(self)
Is the user allowed to modify the output.
Definition Cleanup.py:33
get_action_set_name(self)
Return unique action set name.
Definition Cleanup.py:48
get_includes(self)
Return include statements that you need.
Definition Cleanup.py:51