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

Particle field state class. More...

#include <swarm_state.h>

Public Member Functions

 SwarmState ()=default
 Create an empty state. More...
 
 SwarmState (Swarm< dim > const &swarm)
 Initialize from a reference swarm. More...
 
 SwarmState (int size)
 Initialize with a field size. More...
 
template<typename State >
 SwarmState (State const &state, Wonton::Entity_kind kind)
 Create the swarm state from a given mesh state wrapper. More...
 
template<typename State >
 SwarmState (std::vector< State *> const &states, Wonton::Entity_kind kind)
 Create the swarm state from set of mesh states wrappers. More...
 
 ~SwarmState ()=default
 Destructor. More...
 
template<typename T = double>
void add_field (std::string name, Portage::vector< T > const &value)
 Set a field on the swarm. More...
 
template<typename T = double>
void add_field (std::string name, const T *const value)
 Set a field on the swarm. More...
 
template<typename T = double>
void add_field (std::string name, T value)
 Set an empty field on the swarm. More...
 
Portage::vector< int > & get_field_int (std::string name) const
 Retrieve a specified integer field. More...
 
Portage::vector< double > & get_field_dbl (std::string name) const
 Retrieve a specified real field. More...
 
Portage::vector< double > & get_field (std::string name) const
 
template<typename T = double>
void copy_field (std::string name, T *value)
 Retrieve the specified field. More...
 
int get_size ()
 Get number of particles. More...
 
template<typename T = double>
std::vector< std::string > get_field_names ()
 Retrieve the list of field names. More...
 
template<typename T >
void extend_field (std::string name, Portage::vector< T > const &values)
 Extend the field with the given subfield. More...
 

Detailed Description

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

Particle field state class.

Template Parameters
dimthe dimension of the problem.

Constructor & Destructor Documentation

◆ SwarmState() [1/5]

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

Create an empty state.

◆ SwarmState() [2/5]

template<int dim>
Portage::Meshfree::SwarmState< dim >::SwarmState ( Swarm< dim > const &  swarm)
inlineexplicit

Initialize from a reference swarm.

Parameters
swarmthe swarm with which the field data are associated.

◆ SwarmState() [3/5]

template<int dim>
Portage::Meshfree::SwarmState< dim >::SwarmState ( int  size)
inlineexplicit

Initialize with a field size.

Parameters
sizesize of each field.

◆ SwarmState() [4/5]

template<int dim>
template<typename State >
Portage::Meshfree::SwarmState< dim >::SwarmState ( State const &  state,
Wonton::Entity_kind  kind 
)
inline

Create the swarm state from a given mesh state wrapper.

Copies fields from mesh state wrapper to the current swarm state of the same size. It works only for double precision floating-point fields.

Template Parameters
Statetype of the mesh state wrapper.
Parameters
statethe mesh state wrapper.
kindthe entity kind to consider (node, cell).

◆ SwarmState() [5/5]

template<int dim>
template<typename State >
Portage::Meshfree::SwarmState< dim >::SwarmState ( std::vector< State *> const &  states,
Wonton::Entity_kind  kind 
)
inline

Create the swarm state from set of mesh states wrappers.

Copies fields from mesh state wrappers to the current swarm state of the same total size. It is useful for mapping from several meshes at once, e.g. for analysis of multiple times, or multiple simulations at the same set of spatial points, to obtain statistical properties like average, confidence bounds, and uncertaintities, for example. It works only for double precision floating-point fields.

Template Parameters
Statetype of the mesh state wrapper.
Parameters
statea list of mesh states wrappers.
kindthe entity kind to consider (node, cell).

◆ ~SwarmState()

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

Destructor.

Member Function Documentation

◆ add_field() [1/3]

template<int dim>
template<typename T = double>
void Portage::Meshfree::SwarmState< dim >::add_field ( std::string  name,
Portage::vector< T > const &  value 
)
inline

Set a field on the swarm.

Template Parameters
Tfield values type (int, double)
Parameters
namefield name.
valuefield values list.

◆ add_field() [2/3]

template<int dim>
template<typename T = double>
void Portage::Meshfree::SwarmState< dim >::add_field ( std::string  name,
const T *const  value 
)
inline

Set a field on the swarm.

Template Parameters
Tfield values type (int, double)
Parameters
namefield name.
valuefield values array.

◆ add_field() [3/3]

template<int dim>
template<typename T = double>
void Portage::Meshfree::SwarmState< dim >::add_field ( std::string  name,
value 
)
inline

Set an empty field on the swarm.

Template Parameters
Tfield values type (int, double)
Parameters
namefield name.
valuedefault field elements value.

◆ copy_field()

template<int dim>
template<typename T = double>
void Portage::Meshfree::SwarmState< dim >::copy_field ( std::string  name,
T *  value 
)
inline

Retrieve the specified field.

Parameters
namefield name.
valuea pointer to field values.

◆ extend_field()

template<int dim>
template<typename T >
void Portage::Meshfree::SwarmState< dim >::extend_field ( std::string  name,
Portage::vector< T > const &  values 
)
inline

Extend the field with the given subfield.

Template Parameters
Tfield values type (int or double).
Parameters
namename of the field to update.
valuesthe subfield to add.

◆ get_field()

template<int dim>
Portage::vector<double>& Portage::Meshfree::SwarmState< dim >::get_field ( std::string  name) const
inline
Parameters
name
Returns

◆ get_field_dbl()

template<int dim>
Portage::vector<double>& Portage::Meshfree::SwarmState< dim >::get_field_dbl ( std::string  name) const
inline

Retrieve a specified real field.

One cannot specialize template method without specializing the template class, so just revert to plain untemplated methods.

Parameters
namethe name of the integer field
Returns
value the values in the field

◆ get_field_int()

template<int dim>
Portage::vector<int>& Portage::Meshfree::SwarmState< dim >::get_field_int ( std::string  name) const
inline

Retrieve a specified integer field.

One cannot specialize template method without specializing the template class, so just revert to plain untemplated methods.

Parameters
namethe name of the integer field
Returns
value the values in the field

◆ get_field_names()

template<int dim>
template<typename T = double>
std::vector<std::string> Portage::Meshfree::SwarmState< dim >::get_field_names ( )
inline

Retrieve the list of field names.

Template Parameters
Tfield values type (int or double)
Returns
the list of field names

◆ get_size()

template<int dim>
int Portage::Meshfree::SwarmState< dim >::get_size ( )
inline

Get number of particles.

Returns
the number of particles of the swarm.

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