OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
olb::Cell< T, DESCRIPTOR > Class Template Reference

Highest-level interface to Cell data. More...

#include <cell.h>

+ Inheritance diagram for olb::Cell< T, DESCRIPTOR >:
+ Collaboration diagram for olb::Cell< T, DESCRIPTOR >:

Public Member Functions

 Cell (BlockLattice< T, DESCRIPTOR > &block, std::size_t iCell)
 
Cell< T, DESCRIPTOR > neighbor (Vector< int, DESCRIPTOR::d > c)
 
T & operator[] (unsigned iPop)
 Read-write access to distribution functions.
 
template<typename FIELD >
auto getFieldPointer (FIELD field=FIELD())
 Return field accessor.
 
template<typename FIELD >
void setField (const FieldD< T, DESCRIPTOR, FIELD > &field)
 Set value of FIELD from a vector.
 
template<typename FIELD >
std::enable_if_t<(DESCRIPTOR::template size< FIELD >()==1), void > setField (typename FIELD::template value_type< T > value)
 Set value of FIELD from a scalar.
 
template<typename FIELD >
void setFieldComponent (unsigned iD, typename FIELD::template value_type< T > value)
 
Dynamics< T, DESCRIPTOR > * getDynamics ()
 Get a pointer to the dynamics.
 
void revert ()
 Revert ("bounce-back") the distribution functions.
 
CellStatistic< T > collide ()
 Apply LB collision to the cell according to local dynamics.
 
void defineRho (T rho)
 Set density on the cell.
 
void defineU (const T u[descriptors::d< DESCRIPTOR >()])
 Set fluid velocity on the cell.
 
void defineRhoU (T rho, const T u[descriptors::d< DESCRIPTOR >()])
 Define fluid velocity and particle density on the cell.
 
void definePopulations (const T *f_)
 Define particle populations through the dynamics object.
 
void iniEquilibrium (T rho, const T u[descriptors::d< DESCRIPTOR >()])
 Initialize all f values to their local equilibrium.
 
void iniRegularized (T rho, const T u[descriptors::d< DESCRIPTOR >()], const T pi[util::TensorVal< DESCRIPTOR >::n])
 Initialize all f values with local equilibrium and non equilibrium part.
 
- Public Member Functions inherited from olb::ConstCell< T, DESCRIPTOR >
 ConstCell (const BlockLattice< T, DESCRIPTOR > &block, std::size_t iCell)
 
std::size_t getCellId () const
 Return memory ID of the currently represented cell.
 
void setCellId (std::size_t iCell)
 Jump to arbitrary cell memory ID.
 
bool operator== (ConstCell< T, DESCRIPTOR > &rhs) const
 
bool operator!= (ConstCell< T, DESCRIPTOR > &rhs) const
 
bool operator< (ConstCell< T, DESCRIPTOR > &rhs) const
 
bool operator<= (ConstCell< T, DESCRIPTOR > &rhs) const
 
ConstCell< T, DESCRIPTOR > neighbor (Vector< int, DESCRIPTOR::d > c) const
 
operator[] (unsigned iPop) const
 Read-only access to distribution functions.
 
template<typename FIELD >
auto getFieldPointer (FIELD field=FIELD()) const
 Return read-only field accessor.
 
template<typename FIELD >
auto getFieldComponent (unsigned iD) const
 Return copy of field component.
 
template<typename FIELD >
auto getField (FIELD field=FIELD()) const
 Return copy of descriptor-declared FIELD as a vector.
 
const Dynamics< T, DESCRIPTOR > * getDynamics () const
 Get a pointer to the dynamics.
 
template<typename FIELD >
void computeField (T *data) const
 Copy FIELD content to given memory location.
 
computeRho () const
 Compute particle density on the cell.
 
void computeU (T u[descriptors::d< DESCRIPTOR >()]) const
 Compute fluid velocity on the cell.
 
void computeJ (T j[descriptors::d< DESCRIPTOR >()]) const
 Compute fluid momentum (j = rho * u) on the cell.
 
void computeStress (T pi[util::TensorVal< DESCRIPTOR >::n]) const
 Compute components of the stress tensor on the cell.
 
void computeRhoU (T &rho, T u[descriptors::d< DESCRIPTOR >()]) const
 Compute fluid velocity and particle density on the cell.
 
void computeFeq (T fEq[descriptors::q< DESCRIPTOR >()]) const
 Compute equilibrium part of cell distribution.
 
void computeFneq (T fNeq[descriptors::q< DESCRIPTOR >()]) const
 Compute non-equilibrium part of cell distribution.
 
void computeAllMomenta (T &rho, T u[descriptors::d< DESCRIPTOR >()], T pi[util::TensorVal< DESCRIPTOR >::n]) const
 Compute all momenta on the celll, up to second order.
 

Additional Inherited Members

- Public Types inherited from olb::ConstCell< T, DESCRIPTOR >
using value_t = T
 
using descriptor_t = DESCRIPTOR
 
- Protected Attributes inherited from olb::ConstCell< T, DESCRIPTOR >
friend Cell< T, DESCRIPTOR >
 
std::size_t _iCell
 Memory ID of currently represented cell.
 
BlockLattice< T, DESCRIPTOR > & _block
 Underlying BlockLattice.
 
Vector< T *, DESCRIPTOR::q > _populations
 Pointers to population values of current cell.
 

Detailed Description

template<typename T, typename DESCRIPTOR>
class olb::Cell< T, DESCRIPTOR >

Highest-level interface to Cell data.

Definition at line 148 of file cell.h.

Constructor & Destructor Documentation

◆ Cell()

template<typename T , typename DESCRIPTOR >
olb::Cell< T, DESCRIPTOR >::Cell ( BlockLattice< T, DESCRIPTOR > & block,
std::size_t iCell )
inline

Definition at line 150 of file cell.h.

151 :
152 ConstCell<T,DESCRIPTOR>(block, iCell)
153 { }

Member Function Documentation

◆ collide()

template<typename T , typename DESCRIPTOR >
CellStatistic< T > olb::Cell< T, DESCRIPTOR >::collide ( )

Apply LB collision to the cell according to local dynamics.

Definition at line 200 of file cell.hh.

201{
202 return getDynamics()->collide(*this);
203}
Dynamics< T, DESCRIPTOR > * getDynamics()
Get a pointer to the dynamics.
Definition cell.hh:174

◆ definePopulations()

template<typename T , typename DESCRIPTOR >
void olb::Cell< T, DESCRIPTOR >::definePopulations ( const T * f_)

Define particle populations through the dynamics object.

Definition at line 286 of file cell.hh.

287{
288 for (int iPop = 0; iPop < descriptors::q<DESCRIPTOR>(); ++iPop) {
289 operator[](iPop) = data[iPop];
290 }
291}
T & operator[](unsigned iPop)
Read-write access to distribution functions.
Definition cell.hh:108

◆ defineRho()

template<typename T , typename DESCRIPTOR >
void olb::Cell< T, DESCRIPTOR >::defineRho ( T rho)

Set density on the cell.

Definition at line 268 of file cell.hh.

269{
270 getDynamics()->defineRho(*this, rho);
271}

◆ defineRhoU()

template<typename T , typename DESCRIPTOR >
void olb::Cell< T, DESCRIPTOR >::defineRhoU ( T rho,
const T u[descriptors::d< DESCRIPTOR >()] )

Define fluid velocity and particle density on the cell.

Definition at line 280 of file cell.hh.

281{
282 getDynamics()->defineRhoU(*this, rho, u);
283}

◆ defineU()

template<typename T , typename DESCRIPTOR >
void olb::Cell< T, DESCRIPTOR >::defineU ( const T u[descriptors::d< DESCRIPTOR >()])

Set fluid velocity on the cell.

Definition at line 274 of file cell.hh.

275{
276 getDynamics()->defineU(*this, u);
277}

◆ getDynamics()

template<typename T , typename DESCRIPTOR >
Dynamics< T, DESCRIPTOR > * olb::Cell< T, DESCRIPTOR >::getDynamics ( )

Get a pointer to the dynamics.

Definition at line 174 of file cell.hh.

175{
176 return this->_block.getDynamics(this->_iCell);
177}
BlockLattice< T, DESCRIPTOR > & _block
Underlying BlockLattice.
Definition cell.h:63
std::size_t _iCell
Memory ID of currently represented cell.
Definition cell.h:61
+ Here is the caller graph for this function:

◆ getFieldPointer()

template<typename T , typename DESCRIPTOR >
template<typename FIELD >
auto olb::Cell< T, DESCRIPTOR >::getFieldPointer ( FIELD field = FIELD())

Return field accessor.

Definition at line 73 of file cell.hh.

74{
75 static_assert(descriptors::is_data_field<FIELD>::value,
76 "FIELD must be structured data field");
77 return this->_block.template getField<FIELD>().getPointer(this->_iCell);
78}

◆ iniEquilibrium()

template<typename T , typename DESCRIPTOR >
void olb::Cell< T, DESCRIPTOR >::iniEquilibrium ( T rho,
const T u[descriptors::d< DESCRIPTOR >()] )

Initialize all f values to their local equilibrium.

Definition at line 294 of file cell.hh.

295{
296 getDynamics()->iniEquilibrium(*this, rho, u);
297}

◆ iniRegularized()

template<typename T , typename DESCRIPTOR >
void olb::Cell< T, DESCRIPTOR >::iniRegularized ( T rho,
const T u[descriptors::d< DESCRIPTOR >()],
const T pi[util::TensorVal< DESCRIPTOR >::n] )

Initialize all f values with local equilibrium and non equilibrium part.

Definition at line 300 of file cell.hh.

304{
305 getDynamics()->iniRegularized(*this, rho, u, pi);
306}

◆ neighbor()

template<typename T , typename DESCRIPTOR >
Cell< T, DESCRIPTOR > olb::Cell< T, DESCRIPTOR >::neighbor ( Vector< int, DESCRIPTOR::d > c)

Definition at line 96 of file cell.hh.

97{
98 return Cell<T,DESCRIPTOR>(this->_block, this->_iCell + this->_block.getNeighborDistance(c));
99}
friend Cell< T, DESCRIPTOR >
Definition cell.h:58

◆ operator[]()

template<typename T , typename DESCRIPTOR >
T & olb::Cell< T, DESCRIPTOR >::operator[] ( unsigned iPop)

Read-write access to distribution functions.

Parameters
iPopindex of the accessed distribution function

Definition at line 108 of file cell.hh.

109{
110 return *this->_populations[iPop];
111}
Vector< T *, DESCRIPTOR::q > _populations
Pointers to population values of current cell.
Definition cell.h:74

◆ revert()

template<typename T , typename DESCRIPTOR >
void olb::Cell< T, DESCRIPTOR >::revert ( )

Revert ("bounce-back") the distribution functions.

Definition at line 190 of file cell.hh.

191{
192 for (int iPop=1; iPop <= descriptors::q<DESCRIPTOR>()/2; ++iPop) {
193 std::swap(
194 operator[](iPop),
195 operator[](iPop+descriptors::q<DESCRIPTOR>()/2));
196 }
197}
+ Here is the caller graph for this function:

◆ setField() [1/2]

template<typename T , typename DESCRIPTOR >
template<typename FIELD >
void olb::Cell< T, DESCRIPTOR >::setField ( const FieldD< T, DESCRIPTOR, FIELD > & field)

Set value of FIELD from a vector.

Definition at line 146 of file cell.hh.

147{
148 return this->_block.template getField<FIELD>().set(this->_iCell, field);
149}

◆ setField() [2/2]

template<typename T , typename DESCRIPTOR >
template<typename FIELD >
std::enable_if_t<(DESCRIPTOR::template size< FIELD >()==1), void > olb::Cell< T, DESCRIPTOR >::setField ( typename FIELD::template value_type< T > value)

Set value of FIELD from a scalar.

Definition at line 154 of file cell.hh.

155{
156 return this->_block.template getField<FIELD>().set(this->_iCell,
157 FieldD<T,DESCRIPTOR,FIELD>(value));
158}

◆ setFieldComponent()

template<typename T , typename DESCRIPTOR >
template<typename FIELD >
void olb::Cell< T, DESCRIPTOR >::setFieldComponent ( unsigned iD,
typename FIELD::template value_type< T > value )

Definition at line 162 of file cell.hh.

163{
164 this->_block.template getField<FIELD>()[iD][this->_iCell] = value;
165}
typename std::integral_constant< TYPE, VALUE >::type value
Identity type to wrap non-type template arguments.
Definition meta.h:96

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