OpenLB 1.7
Searching...
No Matches
olb::SuperVarianceF3D< T, W > Class Template Referencefinal

SuperVarianceF3D returns the Variance in each component of f on a indicated subset calcutalted with Steiner translation theorem. More...

`#include <superStatisticF3D.h>`

Inheritance diagram for olb::SuperVarianceF3D< T, W >:
Collaboration diagram for olb::SuperVarianceF3D< T, W >:

## Public Member Functions

SuperVarianceF3D (FunctorPtr< SuperF3D< T, W > > &&f, SuperGeometry< T, 3 > &superGeometry, const int material, T expectedValue)
Constructor for determining the standard deviation of f on a indicated subset.

SuperVarianceF3D (FunctorPtr< SuperF3D< T, W > > &&f, FunctorPtr< SuperIndicatorF3D< T > > &&indicatorF, T expectedValue)

bool operator() (W output[], const int input[]) override
Global average operator.

Public Member Functions inherited from olb::SuperF3D< T, W >
SuperF3D< T, W > & operator- (SuperF3D< T, W > &rhs)

SuperF3D< T, W > & operator+ (SuperF3D< T, W > &rhs)

SuperF3D< T, W > & operator* (SuperF3D< T, W > &rhs)

SuperF3D< T, W > & operator/ (SuperF3D< T, W > &rhs)

SuperStructure< T, 3 > & getSuperStructure ()

int getBlockFSize () const

BlockF3D< W > & getBlockF (int iCloc)

bool operator() (W output[], const int input[])

Public Member Functions inherited from olb::GenericF< T, S >
virtual ~GenericF ()=default

int getSourceDim () const

int getTargetDim () const

std::string & getName ()

std::string const & getName () const

virtual bool operator() (T output[], const S input[])=0
has to be implemented for 'every' derived class

bool operator() (T output[])
wrapper that call the pure virtual operator() (T output[], const S input[]) from above

bool operator() (T output[], S input0)

bool operator() (T output[], S input0, S input1)

bool operator() (T output[], S input0, S input1, S input2)

bool operator() (T output[], S input0, S input1, S input2, S input3)

Public Types inherited from olb::SuperF3D< T, W >
using identity_functor_type = SuperIdentity3D<T,W>

Public Types inherited from olb::GenericF< T, S >
using targetType = T

using sourceType = S

Public Attributes inherited from olb::GenericF< T, S >
std::shared_ptr< GenericF< T, S > > _ptrCalcC
memory management, frees resouces (calcClass)

Static Public Attributes inherited from olb::SuperF3D< T, W >
static constexpr bool isSuper = true

static constexpr unsigned d = 3

Protected Member Functions inherited from olb::SuperF3D< T, W >
SuperF3D (SuperStructure< T, 3 > &superStructure, int targetDim)

Protected Member Functions inherited from olb::GenericF< T, S >
GenericF (int targetDim, int sourceDim)

Protected Attributes inherited from olb::SuperF3D< T, W >
SuperStructure< T, 3 > & _superStructure

std::vector< std::unique_ptr< BlockF3D< W > > > _blockF
Super functors may consist of several BlockF3D<W> derived functors.

## Detailed Description

template<typename T, typename W = T>
class olb::SuperVarianceF3D< T, W >

SuperVarianceF3D returns the Variance in each component of f on a indicated subset calcutalted with Steiner translation theorem.

Definition at line 37 of file superStatisticF3D.h.

## ◆ SuperVarianceF3D() [1/2]

template<typename T , typename W >
 olb::SuperVarianceF3D< T, W >::SuperVarianceF3D ( FunctorPtr< SuperF3D< T, W > > && f, SuperGeometry< T, 3 > & superGeometry, const int material, T expectedValue )

Constructor for determining the standard deviation of f on a indicated subset.

Parameters
 f functor of which the standard deviation is to be determined indicatorF indicator describing the subset on which to evaluate f Constructor for determining the standard deviation of f on a given material f functor of which the average is to be determined superGeometry super geometry for constructing material indicator material number of the relevant material

Definition at line 61 of file superStatisticF3D.hh.

66 std::forward<decltype(f)>(f),
67 superGeometry.getMaterialIndicator(material),
68 expectedValue)
69{ }
std::unique_ptr< SuperIndicatorF< T, D > > getMaterialIndicator(std::vector< int > &&materials)
Returns a material indicator using the given vector of materials.
SuperVarianceF3D(FunctorPtr< SuperF3D< T, W > > &&f, SuperGeometry< T, 3 > &superGeometry, const int material, T expectedValue)
Constructor for determining the standard deviation of f on a indicated subset.

## ◆ SuperVarianceF3D() [2/2]

template<typename T , typename W >
 olb::SuperVarianceF3D< T, W >::SuperVarianceF3D ( FunctorPtr< SuperF3D< T, W > > && f, FunctorPtr< SuperIndicatorF3D< T > > && indicatorF, T expectedValue )

Definition at line 34 of file superStatisticF3D.hh.

37 : SuperF3D<T,W>(f->getSuperStructure(), f->getTargetDim()+1),
38 _f(std::move(f)),
39 _indicatorF(std::move(indicatorF)),
40 _expectedValue(expectedValue)
41{
42 this->getName() = "Variance("+_f->getName()+")";
43
45 CuboidGeometry3D<T>& cuboid = _f->getSuperStructure().getCuboidGeometry();
46
47 if ( _f->getBlockFSize() == load.size() &&
48 _indicatorF->getBlockFSize() == load.size() ) {
49 for (int iC = 0; iC < load.size(); ++iC) {
50 this->_blockF.emplace_back(
51 new BlockVarianceF3D<T,W>(_f->getBlockF(iC),
52 _indicatorF->getBlockIndicatorF(iC),
54 _expectedValue)
55 );
56 }
57 }
58}
std::string & getName()
Definition genericF.hh:51
std::vector< std::unique_ptr< BlockF3D< W > > > _blockF
Super functors may consist of several BlockF3D<W> derived functors.
Here is the call graph for this function:

## ◆ operator()()

template<typename T , typename W >
 bool olb::SuperVarianceF3D< T, W >::operator() ( W output[], const int input[] )
override

Global average operator.

Note: While this functor exposes BlockStdDeviation3D functors if possible, a call to this function will not use them but calculate the global standard deviation by summing all components and voxel counts. Calling BlockStdDevation3D in this situation would unnecessarily complicate this as we would have to weight the aggregated averages according to their share in the global average.

Definition at line 72 of file superStatisticF3D.hh.

73{
74 _f->getSuperStructure().communicate();
75 CuboidGeometry3D<T>& geometry = _f->getSuperStructure().getCuboidGeometry();
77
78 std::size_t voxels(0);
79
80 for (int i = 0; i <= _f->getTargetDim(); ++i) {
81 output[i] = W(0);
82 }
83
84 if (this->_blockF.empty()) {
85 W outputTmp[_f->getTargetDim()];
86 for(unsigned i=0; i<_f->getTargetDim(); ++i) {
87 outputTmp[i] = W(0);
88 }
89 int inputTmp[_f->getSourceDim()];
90
91 for (int iC = 0; iC < load.size(); ++iC) {
92 const Cuboid3D<T> cuboid = geometry.get(load.glob(iC));
94 for (inputTmp[1] = 0; inputTmp[1] < cuboid.getNx(); ++inputTmp[1]) {
95 for (inputTmp[2] = 0; inputTmp[2] < cuboid.getNy(); ++inputTmp[2]) {
96 for (inputTmp[3] = 0; inputTmp[3] < cuboid.getNz(); ++inputTmp[3]) {
97 if (_indicatorF(inputTmp)) {
98 _f(outputTmp,inputTmp);
99 for (int i = 0; i < _f->getTargetDim(); ++i) {
100 output[i] += util::pow(outputTmp[i] - _expectedValue, 2);
101 }
102 voxels += 1;
103 }
104 }
105 }
106 }
107 output[_f->getTargetDim()] += voxels;
108 }
109 }
110 else {
111 for (int iC = 0; iC < load.size(); ++iC) {
112 this->getBlockF(iC)(output, input);
113 }
114 }
115
116#ifdef PARALLEL_MODE_MPI
117 for (int i = 0; i <= this->getTargetDim(); ++i) {
118 singleton::mpi().reduceAndBcast(output[i], MPI_SUM);
119 }
120#endif
121
122 for (int i = 0; i < _f->getTargetDim(); ++i) {
123 output[i] = output[i] / output[_f->getTargetDim()];
124 }
125
126 return true;
127}
int getTargetDim() const