OpenLB 1.7
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
olb::opti::GeometrySerializer< S, dim > Class Template Referenceabstract

This class serializes the cells inside the geometry. More...

#include <serialization.h>

+ Inheritance diagram for olb::opti::GeometrySerializer< S, dim >:
+ Collaboration diagram for olb::opti::GeometrySerializer< S, dim >:

Classes

struct  LatticeAndFieldR
 Bundle for lattice coordinates + field component. More...
 

Public Member Functions

virtual std::size_t getSerializedCellIndex (const int latticeR[]) const =0
 Compute serialized cell index from lattice coordinates.
 
std::size_t getSerializedCellIndex (LatticeR< dim+1 > latticeR) const
 Compute serialized cell index from lattice coordinates.
 
virtual LatticeR< dim+1 > getLatticeR (std::size_t index) const =0
 Get lattice coordinates from serialized cell index.
 
std::size_t getSerializedComponentIndex (const int latticeR[], unsigned iD, unsigned fieldDim) const
 Get index of field component from lattice coordinates and component index.
 
std::size_t getSerializedComponentIndex (LatticeR< dim+1 > latticeR, unsigned iD, unsigned fieldDim) const
 Get index of field component from lattice coordinates and component index.
 
std::size_t getSerializedComponentIndex (LatticeAndFieldR coords, unsigned fieldDim) const
 Get index of field component from lattice coordinates and component index.
 
LatticeAndFieldR getLatticeAndFieldR (std::size_t index, unsigned fieldDim) const
 Get lattice coordinates and field component from serialized field index.
 
virtual unsigned getNoCells () const =0
 

Detailed Description

template<typename S, unsigned dim>
class olb::opti::GeometrySerializer< S, dim >

This class serializes the cells inside the geometry.

Intended for creating one long vector out of field data on super level. Methods for indexing cells as well as field components are offered.

Definition at line 51 of file serialization.h.

Member Function Documentation

◆ getLatticeAndFieldR()

template<typename S , unsigned dim>
LatticeAndFieldR olb::opti::GeometrySerializer< S, dim >::getLatticeAndFieldR ( std::size_t index,
unsigned fieldDim ) const
inline

Get lattice coordinates and field component from serialized field index.

Definition at line 90 of file serialization.h.

90 {
91 // index = fieldDim * cellIndex + fieldComponent
92 const auto fieldCoord = std::div((long int) index, (long int) fieldDim);
93 const auto geomCoord = getLatticeR(fieldCoord.quot);
94 return {geomCoord, (std::size_t) fieldCoord.rem};
95 }
virtual LatticeR< dim+1 > getLatticeR(std::size_t index) const =0
Get lattice coordinates from serialized cell index.

References olb::opti::GeometrySerializer< S, dim >::getLatticeR().

+ Here is the call graph for this function:

◆ getLatticeR()

template<typename S , unsigned dim>
virtual LatticeR< dim+1 > olb::opti::GeometrySerializer< S, dim >::getLatticeR ( std::size_t index) const
pure virtual

Get lattice coordinates from serialized cell index.

Implemented in olb::opti::SimpleGeometrySerializer< S, dim >, and olb::opti::SparseGeometrySerializer< S, dim >.

+ Here is the caller graph for this function:

◆ getNoCells()

template<typename S , unsigned dim>
virtual unsigned olb::opti::GeometrySerializer< S, dim >::getNoCells ( ) const
pure virtual

◆ getSerializedCellIndex() [1/2]

template<typename S , unsigned dim>
virtual std::size_t olb::opti::GeometrySerializer< S, dim >::getSerializedCellIndex ( const int latticeR[]) const
pure virtual

Compute serialized cell index from lattice coordinates.

Implemented in olb::opti::SimpleGeometrySerializer< S, dim >, and olb::opti::SparseGeometrySerializer< S, dim >.

+ Here is the caller graph for this function:

◆ getSerializedCellIndex() [2/2]

template<typename S , unsigned dim>
std::size_t olb::opti::GeometrySerializer< S, dim >::getSerializedCellIndex ( LatticeR< dim+1 > latticeR) const
inline

Compute serialized cell index from lattice coordinates.

Definition at line 64 of file serialization.h.

64 {
65 return getSerializedCellIndex(latticeR.data());
66 }
virtual std::size_t getSerializedCellIndex(const int latticeR[]) const =0
Compute serialized cell index from lattice coordinates.

References olb::Vector< T, D >::data(), and olb::opti::GeometrySerializer< S, dim >::getSerializedCellIndex().

+ Here is the call graph for this function:

◆ getSerializedComponentIndex() [1/3]

template<typename S , unsigned dim>
std::size_t olb::opti::GeometrySerializer< S, dim >::getSerializedComponentIndex ( const int latticeR[],
unsigned iD,
unsigned fieldDim ) const
inline

Get index of field component from lattice coordinates and component index.

Definition at line 72 of file serialization.h.

73 {
74 return fieldDim * getSerializedCellIndex(latticeR) + iD;
75 }

References olb::opti::GeometrySerializer< S, dim >::getSerializedCellIndex().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSerializedComponentIndex() [2/3]

template<typename S , unsigned dim>
std::size_t olb::opti::GeometrySerializer< S, dim >::getSerializedComponentIndex ( LatticeAndFieldR coords,
unsigned fieldDim ) const
inline

Get index of field component from lattice coordinates and component index.

Definition at line 84 of file serialization.h.

85 {
86 return getSerializedComponentIndex(coords.latticeR, coords.fieldComponent, fieldDim);
87 }
std::size_t getSerializedComponentIndex(const int latticeR[], unsigned iD, unsigned fieldDim) const
Get index of field component from lattice coordinates and component index.

References olb::opti::GeometrySerializer< S, dim >::LatticeAndFieldR::fieldComponent, olb::opti::GeometrySerializer< S, dim >::getSerializedComponentIndex(), and olb::opti::GeometrySerializer< S, dim >::LatticeAndFieldR::latticeR.

+ Here is the call graph for this function:

◆ getSerializedComponentIndex() [3/3]

template<typename S , unsigned dim>
std::size_t olb::opti::GeometrySerializer< S, dim >::getSerializedComponentIndex ( LatticeR< dim+1 > latticeR,
unsigned iD,
unsigned fieldDim ) const
inline

Get index of field component from lattice coordinates and component index.

Definition at line 78 of file serialization.h.

79 {
80 return fieldDim * getSerializedCellIndex(latticeR) + iD;
81 }

References olb::opti::GeometrySerializer< S, dim >::getSerializedCellIndex().

+ Here is the call graph for this function:

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