15 Represent a single particle. This is a DaStGen2 wrapper, i.e. I
16 define a DaStGen object and add some particular fields that I always
17 need to administer the particles.
22 If you use these particles, please do not add them to your use
23 definitions of the actions/observers. For pidt, you need a second
24 ParticleSet and this one is used by the observers.
26 You have to add the particle to your project though via
28 my_project.add_global_object
30 If you want to attributes to a particle, use the data subattribute.
31 An all-time classic is the call
33 add_attribute( peano4.dastgen2.Peano4DoubleArray("v","Dimensions") )
37 I actually need only very few fields in Peano's particle toolbox:
39 - A position x. You can change this position in your code, but please
40 invoke a particle re-sort once you change a particle's position. Usually,
41 I employ the pidt (particle in dual tree) scheme, i.e. particles are
42 always stored in the closest vertex. If you alter the position of a
43 particle, you might destroy this association and have to re-assign the
44 object to another vertex.
45 - A search radius. Every particle in Peano has a search radius, i.e. a maximal
46 interaction radius. As I only compare particles stored in one vertex to
47 particles stored in a cell-connected vertex, the search radius also
48 implicitly determines the tree grid level that I use to hold a particle.
49 The bigger the search, the higher up in the mesh I have to store a
51 - A state. This state should not be manipulated by the user. A tree owns the
52 particles that are contained within its local tree cells. Furthermore,
53 a tree knows about the particles which are associated to a vertex that's
54 adjacent to a local mesh. The latter particles are virtual. We effectively
55 work with a halo of h/2 per mesh level.
57 The only action set that should alter the state is UpdateParallelState.
61 If a particle moves, we have to update its state, and we might have to
62 update its vertex association. This discussion focuses on the state
65 Details can be found in
71 If any debug level is active, each particle carries a unique identifier.
74 ## Performance optimisation
76 Particles in Peano are typically stored in the vertex next to them. This is
77 the pidt (paricle in dual tree) technique referenced in the Readme.md file
78 that's automatically generated when you use the particle toolbox.
80 In the illustration below, the blue paricle is associated to the vertex
81 left above it, the red one belongs to the vertex right of it.
83 @image html Particle.png
85 The logical information where the "owning" vertex of a particle is is easy
86 to compute at any time from the geometric context. However, we found that
87 this recomputation is quickly becoming excessively expensive. Therefore, we
90 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
91 self.data.add_attribute(
92 dastgen2.attributes.BooleanArray("containedInAdjacentCell", "TwoPowerD", compress=True)
94 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
96 to the data model which encodes this information. It is to be set properly
97 by the particle sorting algorithm in use.
99 In the example above, the bitfield would hold 010 (read from right to
100 left) for the blue particle and 0100 for the red one. The code is read from
101 the vertex's point of view: If we look at the centre vertex and study the
102 position of particle, it is not in the left bottom adjacent cell. It is
103 however in the right bottom adjacent cell. So we use a lexicographic
104 enumeration of the adjacent cells.
106 As the position of a particle within cells is not unique if a particle
107 resides exactly on the face between two cells, the bitfield can hold
120 Name of the particle. Has to be a valid C++ class name. We pass this
121 to the superclass as fully qualified name
124 peano4.datamodel.DaStGen2.__init__(self, name)
131 self.
data.add_attribute(
136 self.
data.add_attribute(
143 self.
data.add_attribute(
Represent an array of boolean flags.
cardinality is a string (you can thus use symbols as well as long as they will be defined at compile ...
Wrapper around C++ enumerations which is not a datatype supported natively by MPI.
Specialisation of array using Peano's tarch.
Default superclass for any data model in Peano which is stored within the grid.
__init__(self, name)
Constructor.