OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
olb::IndicatorCuboid2D< S > Class Template Reference

indicator function for a 2D-cuboid, parallel to the planes x=0, y=0; theta rotates cuboid around its center, theta in radian measure More...

#include <indicatorF2D.h>

+ Inheritance diagram for olb::IndicatorCuboid2D< S >:
+ Collaboration diagram for olb::IndicatorCuboid2D< S >:

Public Member Functions

 IndicatorCuboid2D (Vector< S, 2 > extend, Vector< S, 2 > origin, S theta=0)
 constructs an cuboid with x axis dimension 0 to extend[0], ...
 
 IndicatorCuboid2D (S xlength, S ylength, Vector< S, 2 > center={S(), S()}, S theta=0)
 constructs an cuboid with x axis dimension -xlength/2 to xlength/2
 
bool operator() (bool output[], const S input[]) override
 returns true if input is inside, otherwise false
 
Vector< S, 2 > const & getCenter () const
 
S const getxLength () const
 
S const getyLength () const
 
signedDistance (const Vector< S, 2 > &input) override
 Returns signed distance to the nearest point on the indicator surface.
 
- Public Member Functions inherited from olb::IndicatorF2D< S >
virtual Vector< S, 2 > & getMin ()
 
virtual Vector< S, 2 > & getMax ()
 
virtual bool distance (S &distance, const Vector< S, 2 > &origin, S precision, const Vector< S, 2 > &direction)
 returns false or true and pos. distance if there was one found for an given origin and direction
 
virtual bool distance (S &distance, const Vector< S, 2 > &origin, const Vector< S, 2 > &direction, S precision, S pitch)
 
virtual bool distance (S &distance, const Vector< S, 2 > &origin, const Vector< S, 2 > &direction, int iC=-1)
 
virtual bool distance (S &distance, const Vector< S, 2 > &origin)
 
virtual bool distance (S &distance, const S input[])
 
virtual bool normal (Vector< S, 2 > &normal, const Vector< S, 2 > &origin, const Vector< S, 2 > &direction, int iC=-1)
 returns true and the normal if there was one found for an given origin and direction
 
virtual bool operator() (bool output[1], const S input[2])
 Returns true if input is inside the indicator.
 
virtual Vector< S, 2 > surfaceNormal (const Vector< S, 2 > &pos, const S meshSize)
 Return surface normal.
 
Vector< S, 2 > surfaceNormal (const Vector< S, 2 > &pos, const S meshSize, std::function< Vector< S, 2 >(const Vector< S, 2 > &)> transformPos)
 Return surface normal after possible translation and rotation.
 
bool isInsideBox (Vector< S, 2 > point)
 Returns true if point is inside a cube with corners _myMin and _myMax
 
virtual bool operator() (const S input[])
 Indicator specific function operator overload.
 
- Public Member Functions inherited from olb::GenericF< bool, 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
 
bool operator() (bool output[])
 wrapper that call the pure virtual operator() (T output[], const S input[]) from above
 
bool operator() (bool output[], S input0)
 
bool operator() (bool output[], S input0, S input1)
 
bool operator() (bool output[], S input0, S input1, S input2)
 
bool operator() (bool output[], S input0, S input1, S input2, S input3)
 

Additional Inherited Members

- Public Types inherited from olb::GenericF< bool, S >
using targetType
 
using sourceType
 
- Public Attributes inherited from olb::GenericF< bool, S >
std::shared_ptr< GenericF< bool, S > > _ptrCalcC
 memory management, frees resouces (calcClass)
 
- Protected Member Functions inherited from olb::IndicatorF2D< S >
 IndicatorF2D ()
 
- Protected Member Functions inherited from olb::GenericF< bool, S >
 GenericF (int targetDim, int sourceDim)
 
- Protected Attributes inherited from olb::IndicatorF2D< S >
Vector< S, 2 > _myMin
 
Vector< S, 2 > _myMax
 

Detailed Description

template<typename S>
class olb::IndicatorCuboid2D< S >

indicator function for a 2D-cuboid, parallel to the planes x=0, y=0; theta rotates cuboid around its center, theta in radian measure

Definition at line 69 of file indicatorF2D.h.

Constructor & Destructor Documentation

◆ IndicatorCuboid2D() [1/2]

template<typename S >
olb::IndicatorCuboid2D< S >::IndicatorCuboid2D ( Vector< S, 2 > extend,
Vector< S, 2 > origin,
S theta = 0 )

constructs an cuboid with x axis dimension 0 to extend[0], ...

Definition at line 67 of file indicatorF2D.hh.

68 : _center(origin + S(.5)*extend), _xLength(extend[0]), _yLength(extend[1]), _theta(theta)
69
70{
71 this->_myMin = origin;
72 this->_myMax = origin + extend;
73}
Vector< S, 2 > _myMin
Vector< S, 2 > _myMax

References olb::IndicatorF2D< S >::_myMax, and olb::IndicatorF2D< S >::_myMin.

◆ IndicatorCuboid2D() [2/2]

template<typename S >
olb::IndicatorCuboid2D< S >::IndicatorCuboid2D ( S xlength,
S ylength,
Vector< S, 2 > center = {S(), S()},
S theta = 0 )

constructs an cuboid with x axis dimension -xlength/2 to xlength/2

Definition at line 76 of file indicatorF2D.hh.

77 : _center(center), _xLength(xLength), _yLength(yLength), _theta(-theta)
78{
79 this->_myMin = {_center[0] - _xLength/S(2), _center[1] - _yLength/S(2)};
80 this->_myMax = {_center[0] + _xLength/S(2), _center[1] + _yLength/S(2)};
81}

References olb::IndicatorF2D< S >::_myMax, and olb::IndicatorF2D< S >::_myMin.

Member Function Documentation

◆ getCenter()

template<typename S >
Vector< S, 2 > const & olb::IndicatorCuboid2D< S >::getCenter ( ) const

Definition at line 104 of file indicatorF2D.hh.

105{
106 return _center;
107}

◆ getxLength()

template<typename S >
S const olb::IndicatorCuboid2D< S >::getxLength ( ) const

Definition at line 110 of file indicatorF2D.hh.

111{
112 return _xLength;
113}
+ Here is the caller graph for this function:

◆ getyLength()

template<typename S >
S const olb::IndicatorCuboid2D< S >::getyLength ( ) const

Definition at line 116 of file indicatorF2D.hh.

117{
118 return _yLength;
119}

◆ operator()()

template<typename S >
bool olb::IndicatorCuboid2D< S >::operator() ( bool output[],
const S input[] )
overridevirtual

returns true if input is inside, otherwise false

Implements olb::GenericF< bool, S >.

Definition at line 86 of file indicatorF2D.hh.

87{
88 S x, y;
89 if ( !util::nearZero(_theta) ) {
90 x = _center[0] + (input[0] - _center[0])*util::cos(_theta) - (input[1] - _center[1])*util::sin(_theta);
91 y = _center[1] + (input[0] - _center[0])*util::sin(_theta) + (input[1] - _center[1])*util::cos(_theta);
92 }
93 else {
94 x = input[0];
95 y = input[1];
96 }
97
98 output[0] = ( (util::fabs(_center[0] - x) < _xLength/S(2) || util::approxEqual(util::fabs(_center[0] - x),_xLength/S(2)) )
99 && (util::fabs(_center[1] - y) < _yLength/S(2) || util::approxEqual(util::fabs(_center[1] - y), _yLength/S(2)) ) );
100 return true;
101}
bool approxEqual(T a, U b, W epsilon)
ADf< T, DIM > sin(const ADf< T, DIM > &a)
Definition aDiff.h:569
cpu::simd::Pack< T > fabs(cpu::simd::Pack< T > value)
Definition pack.h:106
bool nearZero(const ADf< T, DIM > &a)
Definition aDiff.h:1087
ADf< T, DIM > cos(const ADf< T, DIM > &a)
Definition aDiff.h:578

References olb::util::approxEqual(), olb::util::cos(), olb::util::fabs(), olb::util::nearZero(), and olb::util::sin().

+ Here is the call graph for this function:

◆ signedDistance()

template<typename S >
S olb::IndicatorCuboid2D< S >::signedDistance ( const Vector< S, 2 > & input)
overridevirtual

Returns signed distance to the nearest point on the indicator surface.

Reimplemented from olb::IndicatorF2D< S >.

Definition at line 122 of file indicatorF2D.hh.

123{
124 // TODO: Implementation should be analogous to other indicators.
125
126 Vector<S,2> ptransl = {input[0]-_center[0], input[1]-_center[1]};
127 Vector<S,2> prot = {util::cos(-_theta)*ptransl[0]+util::sin(-_theta)*ptransl[1], util::cos(-_theta)*ptransl[1]-util::sin(-_theta)*ptransl[0]};
128
129 return sdf::box(prot, Vector<S,2>(S(.5)*_xLength, S(.5)*_yLength));
130}
T box(Vector< T, 2 > p, Vector< T, 2 > b) any_platform
Exact signed distance to the surface of two-dimensional cuboid.
Definition sdf.h:115

References olb::sdf::box(), olb::util::cos(), and olb::util::sin().

+ Here is the call graph for this function:

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