8from .Particle
import Particle
32 "peano4::stacks::STDVectorOverContainerOfPointers< "
33 + self.
_data.get_full_qualified_type()
40#include "peano4/stacks/STDVectorOverContainerOfPointers.h"
41#include "../globaldata/"""
42 + self.
_data.particle_model.name
45 + self.
_data.namespace[-1]
56 Map a particle set onto heap objects indexed by a list
58 This class is tied to peano4::stacks::STDVectorOverContainerOfPointers, i.e.
59 Peano's stacks are realised via std::vector from the C++ standard library.
60 Each entry within this vector then resembles a C++ container over pointers
61 to the heap. That is, all particles are stored on the heap. They are
62 scattered. The C++ pointer per stack entry that's used to store all the
63 particle pointers is realised through std::list.
65 Please consult @ref page_swift_performance_optimisation "the generic discussion on the impact of storage schemes".
67 @image html ParticleSetGenerator_ScatteredOnHeap.png
73 super(ParticleSetGenerator_ScatteredOnHeap_IndexByList, self).
__init__(
78 d = {
"PARTICLE_TYPE": self.
_data.particle_model.name,
"STD_CONTAINER":
"list"}
80 templatefile_prefix = (
81 os.path.realpath(__file__).replace(
".pyc",
"").replace(
".py",
"")
85 templatefile_prefix +
"_ScatteredOnHeap_IndexedByStdContainer.template.h",
86 templatefile_prefix +
"_ScatteredOnHeap_IndexedByStdContainer.template.cpp",
89 self.
_data.namespace[-1],
93 output.add(generated_files)
94 output.makefile.add_cpp_file(
95 self.
_data.namespace[-1] +
"/" + self.
_data.name +
".cpp", generated=
True
103 Map a particle set onto heap objects indexed by an std::vector
105 This class is tied to peano4::stacks::STDVectorOverContainerOfPointers, i.e.
106 Peano's stacks are realised via std::vector from the C++ standard library.
107 Each entry within this vector then resembles a C++ container over pointers
108 to the heap. That is, all particles are stored on the heap. They are
109 scattered. The C++ pointer per stack entry that's used to store all the
110 particle pointers is realised through std::list.
112 Please consult @ref page_swift_performance_optimisation "the generic discussion on the impact of storage schemes".
114 @image html ParticleSetGenerator_ScatteredOnHeap.png
120 super(ParticleSetGenerator_ScatteredOnHeap_IndexByVector, self).
__init__(
125 d = {
"PARTICLE_TYPE": self.
_data.particle_model.name,
"STD_CONTAINER":
"vector"}
127 templatefile_prefix = (
128 os.path.realpath(__file__).replace(
".pyc",
"").replace(
".py",
"")
132 templatefile_prefix +
"_ScatteredOnHeap_IndexedByStdContainer.template.h",
133 templatefile_prefix +
"_ScatteredOnHeap_IndexedByStdContainer.template.cpp",
135 self.
_data.namespace,
136 self.
_data.namespace[-1],
140 output.add(generated_files)
141 output.makefile.add_cpp_file(
142 self.
_data.namespace[-1] +
"/" + self.
_data.name +
".cpp", generated=
True
150 Map a particle set onto heap objects indexed by a list
152 This class is tied to peano4::stacks::STDVectorOverContainerOfPointers, i.e.
153 Peano's stacks are realised via std::vector from the C++ standard library.
154 Each entry within this vector then resembles a C++ container over pointers
155 to the heap. That is, all particles are stored on the heap. They are
156 scattered. The C++ pointer per stack entry that's used to store all the
157 particle pointers is realised through std::list.
159 Please consult @ref page_swift_performance_optimisation "the generic discussion on the impact of storage schemes".
161 @image html ParticleSetGenerator_ContinuousPerVertex.png
166 super(ParticleSetGenerator_ContinuousPerVertex, self).
__init__(data,
True)
170 "PARTICLE_TYPE": self.
_data.particle_model.name,
171 "MEMORY_POOL_TYPE":
"toolbox::particles::memorypool::VertexWiseContinuousMemoryPool",
174 templatefile_prefix = (
175 os.path.realpath(__file__).replace(
".pyc",
"").replace(
".py",
"")
179 templatefile_prefix +
"_MemoryPool.template.h",
180 templatefile_prefix +
"_MemoryPool.template.cpp",
182 self.
_data.namespace,
183 self.
_data.namespace[-1],
187 output.add(generated_files)
188 output.makefile.add_cpp_file(
189 self.
_data.namespace[-1] +
"/" + self.
_data.name +
".cpp", generated=
True
197 Map a particle set onto heap objects indexed by a list
199 This class is tied to peano4::stacks::STDVectorOverContainerOfPointers, i.e.
200 Peano's stacks are realised via std::vector from the C++ standard library.
201 Each entry within this vector then resembles a C++ container over pointers
202 to the heap. That is, all particles are stored on the heap. They are
203 scattered. The C++ pointer per stack entry that's used to store all the
204 particle pointers is realised through std::list.
206 Please consult @ref page_swift_performance_optimisation "the generic discussion on the impact of storage schemes".
208 @image html ParticleSetGenerator_GlobalContinuous.png
213 super(ParticleSetGenerator_GlobalContinuous, self).
__init__(data,
True)
217 "PARTICLE_TYPE": self.
_data.particle_model.name,
218 "MEMORY_POOL_TYPE":
"toolbox::particles::memorypool::GlobalContinuousMemoryPool",
221 templatefile_prefix = (
222 os.path.realpath(__file__).replace(
".pyc",
"").replace(
".py",
"")
226 templatefile_prefix +
"_MemoryPool.template.h",
227 templatefile_prefix +
"_MemoryPool.template.cpp",
229 self.
_data.namespace,
230 self.
_data.namespace[-1],
234 output.add(generated_files)
235 output.makefile.add_cpp_file(
236 self.
_data.namespace[-1] +
"/" + self.
_data.name +
".cpp", generated=
True
244 Represents a particle set
246 A particle set is, in principle, a very simple container tied to a vertex.
247 It allows each vertex to point to the particles around. While the
248 realisation on the Python side is simple - after all, the Python model is
249 solely the data model - interesting questions arise once we discuss how the
250 data model is mapped onto C++. This information is not directly stored
251 within the ParticleSet objects, i.e. this class is solely a presentation
252 of the data topology.
254 The information how the association is mapped onto Peano's C++ code is held
255 within the generator. By default, this generator maps each particle set onto
256 a vector which in turn hosts particles on the heap. However, there are
257 alternative implementations which you might want to pick by setting the
258 generator attribute to a different value.
260 - Study ParticleSetGenerator_ScatteredOnHeap_IndexByList to obtain some
261 information about Peano's default storage scheme.
262 - The generator ParticleSetGenerator_ScatteredOnHeap_IndexByVector is
263 a slightly more memory-compact version.
269 Name of the particle. Has to be a valid C++ class name.
272 Link to particle definition
277 DoF.__init__(self, particle.name +
"Set")
279 if particle.association != peano4.datamodel.DoFAssociation.Global:
283 +
" is not (yet) added to project via add_global_object() and thus has invalid DoF association"
300The particle set is administered through the container """
313The particle handling is based upon the idea of particles in dual trees (PIDT)
314as published in the paper below:
316 @article{Weinzierl:2016:PIDT,
317 title = {Two particle-in-grid realisations on spacetrees},
318 journal = {Parallel Computing},
323 doi = {https://doi.org/10.1016/j.parco.2015.12.007},
324 url = {https://www.sciencedirect.com/science/article/pii/S0167819115001635},
325 author = {T. Weinzierl and B. Verleye and P. Henri and D. Roose},
326 keywords = {Particle-in-cell, Spacetree, Particle sorting, AMR, Lagrangian-Eulerian methods, Communication-avoiding},
327 abstract = {The present paper studies two particle management strategies for dynamically adaptive Cartesian grids at hands of a particle-in-cell code. One holds the particles within the grid cells, the other within the grid vertices. The fundamental challenge for the algorithmic strategies results from the fact that particles may run through the grid without velocity constraints. To facilitate this, we rely on multiscale grid representations. They allow us to lift and drop particles between different spatial resolutions. We call this cell-based strategy particle in tree (PIT). Our second approach assigns particles to vertices describing a dual grid (PIDT) and augments the lifts and drops with multiscale linked cells. Our experiments validate the two schemes at hands of an electrostatic particle-in-cell code by retrieving the dispersion relation of Langmuir waves in a thermal plasma. They reveal that different particle and grid characteristics favour different realisations. The possibility that particles can tunnel through an arbitrary number of grid cells implies that most data is exchanged between neighbouring ranks, while very few data is transferred non-locally. This constraints the scalability as the code potentially has to realise global communication. We show that the merger of an analysed tree grammar with PIDT allows us to predict particle movements among several levels and to skip parts of this global communication a priori. It is capable to outperform several established implementations based upon trees and/or space-filling curves.}
Default superclass for any data model in Peano which is stored within the grid.
get_stack_container(self)
get_header_file_include(self)
__init__(self, data, gather_particles)
Map a particle set onto heap objects indexed by a list.
construct_output(self, output)
Map a particle set onto heap objects indexed by a list.
construct_output(self, output)
Map a particle set onto heap objects indexed by a list.
construct_output(self, output)
Map a particle set onto heap objects indexed by an std::vector.
construct_output(self, output)
Represents a particle set.
__init__(self, particle)
Both the association and the namespace are not to be set directly, but through the operation configur...
readme_package_descriptor(self)