45 void Foam::blockEdges::arcEdge::calc(
const point& pA)
47 const tensor dps(pA - p0_, pA - p1_, (pA - p0_)^(pA - p1_));
48 const tensor pMs((p0_ + pA)/2, (p1_ + pA)/2, pA);
50 if (
det(dps) < vSmall)
53 <<
"Arc point " << pA <<
" lies on the line of edge "
59 &
vector(dps.x() & pMs.x(), dps.y() & pMs.y(), dps.z() & pMs.z());
61 const vector r0 = p0_ -
c, r1 = p1_ -
c;
62 const scalar cosT = (r0 & r1)/(
mag(r0)*
mag(r1));
64 if (((r0 ^ r1) & dps.z()) > 0)
76 void Foam::blockEdges::arcEdge::calc(
const scalar theta,
const vector& axis)
78 if (0 >= theta || theta >= 360)
81 <<
"Arc angle for edge " << edge(start_, end_)
82 <<
" must take a value between 0 and 360 degrees"
86 const vector dp = p1_ - p0_;
88 const vector pM = (p0_ + p1_)/2;
91 const scalar l = dp & axis;
93 const vector chord = dp - l*axis;
94 const scalar magChord =
mag(chord);
96 centre_ = pM - l*axis/2 - rM*magChord/2/
tan(theta/2);
115 p0_(points_[start_]),
122 token firstToken(is);
143 if (lambda < - small || lambda > 1 + small)
146 <<
"Parameter out of range, lambda = " <<
lambda
150 const scalar t = theta_*
lambda;
151 const vector r1 = p0_ - centre_, r2 = axis_ ^ r1;
159 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...
scalar length() const
Return the length of the curve.
point position(const scalar) const
Return the point position corresponding to the curve parameter.
arcEdge(const dictionary &dict, const label index, const searchableSurfaceList &geometry, const pointField &points, Istream &)
Construct from Istream setting pointsList.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
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.
unitSet length_(dimensionSet(0, 1, 0, 0, 0), 0, 0, 1)
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.
Tensor< scalar > tensor
Tensor of scalars.
errorManip< error > abort(error &err)
dimensionedScalar sin(const dimensionedScalar &ds)
vector point
Point is a vector.
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
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.
void inv(pointPatchField< tensor > &, const pointPatchField< tensor > &)
dimensionSet normalised(const dimensionSet &)
dimensioned< Type > min(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
void det(pointPatchField< scalar > &, const pointPatchField< tensor > &)
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
tmp< DimensionedField< scalar, GeoMesh, Field > > magSqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
dimensionedScalar cos(const dimensionedScalar &ds)
dimensionedScalar acos(const dimensionedScalar &ds)
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)