OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::RegularCachedIndicatorF3D< S > Class Template Reference

#include <indicatorBaseF3D.h>

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

Public Member Functions

 RegularCachedIndicatorF3D (IndicatorF3D< S > &indicatorF, S deltaR)
 
bool operator() (bool output[1], const S input[3]) override
 Returns true if input is inside the indicator.
 
bool save (std::string fileName)
 
bool load (std::string fileName)
 
Vector< S, 3 > & getMin () override
 
Vector< S, 3 > & getMax () override
 
bool distance (S &distance, const Vector< S, 3 > &origin, S precision, const Vector< S, 3 > &direction) override
 
bool distance (S &distance, const Vector< S, 3 > &origin, const Vector< S, 3 > &direction, S precision, S pitch) override
 
bool distance (S &distance, const Vector< S, 3 > &origin, const Vector< S, 3 > &direction, int iC=-1) override
 
bool distance (S &distance, const Vector< S, 3 > &origin) override
 
bool distance (S &distance, const S input[]) override
 
bool normal (Vector< S, 3 > &normal, const Vector< S, 3 > &origin, const Vector< S, 3 > &direction, int iC=-1) override
 returns true and the normal if there was one found for an given origin and direction
 
bool rotOnAxis (Vector< S, 3 > &vec_rot, const Vector< S, 3 > &vec, const Vector< S, 3 > &axis, S &theta) override
 Rotate vector around axis by angle theta.
 
signedDistance (const Vector< S, 3 > &input) override
 Returns signed distance to the nearest point on the indicator surface Uses the fastest, but potentially less accurate method.
 
Vector< S, 3 > surfaceNormal (const Vector< S, 3 > &pos, const S meshSize) override
 Return surface normal Uses the fastest, but potentially less accurate method.
 
- Public Member Functions inherited from olb::IndicatorF3D< S >
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.
 
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
 
virtual Vector< S, 3 > getSample (const std::function< S()> &randomness) const
 
- 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
 
virtual bool operator() (bool output[], const S input[])=0
 has to be implemented for 'every' derived class
 
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::RegularCachedIndicatorF3D< S >

Definition at line 105 of file indicatorBaseF3D.h.

Constructor & Destructor Documentation

◆ RegularCachedIndicatorF3D()

template<typename S >
olb::RegularCachedIndicatorF3D< S >::RegularCachedIndicatorF3D ( IndicatorF3D< S > & indicatorF,
S deltaR )
inline

Definition at line 115 of file indicatorBaseF3D.h.

115 :
116 _indicatorF(indicatorF),
117 _deltaR(deltaR),
118 _cacheCuboid(indicatorF.getMin()[0], indicatorF.getMin()[1], indicatorF.getMin()[2], deltaR,
119 (int)((indicatorF.getMax()[0] - indicatorF.getMin()[0]) / deltaR + 1.5),
120 (int)((indicatorF.getMax()[1] - indicatorF.getMin()[1]) / deltaR + 1.5),
121 (int)((indicatorF.getMax()[2] - indicatorF.getMin()[2]) / deltaR + 1.5)),
122 _cacheBlock(_cacheCuboid.getExtent(), 0),
123 _cache(_cacheBlock.getNcells())
124 { }
std::size_t getNcells() const
Get number of cells.

Member Function Documentation

◆ distance() [1/5]

template<typename S >
bool olb::RegularCachedIndicatorF3D< S >::distance ( S & distance,
const S input[] )
inlineoverridevirtual

Reimplemented from olb::IndicatorF3D< S >.

Definition at line 170 of file indicatorBaseF3D.h.

170 {
171 return _indicatorF.distance(distance, input);
172 }
virtual bool distance(S &distance, const Vector< S, 3 > &origin, S precision, const Vector< S, 3 > &direction)
bool distance(S &distance, const Vector< S, 3 > &origin, S precision, const Vector< S, 3 > &direction) override

References olb::RegularCachedIndicatorF3D< S >::distance().

+ Here is the call graph for this function:

◆ distance() [2/5]

template<typename S >
bool olb::RegularCachedIndicatorF3D< S >::distance ( S & distance,
const Vector< S, 3 > & origin )
inlineoverridevirtual

Reimplemented from olb::IndicatorF3D< S >.

Definition at line 167 of file indicatorBaseF3D.h.

167 {
168 return _indicatorF.distance(distance, origin);
169 }

References olb::RegularCachedIndicatorF3D< S >::distance().

+ Here is the call graph for this function:

◆ distance() [3/5]

template<typename S >
bool olb::RegularCachedIndicatorF3D< S >::distance ( S & distance,
const Vector< S, 3 > & origin,
const Vector< S, 3 > & direction,
int iC = -1 )
inlineoverridevirtual

Reimplemented from olb::IndicatorF3D< S >.

Definition at line 164 of file indicatorBaseF3D.h.

164 {
165 return _indicatorF.distance(distance, origin, direction, iC);
166 }

References olb::RegularCachedIndicatorF3D< S >::distance().

+ Here is the call graph for this function:

◆ distance() [4/5]

template<typename S >
bool olb::RegularCachedIndicatorF3D< S >::distance ( S & distance,
const Vector< S, 3 > & origin,
const Vector< S, 3 > & direction,
S precision,
S pitch )
inlineoverridevirtual

Reimplemented from olb::IndicatorF3D< S >.

Definition at line 161 of file indicatorBaseF3D.h.

161 {
162 return _indicatorF.distance(distance, origin, direction, precision, pitch);
163 }

References olb::RegularCachedIndicatorF3D< S >::distance().

+ Here is the call graph for this function:

◆ distance() [5/5]

template<typename S >
bool olb::RegularCachedIndicatorF3D< S >::distance ( S & distance,
const Vector< S, 3 > & origin,
S precision,
const Vector< S, 3 > & direction )
inlineoverridevirtual
Returns
false or true and pos. distance if there was one found for a given origin and direction. Mind that the default computation is done by a numerical approximation which searches .. [TODO: CYRIL]

Reimplemented from olb::IndicatorF3D< S >.

Definition at line 158 of file indicatorBaseF3D.h.

158 {
159 return _indicatorF.distance(distance, origin, precision, direction);
160 }

References olb::RegularCachedIndicatorF3D< S >::distance().

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

◆ getMax()

template<typename S >
Vector< S, 3 > & olb::RegularCachedIndicatorF3D< S >::getMax ( )
inlineoverridevirtual

Reimplemented from olb::IndicatorF3D< S >.

Definition at line 155 of file indicatorBaseF3D.h.

155 {
156 return _indicatorF.getMax();
157 }
virtual Vector< S, 3 > & getMax()

◆ getMin()

template<typename S >
Vector< S, 3 > & olb::RegularCachedIndicatorF3D< S >::getMin ( )
inlineoverridevirtual

Reimplemented from olb::IndicatorF3D< S >.

Definition at line 152 of file indicatorBaseF3D.h.

152 {
153 return _indicatorF.getMin();
154 }
virtual Vector< S, 3 > & getMin()

◆ load()

template<typename S >
bool olb::RegularCachedIndicatorF3D< S >::load ( std::string fileName)
inline

Definition at line 148 of file indicatorBaseF3D.h.

148 {
149 return _cache.load(fileName);
150 }
bool load(std::string fileName="", const bool enforceUint=false)
Load Serializable from file fileName

References olb::Serializable::load().

+ Here is the call graph for this function:

◆ normal()

template<typename S >
bool olb::RegularCachedIndicatorF3D< S >::normal ( Vector< S, 3 > & normal,
const Vector< S, 3 > & origin,
const Vector< S, 3 > & direction,
int iC = -1 )
inlineoverridevirtual

returns true and the normal if there was one found for an given origin and direction

(mind that the default computation is done by a numerical approximation which searches .. [TODO])

find perpendicular vector to direction

Loop 3 times to find three points on the surface to use for normal calc. orthogonal to direction vector 120 degree to each other

rotate directionPerpN through 3 angles {0,120,240}

Find 'positive' angle

Calculate Normal

Reimplemented from olb::IndicatorF3D< S >.

Definition at line 173 of file indicatorBaseF3D.h.

173 {
174 return _indicatorF.normal(normal, origin, direction, iC);
175 }
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
bool normal(Vector< S, 3 > &normal, const Vector< S, 3 > &origin, const Vector< S, 3 > &direction, int iC=-1) override
returns true and the normal if there was one found for an given origin and direction

References olb::RegularCachedIndicatorF3D< S >::normal().

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

◆ operator()()

template<typename S >
bool olb::RegularCachedIndicatorF3D< S >::operator() ( bool output[1],
const S input[3] )
inlineoverridevirtual

Returns true if input is inside the indicator.

Reimplemented from olb::IndicatorF3D< S >.

Definition at line 126 of file indicatorBaseF3D.h.

126 {
127 Vector<int,3> latticeR{};
128 if (_cacheCuboid.getLatticeR(input, latticeR)) {
129 std::size_t iCell = _cacheBlock.getCellId(latticeR);
130 if (_cache[iCell] == 0) {
131 bool result;
132 _indicatorF(&result, input);
133 _cache[iCell] = result ? 1 : 2;
134 output[0] = result;
135 return true;
136 } else {
137 output[0] = _cache[iCell] == 1;
138 return true;
139 }
140 } else {
141 return _indicatorF(output, input);
142 }
143 }
CellID getCellId(LatticeR< D > latticeR) const
Get 1D cell ID.

References olb::BlockStructureD< D >::getCellId(), and olb::Cuboid< T, D >::getLatticeR().

+ Here is the call graph for this function:

◆ rotOnAxis()

template<typename S >
bool olb::RegularCachedIndicatorF3D< S >::rotOnAxis ( Vector< S, 3 > & vec_rot,
const Vector< S, 3 > & vec,
const Vector< S, 3 > & axis,
S & theta )
inlineoverridevirtual

Rotate vector around axis by angle theta.

http://mathworld.wolfram.com/RodriguesRotationFormula.html https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula

Reimplemented from olb::IndicatorF3D< S >.

Definition at line 176 of file indicatorBaseF3D.h.

176 {
177 return _indicatorF.rotOnAxis(vec_rot, vec, axis, theta);
178 }
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.

◆ save()

template<typename S >
bool olb::RegularCachedIndicatorF3D< S >::save ( std::string fileName)
inline

Definition at line 145 of file indicatorBaseF3D.h.

145 {
146 return _cache.save(fileName);
147 }
bool save(std::string fileName="", const bool enforceUint=false)
Save Serializable into file fileName

References olb::Serializable::save().

+ Here is the call graph for this function:

◆ signedDistance()

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

Returns signed distance to the nearest point on the indicator surface Uses the fastest, but potentially less accurate method.

Reimplemented from olb::IndicatorF3D< S >.

Definition at line 180 of file indicatorBaseF3D.h.

180 {
181 return _indicatorF.signedDistance(input);
182 }
virtual S signedDistance(const Vector< S, 3 > &input)
Returns signed distance to the nearest point on the indicator surface Uses the fastest,...

◆ surfaceNormal()

template<typename S >
Vector< S, 3 > olb::RegularCachedIndicatorF3D< S >::surfaceNormal ( const Vector< S, 3 > & pos,
const S meshSize )
inlineoverridevirtual

Return surface normal Uses the fastest, but potentially less accurate method.

Reimplemented from olb::IndicatorF3D< S >.

Definition at line 183 of file indicatorBaseF3D.h.

183 {
184 return _indicatorF.surfaceNormal(pos, meshSize);
185 }
virtual Vector< S, 3 > surfaceNormal(const Vector< S, 3 > &pos, const S meshSize)
Return surface normal Uses the fastest, but potentially less accurate method.

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