LCS::Position< T, Dim > Class Template Reference

Field of particle positions. More...

#include <field.hpp>

Public Types

using vec = LCS::Vector< T, Dim >
 

Public Member Functions

 Position (unsigned nx, unsigned ny)
 
void SetAll (const std::vector< T > &xrange, const std::vector< T > &yrange)
 
void SetAll (const T &xmin, const T &xmax, const T &ymin, const T &ymax)
 
void SetAll (Tensor< vec, Dim > &data)
 
auto Get (const unsigned i, const unsigned j) const
 
auto & GetRange (const unsigned axis)
 
void Update (Velocity< T, Dim > &vel, T delta)
 
void InitializeOutOfBoundTensor ()
 
bool IsOutOfBound (const unsigned i, const unsigned j)
 
void SetBound (const T &xmin, const T &xmax, const T &ymin, const T &ymax)
 
- Public Member Functions inherited from LCS::Field< T, Dim, Dim >
 Field (unsigned nx, unsigned ny)
 
auto & GetAll () const
 
auto GetTime () const
 
void ReadFromFile (const std::string &file_name)
 
void SetAll (Tensor< Vector< T, Size >, Dim > &data)
 
void UpdateTime (const T time)
 
void WriteToFile (const std::string &file_name) const
 

Additional Inherited Members

- Protected Attributes inherited from LCS::Field< T, Dim, Dim >
const unsigned nx_
 
const unsigned ny_
 
Tensor< Vector< T, Size >, Dim > data_
 
time_
 

Detailed Description

template<typename T, unsigned Dim>
class LCS::Position< T, Dim >

Field of particle positions.

This class is used for representing positions (displacements) of particles. It is a subclass of Field.

Template Parameters
TNumeric data type of the field.
DimDimension of the field (2 or 3).
Inheritance diagram for LCS::Position< T, Dim >:
LCS::Field< T, Dim, Dim >

Constructor & Destructor Documentation

template<typename T , unsigned Dim>
LCS::Position< T, Dim >::Position ( unsigned  nx,
unsigned  ny 
)
inline

Constructor for initializating the position field.

Parameters
nxThe number of points in $x$-direction.
nyThe number of points in $y$-direction.

Member Function Documentation

template<typename T , unsigned Dim>
auto LCS::Position< T, Dim >::Get ( const unsigned  i,
const unsigned  j 
) const
inline

Get the positions of a grid point.

Parameters
iIndex in $x$-coordinate.
jIndex in $y$-coordinate.
Returns
Tuple contains $x$- and $y$-coordinates of a given grid point.
template<typename T , unsigned Dim>
auto& LCS::Position< T, Dim >::GetRange ( const unsigned  axis)
inline

Get the range of coordinates for a given axis.

Parameters
axisInteger that represents an axis (0 for $x$-axis, 1 for $y$-axis).
template<typename T , unsigned Dim>
void LCS::Position< T, Dim >::InitializeOutOfBoundTensor ( )
inline

Initialize the Tensor that contains out-of-bound information. All points are assumed to be inside the boundary.

template<typename T , unsigned Dim>
bool LCS::Position< T, Dim >::IsOutOfBound ( const unsigned  i,
const unsigned  j 
)
inline

Check if a point is out of the boundary.

Parameters
iIndex in $x$-coordinate.
jIndex in $y$-coordinate.
Returns
A bool that shows if the point is out of boundary.
template<typename T , unsigned Dim>
void LCS::Position< T, Dim >::SetAll ( const std::vector< T > &  xrange,
const std::vector< T > &  yrange 
)
inline

Set data values of the field using $x$- and $y$-coordinates. The grid is assumed to be a Cartesian grid when using this function. This is an overloaded function.

Parameters
xrangeVector that contains $x$-coordinates of the grid.
yrangeVector that contains $y$-coordinates of the grid.
template<typename T , unsigned Dim>
void LCS::Position< T, Dim >::SetAll ( const T &  xmin,
const T &  xmax,
const T &  ymin,
const T &  ymax 
)
inline

Set data values of the field using the coordinates of end points. The grid is assumed to be an uniform Cartesian grid when using this function. This is a overloaded function.

Parameters
xminThe minimum $x$-coordinate.
xmaxThe maximum $x$-coordinate.
yminThe minimum $y$-coordinate.
ymaxThe maximum $y$-coordinate.
template<typename T , unsigned Dim>
void LCS::Position< T, Dim >::SetAll ( Tensor< vec, Dim > &  data)
inline

Set data values of the field. This function would class the function with the same name in the base class.

template<typename T , unsigned Dim>
void LCS::Position< T, Dim >::SetBound ( const T &  xmin,
const T &  xmax,
const T &  ymin,
const T &  ymax 
)
inline

Set the out boundary of the field.

Parameters
xminThe minimum $x$-coordinate of the out boundary.
xmaxThe maximum $x$-coordinate of the out boundary.
yminThe minimum $y$-coordinate of the out boundary.
ymaxThe maximum $y$-coordinate of the out boundary.
template<typename T , unsigned Dim>
void LCS::Position< T, Dim >::Update ( Velocity< T, Dim > &  vel,
delta 
)
inline

Update positions of each grid point using a velocity field. OpenMP is used here for accelerating the calculations.

Parameters
velVelocity field contains the velocity information of each grid point.
deltaTime step for updating the positions.

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