24#ifndef INDICATOR_BASE_F_2D_HH
25#define INDICATOR_BASE_F_2D_HH
35#define M_PI 3.14159265358979323846
59 this->operator()(&output, input);
85 return this->signedDistance(input);
88 return isInsideBox(pos);
95 return util::distance(distance, origin, direction, precision, pitch,
96 [&](
bool output[1],
const S input[2]) {
97 return (*
this)(output, input);
100 return isInsideBox(pos);
109 return this->distance(distance, origin, direction, precision, pitch);
115 S input[3] = {origin[0],origin[1],origin[2]};
116 return this->distance(distance, input);
122 distance =
util::abs(signedDistance(input));
139 (*this)(&originValue, origin.
data());
145 distance(dist, origin, direction, iC);
164 currentPoint = POS + vec;
165 (*this)(¤tValue, currentPoint.data());
167 if (currentValue == originValue) {
177 point1 = currentPoint;
180 point2 = currentPoint;
184 normal =
Vector<S,2>((point2[1] - point1[1]), (-1)*(point2[0] - point1[0]));
197 return point >= _myMin && point <= _myMax;
203 return this->signedDistance(input) <= 0;
219 return std::numeric_limits<double>::quiet_NaN();
227 return this->signedDistance(pos);
235 return this->surfaceNormal(transformPos(pos), meshSize);
241 output[0] = this->operator()(input);
249 return (_f)->operator()(output, input);
GenericF is a base class, that can represent continuous as well as discrete functions.
virtual bool operator()(const S input[])
Indicator specific function operator overload.
virtual Vector< S, 1 > & getMin()
virtual Vector< S, 1 > & getMax()
IndicatorF2D is an application from .
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 Vector< S, 2 > surfaceNormal(const Vector< S, 2 > &pos, const S meshSize)
Return surface normal.
virtual Vector< S, 2 > & getMin()
virtual bool operator()(bool output[1], const S input[2])
Returns true if input is inside the indicator.
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 Vector< S, 2 > & getMax()
virtual S signedDistance(const Vector< S, 2 > &input)
Returns signed distance to the nearest point on the indicator surface.
bool isInsideBox(Vector< S, 2 > point)
Returns true if point is inside a cube with corners _myMin and _myMax
IndicatorIdentity2D(std::shared_ptr< IndicatorF2D< S > > f)
bool operator()(bool output[1], const S input[2])
Returns true if input is inside the indicator.
std::shared_ptr< IndicatorF2D< S > > _f
constexpr const T * data() const any_platform
ADf< T, DIM > abs(const ADf< T, DIM > &a)
bool distance(S &distance, const Vector< S, D > &origin, const Vector< S, D > &direction, S precision, S pitch, F1 isInside, F2 isInsideBoundingBox)
Vector< S, D > surfaceNormal(const Vector< S, D > &pos, const S meshSize, F1 sdf)
ADf< T, DIM > sin(const ADf< T, DIM > &a)
decltype(Vector< decltype(util::sqrt(T())), D >()) degreeToRadian(const Vector< T, D > &angle)
ADf< T, DIM > cos(const ADf< T, DIM > &a)
Top level namespace for all of OpenLB.
constexpr T norm(const ScalarVector< T, D, IMPL > &a)
Euclidean vector norm.