Peano
Loading...
Searching...
No Matches
swift2.particle.AlgorithmStepLibrary Namespace Reference

Data Structures

class  ParticleIteratorTemplate
 A mini-wrapper around a string for particle iterator. More...
 

Functions

 _get_particle_iterator_templates (particle_name)
 Construct particle interaction iterator call templates given the desired particle interaction kernel realisation.
 
 get_algorithm_step_dict (particle)
 Sets up a dict of the algorithm steps for this scheme so they can be accessed at various points and by various models.
 

Function Documentation

◆ _get_particle_iterator_templates()

swift2.particle.AlgorithmStepLibrary._get_particle_iterator_templates ( particle_name)
protected

Construct particle interaction iterator call templates given the desired particle interaction kernel realisation.

These signature templates are strings containing c++ code snippets of the correct iterator call signature.

In total, there are four types of iterators. The essential two are:

  • The one that's used to run over all particle assigned to a vertex. It is called iterate_over_particles_assigned_to_vertex.
  • There is one to iterate over all particle pairs associated with a cell. This one is called iterate_over_particles_assigned_to_cell.

From hereon, we can define some "derived" iterators:

  • One special iterator runs over all particles associated with a vertex and allows them to move. This one is titled iterate_over_particles_assigned_to_vertex_for_move and equals iterate_over_particles_assigned_to_vertex. However, it embeds the latter into some bookkeeping for the validation of the vertex-particle assocation.
  • Another special iterator runs over all particles but allows them to reduce into some global space. If you use vectorisation, this one cannot be vectorised by definition.

Both special iterators are constructed to default values unless you explicitly set them beforehand.

The iterators require a function to be passed as an argument to act on the particles. In the template snippets being generated here, the functions shall be replaced by a placeholder string 'FUNCTION'.

Finally, the code snippets being returned are stored as a ParticleIteratorTemplate object.

Parameters
particle_namestr the particle class name.

4 ParticleIteratorTemplate objects containing particle iterator code snippets.

Returns
vertex_for_move: snippet (in a ParticleIteratorTemplate object) to use for particle interactons which will move assigned to a vertex
cell: snippet (in a ParticleIteratorTemplate object) to use for particle-particle interactions assigned to a cell
vertex: snippet (in a ParticleIteratorTemplate object) to use for particle interactions assigned to a vertex
vertex_with_global_reduction: snippet (in a ParticleIteratorTemplate object) to use for particle interactions assigned to a vertex which also contain a global reduction

Definition at line 34 of file AlgorithmStepLibrary.py.

Referenced by swift2.particle.AlgorithmStepLibrary.get_algorithm_step_dict().

Here is the caller graph for this function:

◆ get_algorithm_step_dict()

swift2.particle.AlgorithmStepLibrary.get_algorithm_step_dict ( particle)

Sets up a dict of the algorithm steps for this scheme so they can be accessed at various points and by various models.

Definition at line 128 of file AlgorithmStepLibrary.py.

References swift2.particle.AlgorithmStepLibrary._get_particle_iterator_templates().

Here is the call graph for this function: