OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::IndicatorCuboid3D< T > Class Template Reference

indicator function for a 3d-cuboid, parallel to the planes x=0, y=0, z=0. More...

#include <indicatorF3D.h>

+ Inheritance diagram for olb::IndicatorCuboid3D< T >:
+ Collaboration diagram for olb::IndicatorCuboid3D< T >:

Public Member Functions

 IndicatorCuboid3D (Vector< S, 3 > extend, Vector< S, 3 > origin)
 constructs an cuboid with x axis from origin[0] to origin[0]+extend[0], ...
 
 IndicatorCuboid3D (S xlength, S ylength, S zlength, Vector< S, 3 > center)
 constructs an cuboid with x axis dimension center[0]-xlength/2 to center[0]+xlength/2
 
Vector< S, 3 > const & getCenter () const
 
S const getxLength () const
 
S const getyLength () const
 
S const getzLength () const
 
bool operator() (bool output[], const S input[]) override
 returns true if input is inside, otherwise false
 
S 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 S signedDistanceExact (const Vector< S, 3 > &input)
 Returns exact signed distance to the nearest point on the indicator surface Uses the most accurate, but slower method This is usually sufficient for fluid-wall interactions.
 
virtual Vector< S, 3 > surfaceNormal (const Vector< S, 3 > &pos, const S meshSize)
 Return surface normal Uses the fastest, but potentially less accurate method.
 
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 Uses the fastest, but potentially less accurate method.
 
virtual Vector< S, 3 > surfaceNormalExact (const Vector< S, 3 > &pos, const S meshSize)
 Return surface normal Uses the most accurate, but slower method This is likely necessary for particle-wall interactions.
 
Vector< S, 3 > surfaceNormalExact (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 Uses the fastest, but potentially less accurate method.
 
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 T>
class olb::IndicatorCuboid3D< T >

indicator function for a 3d-cuboid, parallel to the planes x=0, y=0, z=0.

Parameters
extendmust have only positive elements
xLengthmust be positive

Definition at line 254 of file aliases.h.

Constructor & Destructor Documentation

◆ IndicatorCuboid3D() [1/2]

template<typename S >
olb::IndicatorCuboid3D< S >::IndicatorCuboid3D ( Vector< S, 3 > extend,
Vector< S, 3 > origin )

constructs an cuboid with x axis from origin[0] to origin[0]+extend[0], ...

Definition at line 638 of file indicatorF3D.hh.

639 : _center(origin+.5*extend),_xLength(extend[0]), _yLength(extend[1]), _zLength(extend[2])
640{
641 assert(_xLength>0 && _yLength>0 && _zLength>0);
642
643 this->_myMin = origin;
644 this->_myMax = origin + extend;
645}

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

◆ IndicatorCuboid3D() [2/2]

template<typename S >
olb::IndicatorCuboid3D< S >::IndicatorCuboid3D ( S xlength,
S ylength,
S zlength,
Vector< S, 3 > center )

constructs an cuboid with x axis dimension center[0]-xlength/2 to center[0]+xlength/2

Definition at line 648 of file indicatorF3D.hh.

649 : _center(center), _xLength(xLength), _yLength(yLength), _zLength(zLength)
650{
651 assert(_xLength>0 && _yLength>0 && _zLength>0);
652
653 this->_myMin = {_center[0] - S{0.5}*_xLength, _center[1] - S{0.5}*_yLength, _center[2] - S{0.5}*_zLength};
654 this->_myMax = {_center[0] + S{0.5}*_xLength, _center[1] + S{0.5}*_yLength, _center[2] + S{0.5}*_zLength};
655}

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

Member Function Documentation

◆ getCenter()

template<typename S >
Vector< S, 3 > const & olb::IndicatorCuboid3D< S >::getCenter ( ) const

Definition at line 658 of file indicatorF3D.hh.

659{
660 return _center;
661}
+ Here is the caller graph for this function:

◆ getSample()

template<typename S >
Vector< S, 3 > olb::IndicatorCuboid3D< 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 707 of file indicatorF3D.hh.

708{
709 // Select random point on center axis
710 std::vector<S> v = {_xLength, _yLength, _zLength};
711 auto min = std::min_element(v.begin(), v.end());
712 int index = std::distance(v.begin(), min);
713 Vector<S,3> axis{0, 0, 0};
714 axis[index] = v[index];
715 auto origin = _center;
716 origin[0] -= v[0]/S{2};
717 origin[1] -= v[1]/S{2};
718 origin[2] -= v[2]/S{2};
719 auto axisPoint = origin + axis * randomness();
720 // Compute cut at point on center axis
721 auto hyperplane = Hyperplane3D<S>().originAt(axisPoint)
722 .normalTo(axis);
723 std::vector<S> coord;
724 for(int i = 0; i<3; i++) {
725 if(i != index) {
726 S var = v[i] * randomness();
727 coord.emplace_back(var);
728 }
729 }
730 return hyperplane.project({coord[0],coord[1]});
731}

References olb::Hyperplane3D< T >::normalTo(), olb::Hyperplane3D< T >::originAt(), and olb::Hyperplane3D< T >::project().

+ Here is the call graph for this function:

◆ getxLength()

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

Definition at line 664 of file indicatorF3D.hh.

665{
666 return _xLength;
667}
+ Here is the caller graph for this function:

◆ getyLength()

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

Definition at line 670 of file indicatorF3D.hh.

671{
672 return _yLength;
673}

◆ getzLength()

template<typename S >
S const olb::IndicatorCuboid3D< S >::getzLength ( ) const

Definition at line 676 of file indicatorF3D.hh.

677{
678 return _zLength;
679}

◆ operator()()

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

returns true if input is inside, otherwise false

Implements olb::GenericF< bool, S >.

Reimplemented in olb::IndicatorCuboidRotate3D< S >.

Definition at line 682 of file indicatorF3D.hh.

683{
684 // returns true if x is inside the cuboid
685 Vector<S,3> q = distanceXYZ(input);
686 Vector<S,3> eps = std::numeric_limits<BaseType<S>>::epsilon();
687 output[0] = ( q < eps );
688 return output[0];
689}
constexpr int q() any_platform
Definition functions.h:140
+ Here is the caller graph for this function:

◆ signedDistance()

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

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

Reimplemented from olb::IndicatorF3D< S >.

Reimplemented in olb::IndicatorCuboidRotate3D< S >.

Definition at line 701 of file indicatorF3D.hh.

702{
703 return sdf::box(input - _center, Vector<S,3>(.5*_xLength, .5*_yLength, .5*_zLength));
704}
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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