75 const scalar magAxis1(
mag(axis1));
76 scalar magAxis2(
mag(axis2));
78 if (magAxis1 < ROOTVSMALL)
81 <<
"Dominant coordinate axis cannot have zero length"
86 const vector ax1(axis1 / magAxis1);
89 if (magAxis2 < ROOTVSMALL)
95 ax2.removeCollinear(ax1);
102 <<
"axis1, axis2 appear to be co-linear: "
103 << axis1 <<
", " << axis2 <<
" Revert to guessing axis2"
108 ax2.removeCollinear(ax1);
112 if (magAxis2 < SMALL)
115 <<
"Could not find an appropriate second axis"
132 rotTensor.col<0>(ax1);
133 rotTensor.col<1>(ax2);
134 rotTensor.col<2>(ax1^ax2);
139 rotTensor.col<0>(ax1^ax2);
140 rotTensor.col<1>(ax1);
141 rotTensor.col<2>(ax2);
147 rotTensor.col<0>(ax2);
148 rotTensor.col<1>(ax1^ax2);
149 rotTensor.col<2>(ax1);
164 dict.readIfPresent(
"e1", axis1_)
165 &&
dict.readIfPresent(
"e2", axis2_)
172 dict.readIfPresent(
"e2", axis1_)
173 &&
dict.readIfPresent(
"e3", axis2_)
180 dict.readIfPresent(
"e3", axis1_)
181 &&
dict.readIfPresent(
"e1", axis2_)
188 dict.readIfPresent(
"axis", axis1_)
189 &&
dict.readIfPresent(
"direction", axis2_)
192 order_ = E3_E1_COMPAT;
197 <<
"No entries of the type (e1, e2) or (e2, e3) or (e3, e1) found"
274 os <<
"e1: " << axis1_ <<
" e2: " << axis2_;
277 os <<
"e2: " << axis1_ <<
" e3: " << axis2_;
280 os <<
"e1: " << axis2_ <<
" e3: " << axis1_;
298 const bool subDict = !keyword.empty();
302 os.beginBlock(keyword);
303 os.writeEntry(
"type",
type());
310 os.writeEntry(
"e1", axis1_);
311 os.writeEntry(
"e2", axis2_);
316 os.writeEntry(
"e2", axis1_);
317 os.writeEntry(
"e3", axis2_);
322 os.writeEntry(
"e1", axis2_);
323 os.writeEntry(
"e3", axis1_);
328 os.writeEntry(
"axis", axis1_);
329 os.writeEntry(
"direction", axis2_);
Macros for easy insertion into run-time selection tables.
#define addAliasToRunTimeSelectionTable(baseType, thisType, argNames, lookup, other, ver)
Add lookup alias for runTime selection.
#define addNamedToRunTimeSelectionTable(baseType, thisType, argNames, lookupName)
Add to construction table with 'lookupName' as the key.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Vector< Cmpt > col() const
Extract vector for given column: compile-time check of index.
Vector< Cmpt > & removeCollinear(const Vector< Cmpt > &unitVec)
Inplace removal of components that are collinear to the given unit vector.
User specification of a coordinate rotation.
static vector findOrthogonal(const vector &axis)
Determine best-guess for an orthogonal axis.
A coordinateRotation specified using global axes.
axes()
Default construct - an identity transform.
virtual tensor R() const
The rotation tensor calculated from the specified axes and order.
void read(const dictionary &dict)
Read from dictionary.
virtual void write(Ostream &os) const
Write information.
virtual void writeEntry(const word &keyword, Ostream &os) const
Write dictionary entry.
axisOrder order_
The axis order.
vector axis1_
The primary axis.
axisOrder
The order/combination of local axes for the axes-rotation definition.
@ E2_E3
The axis1 (dominant) is local Y, axis2 is local Z.
@ E1_E2
The axis1 (dominant) is local X, axis2 is local Y.
@ E3_E1_COMPAT
E3_E1 specified as axis/direction.
@ E3_E1
The axis1 (dominant) is local Z, axis2 is local X.
virtual void clear()
Reset specification.
vector axis2_
The secondary axis.
static tensor rotation(const vector &axis1, const vector &axis2, axisOrder order=E3_E1)
The rotation tensor calculated from two axes and their order.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
#define defineTypeName(Type)
Define the typeName.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for coordinate system rotations.
bool read(const char *buf, int32_t &val)
Same as readInt32.
coordinateRotations::axes axesRotation
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).