Peano
Loading...
Searching...
No Matches
GatherParticlesInMemoryPool.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
6 AbstractUpdateParticleGridAssociation,
7)
8
9import jinja2
10
11
13 """!
14
15 Simplistic action set which invokes gather() on the particle set
16
17 Plugs into touchVertexFirstTime(). Should be called prior to any use of
18 vertex data, but after all rearrangements have completed.
19
20 """
21
22 DefaultDescendInvocationOrder = (
23 AbstractUpdateParticleGridAssociation.DefaultDescendInvocationOrder - 1
24 )
25
27 self,
28 particle_set,
29 ):
30 super(GatherParticlesInMemoryPool, self).__init__(
31 descend_invocation_order=self.DefaultDescendInvocationOrder, parallel=False
32 )
33 self._particle_set = particle_set
34 self.d = {}
35 self.d["PARTICLE"] = particle_set.particle_model.name
36 self.d["PARTICLES_CONTAINER"] = particle_set.name
37
38 __Template_TouchVertexFirstTime = jinja2.Template(
39 """
40 fineGridVertex{{PARTICLES_CONTAINER}}.gather();
41"""
42 )
43
44 __Template_TouchVertexLastTime = jinja2.Template(
45 """
46 assertion1( fineGridVertex{{PARTICLES_CONTAINER}}.isGathered(), fineGridVertex{{PARTICLES_CONTAINER}}.toString() );
47"""
48 )
49
50 def get_body_of_operation(self, operation_name):
51 result = "\n"
52 if operation_name == ActionSet.OPERATION_TOUCH_VERTEX_FIRST_TIME:
53 result = self.__Template_TouchVertexFirstTime.render(**self.d)
54 return result
55
57 return " return std::vector< peano4::grid::GridControlEvent >();\n"
58
60 return __name__.replace(".py", "").replace(".", "_")
61
63 return False
64
65 def get_includes(self):
66 result = jinja2.Template(
67 """
68#include "vertexdata/{{PARTICLES_CONTAINER}}.h"
69#include "globaldata/{{PARTICLE}}.h"
70"""
71 )
72 return result.render(**self.d)
Action set (reactions to events)
Definition ActionSet.py:6
Simplistic action set which invokes gather() on the particle set.
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.