47void Foam::blockEdges::arcEdge::calcFromMidPoint
58 const scalar asqr = a & a;
59 const scalar bsqr =
b &
b;
60 const scalar adotb = a &
b;
62 const scalar denom = asqr*bsqr - adotb*adotb;
64 if (
mag(denom) < ROOTVSMALL)
71 const scalar fact = 0.5*(bsqr - adotb)/denom;
73 const point centre = p1 + 0.5*a + fact*((a ^
b) ^ a);
76 const vector r1(p1 - centre);
77 const vector r2(p2 - centre);
78 const vector r3(p3 - centre);
80 const scalar mag1(
mag(r1));
81 const scalar mag3(
mag(r3));
90 angle_ =
acos((r1 & r3)/(mag1*mag3));
93 if (((r1 ^ r2) & (r1 ^ r3)) < 0.0)
100 if (
mag(arcAxis)/(mag1*mag3) < 0.001)
111 cs_ = coordSystem::cylindrical(centre, arcAxis, r1);
115void Foam::blockEdges::arcEdge::calcFromCentre
125 const vector r1(p1 - centre);
126 const vector r3(p3 - centre);
128 const scalar mag1(
mag(r1));
129 const scalar mag3(
mag(r3));
131 const vector chord(p3 - p1);
133 const vector arcAxis(r1 ^ r3);
136 radius_ = 0.5*(mag1 + mag3);
139 angle_ =
acos((r1 & r3)/(mag1*mag3));
143 bool needsAdjust =
false;
147 needsAdjust = !
equal(mag1, mag3);
149 if (!
equal(rMultiplier, 1))
155 radius_ *= rMultiplier;
156 radius_ =
max(radius_, (1.001*0.5*
mag(chord)));
167 const point newCentre =
180 calcFromCentre(p1, p3, newCentre,
false);
185 cs_ = coordSystem::cylindrical(centre, arcAxis, r1);
271 scalar rMultiplier = 1;
276 rMultiplier = tok.
number();
311 if (lambda < -SMALL || lambda > 1 + SMALL)
314 <<
"Limit parameter to [0-1] range: " <<
lambda <<
nl;
322 else if (
lambda >= 1 - SMALL)
327 return cs_.globalPosition(
vector(radius_, (
lambda*angle_), 0));
333 return (radius_*angle_);
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void putBack(const token &tok)
Put back a token. Only a single put back is permitted.
Define a curved edge that is parameterized for 0<lambda<1 between the start/end points.
const point & lastPoint() const
The location of the last point.
const label end_
Index of the last point.
const label start_
Index of the first point.
const point & firstPoint() const
The location of the first point.
A blockEdge defined as an arc of a circle.
point position(const scalar lambda) const
The point corresponding to the curve parameter [0-1].
scalar length() const noexcept
The length of the curve.
virtual void write(Ostream &os) const =0
Write information.
virtual const coordinateRotation & rotation() const
The rotation specification.
virtual const point & origin() const
Return origin.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Mid-point interpolation (weighting factors = 0.5) scheme class.
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
A token holds an item read from Istream.
bool isWord() const noexcept
Token is word-variant (WORD, DIRECTIVE)
scalar number() const
Return label, float or double value.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define InfoInFunction
Report an information message using Foam::Info.
constexpr scalar pi(M_PI)
constexpr scalar twoPi(2 *M_PI)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
messageStream Info
Information stream (stdout output on master, null elsewhere)
vector point
Point is a vector.
bool equal(const T &s1, const T &s2)
Compare two values for equality.
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
dimensionedScalar acos(const dimensionedScalar &ds)
constexpr char nl
The newline '\n' character (0x0a)
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
Unit conversion functions.