13#ifndef DUMUX_MULTIDOMAIN_EMBEDDED_CIRCLEPOINTS_HH
14#define DUMUX_MULTIDOMAIN_EMBEDDED_CIRCLEPOINTS_HH
19#include <dune/common/exceptions.hh>
37template<
class GlobalPosition,
class Scalar>
39 const std::vector<Scalar>& sincos,
40 const GlobalPosition&
center,
41 const GlobalPosition&
normal,
44 assert(sincos.size() % 2 == 0 &&
"Sample angles have to be pairs of sin/cos so size needs to be even.");
45 static_assert(GlobalPosition::dimension == 3,
"Only implemented for world dimension 3");
48 const std::size_t numPoints = sincos.size()/2;
49 points.resize(numPoints);
60 tangent *= radius/tangent.two_norm();
63 for (std::size_t i = 0; i < numPoints; ++i)
65 points[i] = GlobalPosition({u[0]*sincos[2*i+1] + tangent[0]*sincos[2*i] +
center[0],
66 u[1]*sincos[2*i+1] + tangent[1]*sincos[2*i] +
center[1],
67 u[2]*sincos[2*i+1] + tangent[2]*sincos[2*i] +
center[2]});
76template<
class Scalar =
double>
79 std::vector<Scalar> sincos(2*numPoints);
81 for (std::size_t i = 0; i < numPoints; ++i)
83 using std::sin;
using std::cos;
85 sincos[2*i + 1] = cos(t);
86 t += 2*M_PI/numPoints;
87 if(t > 2*M_PI) t -= 2*M_PI;
100template<
class GlobalPosition,
class Scalar>
102 const GlobalPosition&
normal,
104 const std::size_t numPoints = 20)
107 const auto sincos = circlePointsSinCos<Scalar>(numPoints);
109 std::vector<GlobalPosition> points;
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:642
std::vector< Scalar > circlePointsSinCos(const std::size_t numPoints)
returns a vector of sin and cos values of a circle parametrization
Definition: circlepoints.hh:77
void circlePoints(std::vector< GlobalPosition > &points, const std::vector< Scalar > &sincos, const GlobalPosition ¢er, const GlobalPosition &normal, const Scalar radius)
Definition: circlepoints.hh:38
Vector normal(const Vector &v)
Create a vector normal to the given one (v is expected to be non-zero)
Definition: normal.hh:26
Vector unitNormal(const Vector &v)
Create a vector normal to the given one (v is expected to be non-zero)
Definition: normal.hh:58
Corners::value_type center(const Corners &corners)
The center of a given list of corners.
Definition: center.hh:24
Define some often used mathematical functions.
Definition: circlepoints.hh:24
Helper functions for normals.