OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
olb::SuperLpNorm2D< 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 <superLpNorm2D.h>

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

Public Member Functions

 SuperLpNorm2D (FunctorPtr< SuperF2D< T, W > > &&f, FunctorPtr< SuperIndicatorF2D< T > > &&indicatorF)
 
 SuperLpNorm2D (FunctorPtr< SuperF2D< T, W > > &&f, SuperGeometry< T, 2 > &, FunctorPtr< SuperIndicatorF2D< T > > &&indicatorF)
 Legacy constructor accepting super geometry reference.
 
 SuperLpNorm2D (FunctorPtr< SuperF2D< T, W > > &&f, SuperGeometry< T, 2 > &geometry, std::vector< int > materials)
 
 SuperLpNorm2D (FunctorPtr< SuperF2D< T, W > > &&f, SuperGeometry< T, 2 > &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::SuperF2D< T, W >
SuperF2D< T, W > & operator- (SuperF2D< T, W > &rhs)
 
SuperF2D< T, W > & operator+ (SuperF2D< T, W > &rhs)
 
SuperF2D< T, W > & operator* (SuperF2D< T, W > &rhs)
 
SuperF2D< T, W > & operator/ (SuperF2D< T, W > &rhs)
 
SuperStructure< T, 2 > & getSuperStructure ()
 
int getBlockFSize () const
 
BlockF2D< 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::SuperF2D< 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)
 
- Protected Member Functions inherited from olb::SuperF2D< T, W >
 SuperF2D (SuperStructure< T, 2 > &superStructure, int targetDim)
 
- Protected Member Functions inherited from olb::GenericF< W, int >
 GenericF (int targetDim, int sourceDim)
 
- Protected Attributes inherited from olb::SuperF2D< T, W >
SuperStructure< T, 2 > & _superStructure
 
std::vector< std::unique_ptr< BlockF2D< W > > > _blockF
 Super functors may consist of several BlockF2D<W> derived functors.
 

Detailed Description

template<typename T, typename W, int P>
class olb::SuperLpNorm2D< T, W, P >

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

Maintains block level BlockLpNorm2D functors as required.

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

Definition at line 46 of file superLpNorm2D.h.

Constructor & Destructor Documentation

◆ SuperLpNorm2D() [1/4]

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

Definition at line 37 of file superLpNorm2D.hh.

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

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

+ Here is the call graph for this function:

◆ SuperLpNorm2D() [2/4]

template<typename T , typename W , int P>
olb::SuperLpNorm2D< T, W, P >::SuperLpNorm2D ( FunctorPtr< SuperF2D< T, W > > && f,
SuperGeometry< T, 2 > & geometry,
FunctorPtr< SuperIndicatorF2D< T > > && indicatorF )

Legacy constructor accepting super geometry reference.

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

Definition at line 62 of file superLpNorm2D.hh.

65 : SuperLpNorm2D(std::forward<decltype(f)>(f),
66 std::forward<decltype(indicatorF)>(indicatorF))
67{ }
SuperLpNorm2D(FunctorPtr< SuperF2D< T, W > > &&f, FunctorPtr< SuperIndicatorF2D< T > > &&indicatorF)

◆ SuperLpNorm2D() [3/4]

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

Definition at line 70 of file superLpNorm2D.hh.

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

◆ SuperLpNorm2D() [4/4]

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

Definition at line 78 of file superLpNorm2D.hh.

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

Member Function Documentation

◆ operator()()

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

has to be implemented for 'every' derived class

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

Definition at line 86 of file superLpNorm2D.hh.

87{
88 _f->getSuperStructure().communicate();
89 CuboidGeometry2D<T>& geometry = _f->getSuperStructure().getCuboidGeometry();
90 LoadBalancer<T>& load = _f->getSuperStructure().getLoadBalancer();
91
92 output[0] = W(0);
93 W outputTmp[_f->getTargetDim()];
94 int inputTmp[3];
95
96 for (int iC = 0; iC < load.size(); ++iC) {
97 Cuboid2D<T>& cuboid = geometry.get(load.glob(iC));
98
99 const int nX = cuboid.getNx();
100 const int nY = cuboid.getNy();
101 const T weight = util::pow(cuboid.getDeltaR(), 2);
102
103 inputTmp[0] = load.glob(iC);
104
105 for (inputTmp[1] = 0; inputTmp[1] < nX; ++inputTmp[1]) {
106 for (inputTmp[2] = 0; inputTmp[2] < nY; ++inputTmp[2]) {
107 if (_indicatorF(inputTmp)) {
108 _f(outputTmp, inputTmp);
109 for (int iDim = 0; iDim < _f->getTargetDim(); ++iDim) {
110 output[0] = LpNormImpl<T,W,P>()(output[0], outputTmp[iDim], weight);
111 }
112 }
113 }
114 }
115 }
116
117#ifdef PARALLEL_MODE_MPI
118 if (P == 0) {
119 singleton::mpi().reduceAndBcast(output[0], MPI_MAX);
120 }
121 else {
122 singleton::mpi().reduceAndBcast(output[0], MPI_SUM);
123 }
124#endif
125
126 output[0] = LpNormImpl<T,W,P>().enclose(output[0]);
127
128 return true;
129}
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::CuboidGeometry2D< T >::get(), olb::Cuboid2D< T >::getDeltaR(), olb::Cuboid2D< T >::getNx(), olb::Cuboid2D< T >::getNy(), olb::SuperF2D< 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: