44 void Foam::blockEdges::arcEdge::calc(
const point& pA)
46 const tensor dps(pA - p0_, pA - p1_, (pA - p0_)^(pA - p1_));
47 const tensor pMs((p0_ + pA)/2, (p1_ + pA)/2, pA);
49 if (
det(dps) < vSmall)
52 <<
"Arc point " << pA <<
" lies on the line of edge "
58 &
vector(dps.x() & pMs.x(), dps.y() & pMs.y(), dps.z() & pMs.z());
60 const vector r0 = p0_ -
c, r1 = p1_ -
c;
61 const scalar cosT = (r0 & r1)/(
mag(r0)*
mag(r1));
63 if (((r0 ^ r1) & dps.z()) > 0)
75 void Foam::blockEdges::arcEdge::calc(
const scalar theta,
const vector& axis)
77 if (0 >= theta || theta >= 360)
80 <<
"Arc angle for edge " << edge(start_, end_)
81 <<
" must take a value between 0 and 360 degrees"
85 const vector dp = p1_ - p0_;
87 const vector pM = (p0_ + p1_)/2;
90 const scalar l = dp & axis;
92 const vector chord = dp - l*axis;
93 const scalar magChord =
mag(chord);
95 centre_ = pM - l*axis/2 - rM*magChord/2/
tan(theta/2);
114 p0_(points_[start_]),
121 token firstToken(is);
142 if (lambda < - small || lambda > 1 + small)
145 <<
"Parameter out of range, lambda = " <<
lambda
149 const scalar t = theta_*
lambda;
150 const vector r1 = p0_ - centre_, r2 = axis_ ^ r1;
152 return centre_ + r1*
cos(t) + r2*
sin(t) + axis_*length_*
lambda;
158 const vector r1 = p0_ - centre_;
Macros for easy insertion into run-time selection tables.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void putBack(const token &)
Put back token.
Define a curved edge that is parameterised for 0<lambda<1 between the start and end point.
An arcEdge between two points on a circle. The arc is defined either by a third point that the arc pa...
arcEdge(const dictionary &dict, const label index, const searchableSurfaces &geometry, const pointField &points, Istream &)
Construct from Istream setting pointsList.
scalar length() const
Return the length of the curve.
point position(const scalar) const
Return the point position corresponding to the curve parameter.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Container for searchableSurfaces.
A token holds items read from Istream.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedScalar lambda(viscosity->lookup("lambda"))
defineTypeNameAndDebug(arcEdge, 0)
addToRunTimeSelectionTable(blockEdge, arcEdge, Istream)
const dimensionedScalar c
Speed of light in a vacuum.
dimensionedScalar det(const dimensionedSphericalTensor &dt)
dimensionedScalar tan(const dimensionedScalar &ds)
scalar degToRad(const scalar deg)
Convert degrees to radians.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Tensor< scalar > tensor
Tensor of scalars.
errorManip< error > abort(error &err)
dimensionedScalar sin(const dimensionedScalar &ds)
vector point
Point is a vector.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
Vector< scalar > vector
A scalar version of the templated Vector.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensionSet normalised(const dimensionSet &)
dimensioned< scalar > mag(const dimensioned< Type > &)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
dimensionedScalar cos(const dimensionedScalar &ds)
dimensionedScalar acos(const dimensionedScalar &ds)