LCS::Field< T, Dim, Size > Class Template Reference

Class for general physical fields. More...

#include <field.hpp>

Public Member Functions

 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
 

Protected Attributes

const unsigned nx_
 
const unsigned ny_
 
Tensor< Vector< T, Size >, Dim > data_
 
time_
 

Friends

struct FieldPolicy< T, Dim, Size >
 

Detailed Description

template<typename T, unsigned Dim = 2, unsigned Size = 2>
class LCS::Field< T, Dim, Size >

Class for general physical fields.

This class is used for representing scalar or vector fields, such as displacement and velocity fields.

Template Parameters
TNumeric data type of the field.
DimDimension of the field (2 or 3).
SizeLength of the vector aassociated with each point in the field (e.g. 1 for scalar fields).

Constructor & Destructor Documentation

template<typename T, unsigned Dim = 2, unsigned Size = 2>
LCS::Field< T, Dim, Size >::Field ( unsigned  nx,
unsigned  ny 
)
inline

Constructor for initializating the Field.

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

Member Function Documentation

template<typename T, unsigned Dim = 2, unsigned Size = 2>
auto& LCS::Field< T, Dim, Size >::GetAll ( ) const
inline

Get all data values of the Field.

Returns
A Tensor containing all data values of the Field.
template<typename T, unsigned Dim = 2, unsigned Size = 2>
auto LCS::Field< T, Dim, Size >::GetTime ( ) const
inline

Get the time associated with the Field.

Returns
Time of the Field.
template<typename T, unsigned Dim = 2, unsigned Size = 2>
void LCS::Field< T, Dim, Size >::ReadFromFile ( const std::string &  file_name)
inline

Read data from a file.

Parameters
file_nameInput data file name.
template<typename T, unsigned Dim = 2, unsigned Size = 2>
void LCS::Field< T, Dim, Size >::SetAll ( Tensor< Vector< T, Size >, Dim > &  data)
inline

Set all data vlues of the Field with an existing Tensor.

Parameters
dataInput Tensor.
template<typename T, unsigned Dim = 2, unsigned Size = 2>
void LCS::Field< T, Dim, Size >::UpdateTime ( const T  time)
inline

Update the time associated with the Field.

Parameters
timeNew time for the Field.
template<typename T, unsigned Dim = 2, unsigned Size = 2>
void LCS::Field< T, Dim, Size >::WriteToFile ( const std::string &  file_name) const
inline

Write data to a file.

Parameters
file_nameOutput data file name.

Member Data Documentation

template<typename T, unsigned Dim = 2, unsigned Size = 2>
Tensor<Vector<T, Size>, Dim> LCS::Field< T, Dim, Size >::data_
protected

Tensor containing all Field data values.

template<typename T, unsigned Dim = 2, unsigned Size = 2>
const unsigned LCS::Field< T, Dim, Size >::nx_
protected

Number of grid points in $x$-direction.

template<typename T, unsigned Dim = 2, unsigned Size = 2>
const unsigned LCS::Field< T, Dim, Size >::ny_
protected

Number of grid points in $y$-direction.

template<typename T, unsigned Dim = 2, unsigned Size = 2>
T LCS::Field< T, Dim, Size >::time_
protected

Time of the Field.


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