28#ifndef SMOOTHINDICATOR_INTERACTION_H
29#define SMOOTHINDICATOR_INTERACTION_H
43template <
typename T,
typename S,
typename PARTICLETYPE>
47 using namespace descriptors;
48 constexpr unsigned D = PARTICLETYPE::d;
50 const PhysR<T, D> position = particle.template getField<GENERAL, POSITION>();
51 if constexpr (PARTICLETYPE::template providesNested<SURFACE, ROT_MATRIX>()) {
53 util::invertRotationMatrix<T, D>(
54 particle.template getField<SURFACE, ROT_MATRIX>());
55 return util::executeRotation<T, D, true>(input, rotationMatrix, position);
58 return input - position;
61 __builtin_unreachable();
64template <
typename T,
typename S,
typename PARTICLETYPE>
69 constexpr unsigned D = PARTICLETYPE::d;
70 using namespace descriptors;
72 if constexpr (PARTICLETYPE::template providesNested<SURFACE, ROT_MATRIX>()) {
74 util::invertRotationMatrix<T, D>(
75 particle.template getField<SURFACE, ROT_MATRIX>());
76 return util::executeRotation<T, D>(direction, rotationMatrix);
82 __builtin_unreachable();
85template <
typename T,
typename S,
typename PARTICLETYPE>
89 using namespace descriptors;
92 sIndicator->getCircumRadius();
95template <
typename T,
typename S,
typename PARTICLETYPE>
99 using namespace descriptors;
107 return sIndicator->signedDistance(newInput) <= 0;
110template <
typename T,
typename S,
typename PARTICLETYPE>
114 using namespace descriptors;
115 auto sIndicator = particle.template getField<SURFACE, SINDICATOR>();
119 if constexpr (access::providesElongation<PARTICLETYPE>()) {
120 const unsigned D = PARTICLETYPE::d;
124 return sIndicator->signedDistance(input);
129 constexpr bool symmetryCheck =
false;
130 return sdf::elongation<T, symmetryCheck>(sdf, newInput, elongation);
133 return sIndicator->signedDistance(newInput);
137template <
typename T,
typename S,
typename PARTICLETYPE>
141 S precision, S pitch)
143 using namespace descriptors;
144 auto sIndicator = particle.template getField<SURFACE, SINDICATOR>();
150 distance, input, dir, precision, pitch,
151 [&](
bool output[1],
const T input[3]) {
152 output[0] = sIndicator->signedDistance(
158 return norm(pos) <= 1.5 * sIndicator->getCircumRadius();
165 clout <<
"WARNING: Distance to particle in direction "
166 <<
normalize(direction) <<
" couldn't be calculated." << std::endl;
171 __builtin_unreachable();
174template <
typename T,
typename S,
typename PARTICLETYPE>
180 using namespace descriptors;
181 auto sIndicator = particle.template getField<SURFACE, SINDICATOR>();
187 distance, input, dir, precision,
189 return sIndicator->signedDistance(input);
193 return norm(pos) <= 1.5 * sIndicator->getCircumRadius();
200 clout <<
"WARNING: Distance to particle in direction "
201 <<
normalize(direction) <<
" couldn't be calculated." << std::endl;
206 __builtin_unreachable();
209template <
typename T,
typename S,
typename PARTICLETYPE>
214 using namespace descriptors;
215 constexpr unsigned D = PARTICLETYPE::d;
216 auto sIndicator = particle.template getField<SURFACE, SINDICATOR>();
219 return sIndicator->surfaceNormal(pos, meshSize, [&](
const Vector<S, D>& pos) {
224template <
typename T,
typename S,
typename PARTICLETYPE>
228 using namespace descriptors;
229 auto sIndicator = particle.template getField<SURFACE, SINDICATOR>();
233 sIndicator->getEpsilon());
class for marking output with some text
Vector< T, PARTICLETYPE::d > getElongation(Particle< T, PARTICLETYPE > particle)
auto getSmoothIndicatorPtr(Particle< T, PARTICLETYPE > particle)
Vector< T, PARTICLETYPE::d > getPosition(Particle< T, PARTICLETYPE > particle)
PhysR< S, PARTICLETYPE::d > transformDirection(Particle< T, PARTICLETYPE > &particle, const PhysR< S, PARTICLETYPE::d > &direction)
const S distanceToParticle(Particle< T, PARTICLETYPE > &particle, const Vector< S, PARTICLETYPE::d > &origin, const Vector< S, PARTICLETYPE::d > &direction, S precision, S pitch)
bool isInsideCircumRadius(Particle< T, PARTICLETYPE > &particle, const PhysR< S, PARTICLETYPE::d > &input)
PhysR< S, PARTICLETYPE::d > transformInput(Particle< T, PARTICLETYPE > &particle, const PhysR< S, PARTICLETYPE::d > &input)
Vector< S, PARTICLETYPE::d > normalOnParticleSurface(Particle< T, PARTICLETYPE > &particle, const Vector< S, PARTICLETYPE::d > &pos, const T meshSize)
bool isInsideParticle(Particle< T, PARTICLETYPE > &particle, const PhysR< S, PARTICLETYPE::d > &input)
const S signedDistanceToParticle(Particle< T, PARTICLETYPE > &particle, const PhysR< S, PARTICLETYPE::d > &input)
bool evalSolidVolumeFraction(T output[], const S input[], Particle< T, PARTICLETYPE > &particle)
bool evalSolidVolumeFraction(T output[], T signedDist, T eps) any_platform
bool distance(S &distance, const Vector< S, D > &origin, const Vector< S, D > &direction, S precision, S pitch, F1 isInside, F2 isInsideBoundingBox)
Top level namespace for all of OpenLB.
constexpr T norm(const ScalarVector< T, D, IMPL > &a)
Euclidean vector norm.
constexpr Vector< T, D > normalize(const ScalarVector< T, D, IMPL > &a, T scale=T{1})