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

Functor that returns the Lp norm over omega of the the euklid norm of the input functor. More...

#include <superLpNorm3D.h>

+ Inheritance diagram for olb::SuperLpNorm3D< T, W, P >:
+ Collaboration diagram for olb::SuperLpNorm3D< T, W, P >:

Public Member Functions

 SuperLpNorm3D (FunctorPtr< SuperF3D< T, W > > &&f, FunctorPtr< SuperIndicatorF3D< T > > &&indicatorF)
 
 SuperLpNorm3D (FunctorPtr< SuperF3D< T, W > > &&f, SuperGeometry< T, 3 > &, FunctorPtr< SuperIndicatorF3D< T > > &&indicatorF)
 Legacy constructor accepting super geometry reference.
 
 SuperLpNorm3D (FunctorPtr< SuperF3D< T, W > > &&f, SuperGeometry< T, 3 > &geometry, std::vector< int > materials)
 
 SuperLpNorm3D (FunctorPtr< SuperF3D< T, W > > &&f, SuperGeometry< T, 3 > &geometry, int material)
 
bool operator() (W output[], const int input[]) override
 has to be implemented for 'every' derived class
 
- 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)
 
- Public Member Functions inherited from olb::GenericF< W, int >
virtual ~GenericF ()=default
 
int getSourceDim () const
 read only access to member variable _m
 
int getTargetDim () const
 read only access to member variable _n
 
std::string & getName ()
 read and write access to name
 
std::string const & getName () const
 read only access to name
 
bool operator() (W output[])
 wrapper that call the pure virtual operator() (T output[], const S input[]) from above
 
bool operator() (W output[], int input0)
 
bool operator() (W output[], int input0, int input1)
 
bool operator() (W output[], int input0, int input1, int input2)
 
bool operator() (W output[], int input0, int input1, int input2, int input3)
 

Additional Inherited Members

- Public Types inherited from olb::SuperF3D< T, W >
using identity_functor_type
 
- Public Types inherited from olb::GenericF< W, int >
using targetType
 
using sourceType
 
- Public Attributes inherited from olb::GenericF< W, int >
std::shared_ptr< GenericF< W, int > > _ptrCalcC
 memory management, frees resouces (calcClass)
 
- Static Public Attributes inherited from olb::SuperF3D< T, W >
static constexpr bool isSuper
 
static constexpr unsigned d
 
- Protected Member Functions inherited from olb::SuperF3D< T, W >
 SuperF3D (SuperStructure< T, 3 > &superStructure, int targetDim)
 
- Protected Member Functions inherited from olb::GenericF< W, int >
 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, int P>
class olb::SuperLpNorm3D< T, W, P >

Functor that returns the Lp norm over omega of the the euklid norm of the input functor.

Maintains block level BlockLpNorm3D functors as required.

P == 0: inf norm P >= 1: p norm

Definition at line 46 of file superLpNorm3D.h.

Constructor & Destructor Documentation

◆ SuperLpNorm3D() [1/4]

template<typename T , typename W , int P>
olb::SuperLpNorm3D< T, W, P >::SuperLpNorm3D ( FunctorPtr< SuperF3D< T, W > > && f,
FunctorPtr< SuperIndicatorF3D< T > > && indicatorF )
Parameters
f(non-)owning pointer or reference to SuperF3D<T,W>
indicatorF(non-)owning pointer or reference to SuperIndicatorF3D<T>. Describes the subset to be integrated.

Definition at line 38 of file superLpNorm3D.hh.

40 : SuperF3D<T,W>(f->getSuperStructure(),1),
41 _f(std::move(f)),
42 _indicatorF(std::move(indicatorF))
43{
44 OLB_ASSERT(_f->getSourceDim() == _indicatorF->getSourceDim(),
45 "functor source dimension equals indicator source dimension");
46
47 this->getName() = "L" + std::to_string(P) + "Norm(" + _f->getName() + ")";
48
49 LoadBalancer<T>& load = _f->getSuperStructure().getLoadBalancer();
50
51 if ( _f->getBlockFSize() == load.size() &&
52 _indicatorF->getBlockFSize() == load.size() ) {
53 for (int iC = 0; iC < load.size(); ++iC) {
54 this->_blockF.emplace_back(
55 new BlockLpNorm3D<T,W,P>(_f->getBlockF(iC),
56 _indicatorF->getBlockIndicatorF(iC))
57 );
58 }
59 }
60}
std::string & getName()
read and write access to name
Definition genericF.hh:51
std::vector< std::unique_ptr< BlockF3D< W > > > _blockF
Super functors may consist of several BlockF3D<W> derived functors.
#define OLB_ASSERT(COND, MESSAGE)
Definition olbDebug.h:45

References olb::SuperF3D< T, W >::_blockF, olb::GenericF< W, int >::getName(), OLB_ASSERT, and olb::LoadBalancer< T >::size().

+ Here is the call graph for this function:

◆ SuperLpNorm3D() [2/4]

template<typename T , typename W , int P>
olb::SuperLpNorm3D< T, W, P >::SuperLpNorm3D ( FunctorPtr< SuperF3D< T, W > > && f,
SuperGeometry< T, 3 > & geometry,
FunctorPtr< SuperIndicatorF3D< T > > && indicatorF )

Legacy constructor accepting super geometry reference.

Parameters
f(non-)owning pointer or reference to SuperF3D<T,W>
indicatorF(non-)owning pointer or reference to SuperIndicatorF3D<T>. Describes the subset to be integrated.

Definition at line 63 of file superLpNorm3D.hh.

66 : SuperLpNorm3D(std::forward<decltype(f)>(f),
67 std::forward<decltype(indicatorF)>(indicatorF))
68{ }
SuperLpNorm3D(FunctorPtr< SuperF3D< T, W > > &&f, FunctorPtr< SuperIndicatorF3D< T > > &&indicatorF)

◆ SuperLpNorm3D() [3/4]

template<typename T , typename W , int P>
olb::SuperLpNorm3D< T, W, P >::SuperLpNorm3D ( FunctorPtr< SuperF3D< T, W > > && f,
SuperGeometry< T, 3 > & geometry,
std::vector< int > materials )
Parameters
f(non-)owning pointer or reference to SuperF3D<T,W>
geometrysuper geometry required to construct SuperIndicatorMaterial3D using materials
materialsvector of material numbers to be included in the Lp norm

Definition at line 71 of file superLpNorm3D.hh.

74 : SuperLpNorm3D(std::forward<decltype(f)>(f),
75 geometry.getMaterialIndicator(std::move(materials)))
76{ }
std::unique_ptr< SuperIndicatorF< T, D > > getMaterialIndicator(std::vector< int > &&materials)
Returns a material indicator using the given vector of materials.

◆ SuperLpNorm3D() [4/4]

template<typename T , typename W , int P>
olb::SuperLpNorm3D< T, W, P >::SuperLpNorm3D ( FunctorPtr< SuperF3D< T, W > > && f,
SuperGeometry< T, 3 > & geometry,
int material )
Parameters
f(non-)owning pointer or reference to SuperF3D<T,W>
geometrysuper geometry required to construct SuperIndicatorMaterial3D using material
materialsingle material number to be included in the Lp norm

Definition at line 79 of file superLpNorm3D.hh.

82 : SuperLpNorm3D(std::forward<decltype(f)>(f),
83 geometry.getMaterialIndicator(material))
84{ }

Member Function Documentation

◆ operator()()

template<typename T , typename W , int P>
bool olb::SuperLpNorm3D< T, W, P >::operator() ( W output[],
const int input[] )
overridevirtual

has to be implemented for 'every' derived class

Reimplemented from olb::SuperF3D< T, W >.

Definition at line 87 of file superLpNorm3D.hh.

88{
89 _f->getSuperStructure().communicate();
90 CuboidGeometry3D<T>& cGeometry = _f->getSuperStructure().getCuboidGeometry();
91 LoadBalancer<T>& load = _f->getSuperStructure().getLoadBalancer();
92
93 output[0] = W(0);
94 W outputTmp[_f->getTargetDim()];
95 int inputTmp[_f->getSourceDim()];
96
97 for (int iC = 0; iC < load.size(); ++iC) {
98 Cuboid3D<T>& cuboid = cGeometry.get(load.glob(iC));
99
100 const int nX = cuboid.getNx();
101 const int nY = cuboid.getNy();
102 const int nZ = cuboid.getNz();
103 const T weight = util::pow(cuboid.getDeltaR(), 3);
104
105 inputTmp[0] = load.glob(iC);
106
107 for (inputTmp[1] = 0; inputTmp[1] < nX; ++inputTmp[1]) {
108 for (inputTmp[2] = 0; inputTmp[2] < nY; ++inputTmp[2]) {
109 for (inputTmp[3] = 0; inputTmp[3] < nZ; ++inputTmp[3]) {
110 if (_indicatorF(inputTmp)) {
111 _f(outputTmp, inputTmp);
112 for (int iDim = 0; iDim < _f->getTargetDim(); ++iDim) {
113 output[0] = LpNormImpl<T,W,P>()(output[0], outputTmp[iDim], weight);
114 }
115 }
116 }
117 }
118 }
119 }
120
121#ifdef PARALLEL_MODE_MPI
122 if (P == 0) {
123 singleton::mpi().reduceAndBcast(output[0], MPI_MAX);
124 }
125 else {
126 singleton::mpi().reduceAndBcast(output[0], MPI_SUM);
127 }
128#endif
129
130 output[0] = LpNormImpl<T,W,P>().enclose(output[0]);
131
132 return true;
133}
void reduceAndBcast(T &reductVal, MPI_Op op, int root=0, MPI_Comm comm=MPI_COMM_WORLD)
Reduction operation, followed by a broadcast.
MpiManager & mpi()
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112

References olb::SuperStructure< T, D >::communicate(), olb::LpNormImpl< T, W, P >::enclose(), olb::CuboidGeometry3D< T >::get(), olb::Cuboid3D< T >::getDeltaR(), olb::Cuboid3D< T >::getNx(), olb::Cuboid3D< T >::getNy(), olb::Cuboid3D< T >::getNz(), olb::SuperF3D< T, W >::getSuperStructure(), olb::LoadBalancer< T >::glob(), olb::singleton::mpi(), olb::util::pow(), olb::singleton::MpiManager::reduceAndBcast(), and olb::LoadBalancer< T >::size().

+ Here is the call graph for this function:

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