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

functor to compute 0.5(f-f_wanted)^2/f_wanted^2 on a lattice More...

#include <dualFunctors3D.h>

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

Public Member Functions

 DrelativeDifferenceObjectiveDf3D (SuperLattice< T, DESCRIPTOR > &sLattice, FunctorPtr< SuperF3D< T, T > > &&f, FunctorPtr< SuperF3D< T, T > > &&dFdF, FunctorPtr< AnalyticalF3D< T, T > > &&wantedF, FunctorPtr< SuperIndicatorF3D< T > > &&indicatorF)
 
 DrelativeDifferenceObjectiveDf3D (SuperLattice< T, DESCRIPTOR > &sLattice, FunctorPtr< SuperF3D< T, T > > &&f, FunctorPtr< SuperF3D< T, T > > &&dFdF, FunctorPtr< AnalyticalF3D< T, T > > &&wantedF, SuperGeometry< T, 3 > &geometry, std::vector< int > materials)
 
 DrelativeDifferenceObjectiveDf3D (SuperLattice< T, DESCRIPTOR > &sLattice, FunctorPtr< SuperF3D< T, T > > &&f, FunctorPtr< SuperF3D< T, T > > &&dFdF, FunctorPtr< AnalyticalF3D< T, T > > &&wantedF, SuperGeometry< T, 3 > &geometry, int material)
 
bool operator() (T output[], const int input[])
 
- Public Member Functions inherited from olb::SuperF3D< T, T >
SuperF3D< T, T > & operator- (SuperF3D< T, T > &rhs)
 
SuperF3D< T, T > & operator+ (SuperF3D< T, T > &rhs)
 
SuperF3D< T, T > & operator* (SuperF3D< T, T > &rhs)
 
SuperF3D< T, T > & operator/ (SuperF3D< T, T > &rhs)
 
SuperStructure< T, 3 > & getSuperStructure ()
 
int getBlockFSize () const
 
BlockF3D< T > & getBlockF (int iCloc)
 
bool operator() (T output[], const int input[])
 
- Public Member Functions inherited from olb::GenericF< T, S >
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
 
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)
 

Additional Inherited Members

- Public Types inherited from olb::SuperF3D< T, T >
using identity_functor_type
 
- 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, T >
static constexpr bool isSuper
 
static constexpr unsigned d
 
- Protected Member Functions inherited from olb::SuperF3D< T, T >
 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, T >
SuperStructure< T, 3 > & _superStructure
 
std::vector< std::unique_ptr< BlockF3D< T > > > _blockF
 Super functors may consist of several BlockF3D<W> derived functors.
 

Detailed Description

template<typename T, typename DESCRIPTOR>
class olb::opti::DrelativeDifferenceObjectiveDf3D< T, DESCRIPTOR >

functor to compute 0.5(f-f_wanted)^2/f_wanted^2 on a lattice

Definition at line 218 of file dualFunctors3D.h.

Constructor & Destructor Documentation

◆ DrelativeDifferenceObjectiveDf3D() [1/3]

template<typename T , typename DESCRIPTOR >
olb::opti::DrelativeDifferenceObjectiveDf3D< T, DESCRIPTOR >::DrelativeDifferenceObjectiveDf3D ( SuperLattice< T, DESCRIPTOR > & sLattice,
FunctorPtr< SuperF3D< T, T > > && f,
FunctorPtr< SuperF3D< T, T > > && dFdF,
FunctorPtr< AnalyticalF3D< T, T > > && wantedF,
FunctorPtr< SuperIndicatorF3D< T > > && indicatorF )

Definition at line 504 of file dualFunctors3D.hh.

510 : SuperF3D<T,T>(sLattice, DESCRIPTOR::q),
511 _f(std::move(f)),
512 _dFdF(std::move(dFdF)),
513 _wantedF(std::forward<decltype(wantedF)>(wantedF), sLattice),
514 _indicatorF(std::move(indicatorF))
515{
516 this->getName() = "dRelativeDifferenceObjectiveDf";
517
518 SuperL2Norm3D<T> wantedFlp(_wantedF, *_indicatorF);
519 T output[1] {};
520 wantedFlp(output, nullptr);
521
522 const T globalValue = util::pow(output[0], 2);
523 const T weight = util::pow(_f->getSuperStructure().getCuboidGeometry().getMinDeltaR(), 3);
524
525 for (int iC = 0; iC < sLattice.getLoadBalancer().size(); ++iC) {
526 this->_blockF.emplace_back(
527 new BlockDrelativeDifferenceObjectiveDf3D<T,DESCRIPTOR>(
528 sLattice.getBlock(iC),
529 _f->getBlockF(iC),
530 _dFdF->getBlockF(iC),
531 _wantedF.getBlockF(iC),
532 _indicatorF->getBlockIndicatorF(iC),
533 globalValue,
534 weight)
535 );
536 }
537}
std::string & getName()
read and write access to name
Definition genericF.hh:51
std::vector< std::unique_ptr< BlockF3D< T > > > _blockF
Super functors may consist of several BlockF3D<W> derived functors.
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112

References olb::SuperF3D< T, T >::_blockF, olb::SuperLattice< T, DESCRIPTOR >::getBlock(), olb::SuperStructure< T, D >::getLoadBalancer(), olb::GenericF< T, S >::getName(), and olb::util::pow().

+ Here is the call graph for this function:

◆ DrelativeDifferenceObjectiveDf3D() [2/3]

template<typename T , typename DESCRIPTOR >
olb::opti::DrelativeDifferenceObjectiveDf3D< T, DESCRIPTOR >::DrelativeDifferenceObjectiveDf3D ( SuperLattice< T, DESCRIPTOR > & sLattice,
FunctorPtr< SuperF3D< T, T > > && f,
FunctorPtr< SuperF3D< T, T > > && dFdF,
FunctorPtr< AnalyticalF3D< T, T > > && wantedF,
SuperGeometry< T, 3 > & geometry,
std::vector< int > materials )

Definition at line 540 of file dualFunctors3D.hh.

548 std::forward<decltype(f)>(f),
549 std::forward<decltype(dFdF)>(dFdF),
550 std::forward<decltype(wantedF)>(wantedF),
551 geometry.getMaterialIndicator(materials))
552{ }
std::unique_ptr< SuperIndicatorF< T, D > > getMaterialIndicator(std::vector< int > &&materials)
Returns a material indicator using the given vector of materials.
DrelativeDifferenceObjectiveDf3D(SuperLattice< T, DESCRIPTOR > &sLattice, FunctorPtr< SuperF3D< T, T > > &&f, FunctorPtr< SuperF3D< T, T > > &&dFdF, FunctorPtr< AnalyticalF3D< T, T > > &&wantedF, FunctorPtr< SuperIndicatorF3D< T > > &&indicatorF)

◆ DrelativeDifferenceObjectiveDf3D() [3/3]

template<typename T , typename DESCRIPTOR >
olb::opti::DrelativeDifferenceObjectiveDf3D< T, DESCRIPTOR >::DrelativeDifferenceObjectiveDf3D ( SuperLattice< T, DESCRIPTOR > & sLattice,
FunctorPtr< SuperF3D< T, T > > && f,
FunctorPtr< SuperF3D< T, T > > && dFdF,
FunctorPtr< AnalyticalF3D< T, T > > && wantedF,
SuperGeometry< T, 3 > & geometry,
int material )

Definition at line 555 of file dualFunctors3D.hh.

563 std::forward<decltype(f)>(f),
564 std::forward<decltype(dFdF)>(dFdF),
565 std::forward<decltype(wantedF)>(wantedF),
566 geometry.getMaterialIndicator(material))
567{ }

Member Function Documentation

◆ operator()()

template<typename T , typename DESCRIPTOR >
bool olb::opti::DrelativeDifferenceObjectiveDf3D< T, DESCRIPTOR >::operator() ( T output[],
const int input[] )

Definition at line 570 of file dualFunctors3D.hh.

571{
572 for (int i=0; i < DESCRIPTOR::q; ++i) {
573 dJdF[i] = T{};
574 }
575
576 auto& load = _f->getSuperStructure().getLoadBalancer();
577
578 if (load.isLocal(latticeR[0])) {
579 return this->getBlockF(load.loc(latticeR[0]))(dJdF, &latticeR[1]);
580 }
581 else {
582 return true;
583 }
584}
BlockF3D< T > & getBlockF(int iCloc)

References olb::SuperStructure< T, D >::getLoadBalancer(), and olb::SuperF3D< T, W >::getSuperStructure().

+ Here is the call graph for this function:

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