Portage::Meshfree::Swarm< dim > Class Template Reference

An effective "mesh" class for a collection disconnected points (particles). More...

#include <swarm.h>

Public Member Functions

 Swarm ()=default
 Create an empty particle field. More...
 
 Swarm (Portage::vector< Wonton::Point< dim >> const &points)
 Create a particle field from a given list. More...
 
 Swarm (int num_particles, int distribution, unsigned user_seed=0, double x_min=0.0, double x_max=0.0, double y_min=0.0, double y_max=0.0, double z_min=0.0, double z_max=0.0)
 Generate a random or uniform particle field. More...
 
template<typename Mesh >
 Swarm (Mesh const &mesh, Wonton::Entity_kind entity)
 Create a particle field from an arbitary mesh wrapper. More...
 
template<typename Mesh >
 Swarm (std::vector< Mesh *> const &meshes, Wonton::Entity_kind entity)
 Create a particle field from a set of mesh wrappers. More...
 
 ~Swarm ()=default
 Destructor. More...
 
int space_dimension () const
 Get the dimension. More...
 
int num_owned_particles () const
 Get owned particles count. More...
 
int num_ghost_particles () const
 Get ghost particles count. More...
 
int num_particles (Wonton::Entity_type type=Wonton::ALL) const
 Get particles count. More...
 
Wonton::Point< dim > get_particle_coordinates (int index) const
 Get the coordinates of the particle. More...
 
counting_iterator begin (Entity_kind const kind=Wonton::PARTICLE, Entity_type const type=Wonton::ALL) const
 Get an iterator at first element of the particle field. More...
 
counting_iterator end (Entity_kind const kind=Wonton::PARTICLE, Entity_type const type=Wonton::ALL) const
 Get an iterator at last element of the particle field. More...
 
void extend_particle_list (std::vector< Wonton::Point< dim >> const &new_pts)
 Extend the particle field. More...
 
template<>
 Swarm (int num_particles, int distribution, unsigned user_seed, double x_min, double x_max, double, double, double, double)
 
template<>
 Swarm (int num_particles, int distribution, unsigned user_seed, double x_min, double x_max, double y_min, double y_max, double, double)
 
template<>
 Swarm (int num_particles, int distribution, unsigned user_seed, double x_min, double x_max, double y_min, double y_max, double z_min, double z_max)
 

Detailed Description

template<int dim>
class Portage::Meshfree::Swarm< dim >

An effective "mesh" class for a collection disconnected points (particles).

Template Parameters
dimthe dimension of the problem.

Constructor & Destructor Documentation

◆ Swarm() [1/8]

template<int dim>
Portage::Meshfree::Swarm< dim >::Swarm ( )
default

Create an empty particle field.

◆ Swarm() [2/8]

template<int dim>
Portage::Meshfree::Swarm< dim >::Swarm ( Portage::vector< Wonton::Point< dim >> const &  points)
inlineexplicit

Create a particle field from a given list.

Parameters
pointsthe given list of points.

◆ Swarm() [3/8]

template<int dim>
Portage::Meshfree::Swarm< dim >::Swarm ( int  num_particles,
int  distribution,
unsigned  user_seed = 0,
double  x_min = 0.0,
double  x_max = 0.0,
double  y_min = 0.0,
double  y_max = 0.0,
double  z_min = 0.0,
double  z_max = 0.0 
)

Generate a random or uniform particle field.

Parameters
num_particlesnumber of points.
p_minlower bounds on points coordinates.
p_maxupper bounds on points coordinates.
distributionthe kind of random numbers distribution.
seeda seed used by the random number generator.

◆ Swarm() [4/8]

template<int dim>
template<typename Mesh >
Portage::Meshfree::Swarm< dim >::Swarm ( Mesh const &  mesh,
Wonton::Entity_kind  entity 
)

Create a particle field from an arbitary mesh wrapper.

Template Parameters
Meshtype of mesh wrapper.
Parameters
mesha mesh.
entitythe entity kind.

◆ Swarm() [5/8]

template<int dim>
template<typename Mesh >
Portage::Meshfree::Swarm< dim >::Swarm ( std::vector< Mesh *> const &  meshes,
Wonton::Entity_kind  entity 
)

Create a particle field from a set of mesh wrappers.

Template Parameters
Meshtype of mesh wrappers.
Parameters
meshesa set of meshes.
entitythe entity kind.

◆ ~Swarm()

template<int dim>
Portage::Meshfree::Swarm< dim >::~Swarm ( )
default

Destructor.

◆ Swarm() [6/8]

template<>
Portage::Meshfree::Swarm< 1 >::Swarm ( int  num_particles,
int  distribution,
unsigned  user_seed,
double  x_min,
double  x_max,
double  ,
double  ,
double  ,
double   
)
inline

◆ Swarm() [7/8]

template<>
Portage::Meshfree::Swarm< 2 >::Swarm ( int  num_particles,
int  distribution,
unsigned  user_seed,
double  x_min,
double  x_max,
double  y_min,
double  y_max,
double  ,
double   
)
inline

◆ Swarm() [8/8]

template<>
Portage::Meshfree::Swarm< 3 >::Swarm ( int  num_particles,
int  distribution,
unsigned  user_seed,
double  x_min,
double  x_max,
double  y_min,
double  y_max,
double  z_min,
double  z_max 
)
inline

Member Function Documentation

◆ begin()

template<int dim>
counting_iterator Portage::Meshfree::Swarm< dim >::begin ( Entity_kind const  kind = Wonton::PARTICLE,
Entity_type const  type = Wonton::ALL 
) const
inline

Get an iterator at first element of the particle field.

Parameters
kindentity kind (kept for consistency with mesh iterators)
typeentity type (kept for consistency with mesh iterators)
Returns
an iterator pointing to the first element of the particle field.

◆ end()

template<int dim>
counting_iterator Portage::Meshfree::Swarm< dim >::end ( Entity_kind const  kind = Wonton::PARTICLE,
Entity_type const  type = Wonton::ALL 
) const
inline

Get an iterator at last element of the particle field.

Parameters
kindentity kind (kept for consistency with mesh iterators)
typeentity type (kept for consistency with mesh iterators)
Returns
an iterator pointing to the last element of the particle field.

◆ extend_particle_list()

template<int dim>
void Portage::Meshfree::Swarm< dim >::extend_particle_list ( std::vector< Wonton::Point< dim >> const &  new_pts)
inline

Extend the particle field.

◆ get_particle_coordinates()

template<int dim>
Wonton::Point<dim> Portage::Meshfree::Swarm< dim >::get_particle_coordinates ( int  index) const
inline

Get the coordinates of the particle.

Parameters
indexindex of particle.
Returns
its coordinates.

◆ num_ghost_particles()

template<int dim>
int Portage::Meshfree::Swarm< dim >::num_ghost_particles ( ) const
inline

Get ghost particles count.

Returns
number of ghost particles.

◆ num_owned_particles()

template<int dim>
int Portage::Meshfree::Swarm< dim >::num_owned_particles ( ) const
inline

Get owned particles count.

Returns
number of owned particles.

◆ num_particles()

template<int dim>
int Portage::Meshfree::Swarm< dim >::num_particles ( Wonton::Entity_type  type = Wonton::ALL) const
inline

Get particles count.

Parameters
typeentity type (owned, ghost, all).
Returns
the particle count for the given entity type.

◆ space_dimension()

template<int dim>
int Portage::Meshfree::Swarm< dim >::space_dimension ( ) const
inline

Get the dimension.

Returns
the dimension.

The documentation for this class was generated from the following file:
  • /home/portage/portage/portage/swarm/swarm.h