IPPL API Reference
Independent Parallel Particle Layer C++ API
Loading...
Searching...
No Matches
ippl::PicManager< T, Dim, pc, fc, orb > Class Template Referenceabstract

A template class for managing Particle-in-Cell (PIC) simulations. More...

#include <PicManager.h>

+ Inheritance diagram for ippl::PicManager< T, Dim, pc, fc, orb >:
+ Collaboration diagram for ippl::PicManager< T, Dim, pc, fc, orb >:

Public Member Functions

virtual void par2grid ()=0
 Particle-to-grid operation.
 
virtual void grid2par ()=0
 Grid-to-particle operation.
 
std::shared_ptr< pc > getParticleContainer ()
 Get the default (first) particle container.
 
std::shared_ptr< pc > getParticleContainer (size_t i)
 Get a particle container by index.
 
void setParticleContainer (std::shared_ptr< pc > pcontainer)
 Set the default (first) particle container.
 
size_t addParticleContainer (std::shared_ptr< pc > pcontainer)
 Add an additional particle container (bunch).
 
size_t getNumParticleContainers () const
 Get the number of particle containers (bunches).
 
const std::vector< std::shared_ptr< pc > > & getParticleContainers () const
 Get a const reference to the vector of all particle containers.
 
std::shared_ptr< fc > getFieldContainer ()
 
void setFieldContainer (std::shared_ptr< fc > fcontainer)
 
std::shared_ptr< ippl::FieldSolverBase< T, Dim > > getFieldSolver ()
 
void setFieldSolver (std::shared_ptr< ippl::FieldSolverBase< T, Dim > > fsolver)
 
std::shared_ptr< orb > getLoadBalancer ()
 
void setLoadBalancer (std::shared_ptr< orb > loadbalancer)
 
- Public Member Functions inherited from ippl::BaseManager
virtual void pre_run ()
 A method that should be used for setting up the simulation.
 
virtual void pre_step ()
 A method that should be used for preparation before perfoming a step of simulation.
 
virtual void post_step ()
 A method that should be used after perfoming a step of simulation.
 
virtual void advance ()=0
 A method that should be used to execute/advance a step of simulation.
 
void run (int nt)
 The main for loop fro running a simulation.
 

Protected Attributes

std::shared_ptr< fc > fcontainer_m
 
std::shared_ptr< pc > pcontainer_m
 Default (first) particle container, kept for backward compatibility.
 
std::vector< std::shared_ptr< pc > > pcontainers_m
 All particle containers managed by this PIC manager. the first entry (index 0) is the same as the one pointed to by pcontainer_m.
 
std::shared_ptr< orb > loadbalancer_m
 
std::shared_ptr< ippl::FieldSolverBase< T, Dim > > fsolver_m
 

Detailed Description

template<typename T, unsigned Dim, class pc, class fc, class orb>
class ippl::PicManager< T, Dim, pc, fc, orb >

A template class for managing Particle-in-Cell (PIC) simulations.

The PicManager class is a template class that extends the functionality of the BaseManager class for Particle-in-Cell simulations. It provides methods for particle-to-grid and grid-to-particle operations, as well as a method for dumping simulation data.

It supports multiple particle containers (bunches). By default, a single bunch is used, preserving backward compatibility. The load balancer applies to the first (default) bunch.

Template Parameters
TThe data type for simulation variables.
DimThe dimensionality of the simulation (e.g., 2D or 3D).
pcThe particle container type.
fcThe field container type.
orbThe load balancer type.

Member Function Documentation

◆ addParticleContainer()

template<typename T , unsigned Dim, class pc , class fc , class orb >
size_t ippl::PicManager< T, Dim, pc, fc, orb >::addParticleContainer ( std::shared_ptr< pc >  pcontainer)
inline

Add an additional particle container (bunch).

Parameters
pcontainerShared pointer to the particle container to add.
Returns
The index assigned to the new particle container.

◆ getNumParticleContainers()

template<typename T , unsigned Dim, class pc , class fc , class orb >
size_t ippl::PicManager< T, Dim, pc, fc, orb >::getNumParticleContainers ( ) const
inline

Get the number of particle containers (bunches).

Returns
The number of particle containers.

◆ getParticleContainer() [1/2]

template<typename T , unsigned Dim, class pc , class fc , class orb >
std::shared_ptr< pc > ippl::PicManager< T, Dim, pc, fc, orb >::getParticleContainer ( )
inline

Get the default (first) particle container.

Provided for backward compatibility with single-bunch simulations.

◆ getParticleContainer() [2/2]

template<typename T , unsigned Dim, class pc , class fc , class orb >
std::shared_ptr< pc > ippl::PicManager< T, Dim, pc, fc, orb >::getParticleContainer ( size_t  i)
inline

Get a particle container by index.

Parameters
iThe index of the particle container (0-based).
Returns
Shared pointer to the particle container at index i.
Exceptions
std::out_of_rangeif the index is invalid.

◆ getParticleContainers()

template<typename T , unsigned Dim, class pc , class fc , class orb >
const std::vector< std::shared_ptr< pc > > & ippl::PicManager< T, Dim, pc, fc, orb >::getParticleContainers ( ) const
inline

Get a const reference to the vector of all particle containers.

Returns
Const reference to the vector of shared pointers.

◆ grid2par()

template<typename T , unsigned Dim, class pc , class fc , class orb >
virtual void ippl::PicManager< T, Dim, pc, fc, orb >::grid2par ( )
pure virtual

Grid-to-particle operation.

In a derived class, the user must override this method to perform grid-to-particle operations.

◆ par2grid()

template<typename T , unsigned Dim, class pc , class fc , class orb >
virtual void ippl::PicManager< T, Dim, pc, fc, orb >::par2grid ( )
pure virtual

Particle-to-grid operation.

In a derived class, the user must override this method to perform particle-to-grid operations.

◆ setParticleContainer()

template<typename T , unsigned Dim, class pc , class fc , class orb >
void ippl::PicManager< T, Dim, pc, fc, orb >::setParticleContainer ( std::shared_ptr< pc >  pcontainer)
inline

Set the default (first) particle container.

Provided for backward compatibility. This sets the first bunch and also updates pcontainers_m[0] to stay in sync.


The documentation for this class was generated from the following file: