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

indicator function for a 3d-cylinder More...

#include <indicatorF3D.h>

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

Public Member Functions

 IndicatorCylinder3D (Vector< S, 3 > center1, Vector< S, 3 > center2, S radius)
 Indicator function for a cylinder.
 
 IndicatorCylinder3D (Vector< S, 3 > center1, Vector< S, 3 > normal, S radius, S eps)
 Indicator function for a cylinder.
 
 IndicatorCylinder3D (IndicatorCircle3D< S > const &circleF, S eps)
 Indicator function for a cylinder.
 
bool operator() (bool output[], const S input[]) override
 has to be implemented for 'every' derived class
 
Vector< S, 3 > const & getCenter1 () const
 
Vector< S, 3 > const & getCenter2 () const
 
getRadius () const
 
signedDistance (const Vector< S, 3 > &input) override
 Returns signed distance to the nearest point on the indicator surface.
 
Vector< S, 3 > getSample (const std::function< S()> &randomness) const override
 
- Public Member Functions inherited from olb::IndicatorF3D< S >
virtual Vector< S, 3 > & getMin ()
 
virtual Vector< S, 3 > & getMax ()
 
virtual bool distance (S &distance, const Vector< S, 3 > &origin, S precision, const Vector< S, 3 > &direction)
 
virtual bool distance (S &distance, const Vector< S, 3 > &origin, const Vector< S, 3 > &direction, S precision, S pitch)
 
virtual bool distance (S &distance, const Vector< S, 3 > &origin, const Vector< S, 3 > &direction, int iC=-1)
 
virtual bool distance (S &distance, const Vector< S, 3 > &origin)
 
virtual bool distance (S &distance, const S input[])
 
virtual bool normal (Vector< S, 3 > &normal, const Vector< S, 3 > &origin, const Vector< S, 3 > &direction, int iC=-1)
 returns true and the normal if there was one found for an given origin and direction
 
virtual bool rotOnAxis (Vector< S, 3 > &vec_rot, const Vector< S, 3 > &vec, const Vector< S, 3 > &axis, S &theta)
 Rotate vector around axis by angle theta.
 
virtual bool operator() (bool output[1], const S input[3])
 Returns true if input is inside the indicator.
 
virtual Vector< S, 3 > surfaceNormal (const Vector< S, 3 > &pos, const S meshSize)
 Return surface normal.
 
Vector< S, 3 > surfaceNormal (const Vector< S, 3 > &pos, const S meshSize, std::function< Vector< S, 3 >(const Vector< S, 3 > &)> transformPos)
 Return surface normal after possible translation and rotation.
 
bool isInsideBox (Vector< S, 3 > point)
 Returns true if point is inside a cube with corners _myMin and _myMax
 
- 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::IndicatorF3D< S >
 IndicatorF3D ()
 
- Protected Member Functions inherited from olb::GenericF< bool, S >
 GenericF (int targetDim, int sourceDim)
 
- Protected Attributes inherited from olb::IndicatorF3D< S >
Vector< S, 3 > _myMin
 
Vector< S, 3 > _myMax
 

Detailed Description

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

indicator function for a 3d-cylinder

Definition at line 139 of file indicatorF3D.h.

Constructor & Destructor Documentation

◆ IndicatorCylinder3D() [1/3]

template<typename S >
olb::IndicatorCylinder3D< S >::IndicatorCylinder3D ( Vector< S, 3 > center1,
Vector< S, 3 > center2,
S radius )

Indicator function for a cylinder.

Definition at line 298 of file indicatorF3D.hh.

300 : _center1(center1), _center2(center2),
301 _ba(_center2 - _center1),
302 _baba(_ba[0]*_ba[0] + _ba[1]*_ba[1] + _ba[2]*_ba[2]),
303 _radius2(radius*radius), _length(util::sqrt(_baba))
304{
305 // cylinder defined by the centers of the two extremities and the radius
306 // _I,_J,_K is the new base where _K is the axe of the cylinder0
307 init();
308}
cpu::simd::Pack< T > sqrt(cpu::simd::Pack< T > value)
Definition pack.h:100

◆ IndicatorCylinder3D() [2/3]

template<typename S >
olb::IndicatorCylinder3D< S >::IndicatorCylinder3D ( Vector< S, 3 > center1,
Vector< S, 3 > normal,
S radius,
S eps )

Indicator function for a cylinder.

Definition at line 312 of file indicatorF3D.hh.

314 : _center1(center1-.5*eps*normalize(normal)),
315 _center2(_center1 + eps*normalize(normal)),
316 _ba(_center2 - _center1),
317 _baba(_ba[0]*_ba[0] + _ba[1]*_ba[1] + _ba[2]*_ba[2]),
318 _radius2(radius*radius), _length(util::sqrt(_baba))
319{
320 // cylinder defined by the centers of the two extremities and the radius
321 // _I,_J,_K is the new base where _K is the axe of the cylinder0
322 init();
323}
virtual bool normal(Vector< S, 3 > &normal, const Vector< S, 3 > &origin, const Vector< S, 3 > &direction, int iC=-1)
returns true and the normal if there was one found for an given origin and direction
constexpr Vector< T, D > normalize(const ScalarVector< T, D, IMPL > &a, T scale=T{1})
Definition vector.h:245

◆ IndicatorCylinder3D() [3/3]

template<typename S >
olb::IndicatorCylinder3D< S >::IndicatorCylinder3D ( IndicatorCircle3D< S > const & circleF,
S eps )

Indicator function for a cylinder.

Definition at line 327 of file indicatorF3D.hh.

328 : _center1(circleF.getCenter() - .5*eps*circleF.getNormal()),
329 _center2(_center1 + eps*circleF.getNormal()),
330 _ba(_center2 - _center1),
331 _baba(_ba[0]*_ba[0] + _ba[1]*_ba[1] + _ba[2]*_ba[2]),
332 _radius2(circleF.getRadius()*circleF.getRadius()), _length(util::sqrt(_baba))
333{
334 // cylinder defined by the centers of the two extremities and the radius
335 // _I,_J,_K is the new base where _K is the axe of the cylinder0
336 init();
337}

Member Function Documentation

◆ getCenter1()

template<typename S >
Vector< S, 3 > const & olb::IndicatorCylinder3D< S >::getCenter1 ( ) const

Definition at line 394 of file indicatorF3D.hh.

395{
396 return _center1;
397}

◆ getCenter2()

template<typename S >
Vector< S, 3 > const & olb::IndicatorCylinder3D< S >::getCenter2 ( ) const

Definition at line 400 of file indicatorF3D.hh.

401{
402 return _center2;
403}

◆ getRadius()

template<typename S >
S olb::IndicatorCylinder3D< S >::getRadius ( ) const

Definition at line 406 of file indicatorF3D.hh.

407{
408 return util::sqrt(_radius2);
409}

References olb::util::sqrt().

+ Here is the call graph for this function:

◆ getSample()

template<typename S >
Vector< S, 3 > olb::IndicatorCylinder3D< S >::getSample ( const std::function< S()> & randomness) const
overridevirtual
Parameters
randomnessCallable returning uniformly sampled values in [0,1]

Reimplemented from olb::IndicatorF3D< S >.

Definition at line 418 of file indicatorF3D.hh.

419{
420 // Select random point on center axis
421 auto axis = _center2 - _center1;
422 auto axisPoint = _center1 + (_center2 - _center1) * randomness();
423 // Compute cut at point on center axis
424 auto hyperplane = Hyperplane3D<S>().originAt(axisPoint)
425 .normalTo(axis);
426 // Select random point on 2D circle
427 const S r = util::sqrt(_radius2) * util::sqrt(randomness());
428 const S theta = randomness() * 2 * M_PI;
429 // Project random circle point to axis-orthogonal plane with axisPoint intersect
430 return hyperplane.project({r * util::cos(theta),
431 r * util::sin(theta)});
432}
#define M_PI
ADf< T, DIM > sin(const ADf< T, DIM > &a)
Definition aDiff.h:569
ADf< T, DIM > cos(const ADf< T, DIM > &a)
Definition aDiff.h:578

References olb::util::cos(), M_PI, olb::Hyperplane3D< T >::normalTo(), olb::Hyperplane3D< T >::originAt(), olb::util::sin(), and olb::util::sqrt().

+ Here is the call graph for this function:

◆ operator()()

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

has to be implemented for 'every' derived class

Implements olb::GenericF< bool, S >.

Definition at line 341 of file indicatorF3D.hh.

342{
343 Vector<S,3> pa(Vector<S,3>(input) - _center1);
344
345 S X = _I[0]*pa[0] + _I[1]*pa[1] + _I[2]*pa[2];
346 S Y = _J[0]*pa[0] + _J[1]*pa[1] + _J[2]*pa[2];
347 S Z = _K[0]*pa[0] + _K[1]*pa[1] + _K[2]*pa[2];
348
349 // X^2 + Y^2 <= _radius2
350 output[0] = ( Z <= _length && Z >= 0 && X*X + Y*Y <= _radius2 );
351 return output[0];
352}

◆ signedDistance()

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

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

Reimplemented from olb::IndicatorF3D< S >.

Definition at line 412 of file indicatorF3D.hh.

413{
414 return sdf::cylinder(input, _center1, _ba, _baba, util::sqrt(_radius2));
415}
T cylinder(Vector< T, 3 > p, Vector< T, 3 > a, Vector< T, 3 > ba, T baba, T r) any_platform
Exact signed distance to the surface of three-dimensional cylinder.
Definition sdf.h:172

References olb::sdf::cylinder(), and olb::util::sqrt().

+ Here is the call graph for this function:

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