25#ifndef DUMUX_MULTIDOMAIN_EMBEDDED_CIRCLEPOINTS_HH
26#define DUMUX_MULTIDOMAIN_EMBEDDED_CIRCLEPOINTS_HH
31#include <dune/common/exceptions.hh>
49template<
class GlobalPosition,
class Scalar>
51 const std::vector<Scalar>& sincos,
52 const GlobalPosition&
center,
53 const GlobalPosition&
normal,
56 assert(sincos.size() % 2 == 0 &&
"Sample angles have to be pairs of sin/cos so size needs to be even.");
57 static_assert(GlobalPosition::dimension == 3,
"Only implemented for world dimension 3");
60 const std::size_t numPoints = sincos.size()/2;
61 points.resize(numPoints);
72 tangent *= radius/tangent.two_norm();
75 for (std::size_t i = 0; i < numPoints; ++i)
77 points[i] = GlobalPosition({u[0]*sincos[2*i+1] + tangent[0]*sincos[2*i] +
center[0],
78 u[1]*sincos[2*i+1] + tangent[1]*sincos[2*i] +
center[1],
79 u[2]*sincos[2*i+1] + tangent[2]*sincos[2*i] +
center[2]});
88template<
class Scalar =
double>
91 std::vector<Scalar> sincos(2*numPoints);
93 for (std::size_t i = 0; i < numPoints; ++i)
95 using std::sin;
using std::cos;
97 sincos[2*i + 1] = cos(t);
98 t += 2*M_PI/numPoints;
99 if(t > 2*M_PI) t -= 2*M_PI;
112template<
class GlobalPosition,
class Scalar>
114 const GlobalPosition&
normal,
116 const std::size_t numPoints = 20)
119 const auto sincos = circlePointsSinCos<Scalar>(numPoints);
121 std::vector<GlobalPosition> points;
Define some often used mathematical functions.
Helper functions for normals.
Vector normal(const Vector &v)
Create a vector normal to the given one (v is expected to be non-zero)
Definition: normal.hh:38
Vector unitNormal(const Vector &v)
Create a vector normal to the given one (v is expected to be non-zero)
Definition: normal.hh:70
Corners::value_type center(const Corners &corners)
The center of a given list of corners.
Definition: center.hh:36
Dune::FieldVector< Scalar, 3 > crossProduct(const Dune::FieldVector< Scalar, 3 > &vec1, const Dune::FieldVector< Scalar, 3 > &vec2)
Cross product of two vectors in three-dimensional Euclidean space.
Definition: math.hh:654
std::vector< Scalar > circlePointsSinCos(const std::size_t numPoints)
returns a vector of sin and cos values of a circle parametrization
Definition: circlepoints.hh:89
void circlePoints(std::vector< GlobalPosition > &points, const std::vector< Scalar > &sincos, const GlobalPosition ¢er, const GlobalPosition &normal, const Scalar radius)
Definition: circlepoints.hh:50
Definition: circlepoints.hh:36