OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
olb::SmoothIndicatorF2D< T, S, true > Class Template Reference

SmoothIndicatorF2D is an application from $ \Omega \subset R^3 \to [0,1] $. More...

#include <smoothIndicatorBaseF2D.h>

+ Inheritance diagram for olb::SmoothIndicatorF2D< T, S, true >:
+ Collaboration diagram for olb::SmoothIndicatorF2D< T, S, true >:

Public Member Functions

const S & getCircumRadius () const
 
const S & getEpsilon () const
 
std::string name ()
 
void setEpsilon (S epsilon)
 
virtual S getArea ()
 
virtual Vector< S, 2 > calcMofiAndMass (S density)
 
virtual Vector< S, 2 > surfaceNormal (const Vector< S, 2 > &pos, const S meshSize)
 
virtual Vector< S, 2 > surfaceNormal (const Vector< S, 2 > &pos, const S meshSize, std::function< Vector< S, 2 >(const Vector< S, 2 > &)> transformPos)
 
virtual const S signedDistance (const PhysR< T, 2 > input)
 
virtual bool distance (S &distance, const Vector< S, 2 > &origin, const Vector< S, 2 > &direction, S precision, S pitch)
 
virtual bool operator() (T output[], const S input[])
 has to be implemented for 'every' derived class
 
bool isInsideCircumRadius (const PhysR< S, 2 > &input)
 
- Public Member Functions inherited from olb::AnalyticalF< D, T, S >
AnalyticalF< D, T, S > & operator- (AnalyticalF< D, T, S > &rhs)
 
AnalyticalF< D, T, S > & operator+ (AnalyticalF< D, T, S > &rhs)
 
AnalyticalF< D, T, S > & operator* (AnalyticalF< D, T, S > &rhs)
 
AnalyticalF< D, T, S > & operator/ (AnalyticalF< D, T, S > &rhs)
 
- 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
 
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)
 

Protected Member Functions

 SmoothIndicatorF2D ()
 
- Protected Member Functions inherited from olb::AnalyticalF< D, T, S >
 AnalyticalF (int n)
 
- Protected Member Functions inherited from olb::GenericF< T, S >
 GenericF (int targetDim, int sourceDim)
 

Protected Attributes

_circumRadius
 
_epsilon
 
std::string _name = "2D-Particle surface"
 

Additional Inherited Members

- Public Types inherited from olb::AnalyticalF< D, T, S >
using identity_functor_type = AnalyticalIdentity<D,T,S>
 
- 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::AnalyticalF< D, T, S >
static constexpr unsigned dim = D
 

Detailed Description

template<typename T, typename S>
class olb::SmoothIndicatorF2D< T, S, true >

SmoothIndicatorF2D is an application from $ \Omega \subset R^3 \to [0,1] $.

Base class for specific SmoothIndicator implementation providing common data.

Definition at line 97 of file smoothIndicatorBaseF2D.h.

Constructor & Destructor Documentation

◆ SmoothIndicatorF2D()

template<typename T , typename S >
olb::SmoothIndicatorF2D< T, S, true >::SmoothIndicatorF2D ( )
protected

Member Function Documentation

◆ calcMofiAndMass()

template<typename T , typename S >
Vector< S, 2 > olb::SmoothIndicatorF2D< T, S, true >::calcMofiAndMass ( S density)
virtual

Definition at line 273 of file smoothIndicatorBaseF2D.hh.

274{
275 // TODO: Fallback
276 assert(false);
277 return S(std::numeric_limits<BaseType<S>>::quiet_NaN());
278}

◆ distance()

template<typename T , typename S >
bool olb::SmoothIndicatorF2D< T, S, true >::distance ( S & distance,
const Vector< S, 2 > & origin,
const Vector< S, 2 > & direction,
S precision,
S pitch )
virtual

Definition at line 306 of file smoothIndicatorBaseF2D.hh.

307{
308 S const halfEps = this->getEpsilon() * 0.5;
309 bool originValue;
310 bool currentValue;
311
312 // start at origin and move into given direction
313 PhysR<S,2> currentPoint(origin);
314
315 originValue = this->signedDistance(origin) <= halfEps;
316 currentValue = this->signedDistance(currentPoint) <= halfEps;
317
318 while (currentValue == originValue && this->isInsideCircumRadius(currentPoint)) {
319 currentPoint += direction;
320 // update currentValue until the first point on the other side (inside/outside) is found
321 currentValue = this->signedDistance(currentPoint) <= halfEps;
322 }
323
324 // return false if no point was found in given direction
325 if (!this->isInsideCircumRadius(currentPoint) && !originValue) {
326 return false;
327 }
328
329
330 while (pitch >= precision) {
331 if (!this->isInsideCircumRadius(currentPoint) && originValue) {
332 currentPoint -= pitch * direction;
333 pitch /= 2.;
334 }
335 else {
336 currentValue = this->signedDistance(currentPoint) <= halfEps;
337 if (currentValue == originValue) {
338 currentPoint += pitch * direction;
339 pitch /= 2.;
340 }
341 else {
342 currentPoint -= pitch * direction;
343 pitch /= 2.;
344 }
345 }
346 }
347
348 distance = norm(currentPoint - origin);
349 return true;
350}
virtual bool distance(S &distance, const Vector< S, 2 > &origin, const Vector< S, 2 > &direction, S precision, S pitch)
bool isInsideCircumRadius(const PhysR< S, 2 > &input)
virtual const S signedDistance(const PhysR< T, 2 > input)
constexpr T norm(const ScalarVector< T, D, IMPL > &a)
Euclidean vector norm.

References olb::norm().

+ Here is the call graph for this function:

◆ getArea()

template<typename T , typename S >
S olb::SmoothIndicatorF2D< T, S, true >::getArea ( )
virtual

Definition at line 265 of file smoothIndicatorBaseF2D.hh.

266{
267 // TODO: Fallback
268 assert(false);
269 return std::numeric_limits<double>::quiet_NaN();
270}

◆ getCircumRadius()

template<typename T , typename S >
const S & olb::SmoothIndicatorF2D< T, S, true >::getCircumRadius ( ) const

Definition at line 241 of file smoothIndicatorBaseF2D.hh.

242{
243 return _circumRadius;
244}

◆ getEpsilon()

template<typename T , typename S >
const S & olb::SmoothIndicatorF2D< T, S, true >::getEpsilon ( ) const

Definition at line 247 of file smoothIndicatorBaseF2D.hh.

248{
249 return _epsilon;
250}

◆ isInsideCircumRadius()

template<typename T , typename S >
bool olb::SmoothIndicatorF2D< T, S, true >::isInsideCircumRadius ( const PhysR< S, 2 > & input)

Definition at line 364 of file smoothIndicatorBaseF2D.hh.

365{
366 return norm(input) <= this->getCircumRadius();
367}

References olb::norm().

+ Here is the call graph for this function:

◆ name()

template<typename T , typename S >
std::string olb::SmoothIndicatorF2D< T, S, true >::name ( )

Definition at line 253 of file smoothIndicatorBaseF2D.hh.

254{
255 return _name;
256}

◆ operator()()

template<typename T , typename S >
bool olb::SmoothIndicatorF2D< T, S, true >::operator() ( T output[],
const S input[] )
virtual

has to be implemented for 'every' derived class

Implements olb::GenericF< T, S >.

Definition at line 353 of file smoothIndicatorBaseF2D.hh.

354{
355#ifdef OLB_DEBUG
356 OstreamManager clout(std::cout, "SmoothIndicator2D");
357 clout << "WARNING: SmoothIndicatorF2D::operator() a particle (= true) SmoothIndicator does not consider the current position of the particle. Please use the evalSolidVolumeFraction method for this." << std::endl;
358#endif
359 T const signedDist = this->signedDistance(input);
360 return sdf::evalSolidVolumeFraction(output, signedDist, this->getEpsilon());
361}
bool evalSolidVolumeFraction(T output[], T signedDist, T eps) any_platform
Definition sdf.h:453

References olb::sdf::evalSolidVolumeFraction().

+ Here is the call graph for this function:

◆ setEpsilon()

template<typename T , typename S >
void olb::SmoothIndicatorF2D< T, S, true >::setEpsilon ( S epsilon)

Definition at line 259 of file smoothIndicatorBaseF2D.hh.

260{
261 _epsilon = epsilon;
262}

◆ signedDistance()

template<typename T , typename S >
const S olb::SmoothIndicatorF2D< T, S, true >::signedDistance ( const PhysR< T, 2 > input)
virtual

Definition at line 298 of file smoothIndicatorBaseF2D.hh.

299{
300 // TODO: Raymarching as fallback
301 assert(false);
302 return std::numeric_limits<double>::quiet_NaN();
303}

◆ surfaceNormal() [1/2]

template<typename T , typename S >
Vector< S, 2 > olb::SmoothIndicatorF2D< T, S, true >::surfaceNormal ( const Vector< S, 2 > & pos,
const S meshSize )
virtual

Definition at line 281 of file smoothIndicatorBaseF2D.hh.

282{
283 return surfaceNormal(pos, meshSize, [&](const Vector<S,2>& pos) {
284 return pos;
285 });
286}
virtual Vector< S, 2 > surfaceNormal(const Vector< S, 2 > &pos, const S meshSize)

◆ surfaceNormal() [2/2]

template<typename T , typename S >
Vector< S, 2 > olb::SmoothIndicatorF2D< T, S, true >::surfaceNormal ( const Vector< S, 2 > & pos,
const S meshSize,
std::function< Vector< S, 2 >(const Vector< S, 2 > &)> transformPos )
virtual

Definition at line 289 of file smoothIndicatorBaseF2D.hh.

291{
292 return util::surfaceNormal(pos, meshSize, [&](const Vector<S,2>& pos) {
293 return this->signedDistance( transformPos(pos) );
294 });
295}
Vector< S, D > surfaceNormal(const Vector< S, D > &pos, const S meshSize, F1 sdf)

References olb::util::surfaceNormal().

+ Here is the call graph for this function:

Member Data Documentation

◆ _circumRadius

template<typename T , typename S >
S olb::SmoothIndicatorF2D< T, S, true >::_circumRadius
protected

Definition at line 100 of file smoothIndicatorBaseF2D.h.

◆ _epsilon

template<typename T , typename S >
S olb::SmoothIndicatorF2D< T, S, true >::_epsilon
protected

Definition at line 101 of file smoothIndicatorBaseF2D.h.

◆ _name

template<typename T , typename S >
std::string olb::SmoothIndicatorF2D< T, S, true >::_name = "2D-Particle surface"
protected

Definition at line 102 of file smoothIndicatorBaseF2D.h.


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