76 template<
class GeoField>
77 void readAndRotateFields
88 Info<<
"Transforming " << flds[i].name() <<
endl;
105 readAndRotateFields(vsFlds, mesh, T, objects);
108 readAndRotateFields(vvFlds, mesh, T, objects);
111 readAndRotateFields(vstFlds, mesh, T, objects);
114 readAndRotateFields(vsymtFlds, mesh, T, objects);
117 readAndRotateFields(vtFlds, mesh, T, objects);
122 readAndRotateFields(ssFlds, mesh, T, objects);
125 readAndRotateFields(svFlds, mesh, T, objects);
128 readAndRotateFields(sstFlds, mesh, T, objects);
131 readAndRotateFields(ssymtFlds, mesh, T, objects);
134 readAndRotateFields(stFlds, mesh, T, objects);
141 int main(
int argc,
char *argv[])
147 "translate by the specified <vector> - eg, '(1 0 0)'" 153 "transform in terms of a rotation between <vectorA> and <vectorB> " 154 "- eg, '( (1 0 0) (0 0 1) )'" 160 "transform in terms of '(roll pitch yaw)' in degrees" 166 "transform in terms of '(yaw pitch roll)' in degrees" 171 "read and transform vector and tensor fields too" 177 "scale by the specified amount - eg, '(0.001 0.001 0.001)' for a " 178 "uniform [mm] to [m] scaling" 211 const bool doRotateFields = args.
optionFound(
"rotateFields");
217 <<
"No options supplied, please use one or more of " 218 "-translate, -rotate or -scale options." 225 Info<<
"Translating points by " << v <<
endl;
236 n1n2[0] /=
mag(n1n2[0]);
237 n1n2[1] /=
mag(n1n2[1]);
240 Info<<
"Rotating points by " << T <<
endl;
246 rotateFields(args, runTime, T);
251 Info<<
"Rotating points by" <<
nl 252 <<
" roll " << v.
x() <<
nl 253 <<
" pitch " << v.
y() <<
nl 254 <<
" yaw " << v.
z() <<
nl;
259 quaternion R(quaternion::rotationSequence::XYZ, v);
261 Info<<
"Rotating points by quaternion " << R <<
endl;
266 rotateFields(args, runTime, R.
R());
271 Info<<
"Rotating points by" <<
nl 272 <<
" yaw " << v.
x() <<
nl 273 <<
" pitch " << v.
y() <<
nl 274 <<
" roll " << v.
z() <<
nl;
280 scalar pitch = v.
y();
287 Info<<
"Rotating points by quaternion " << R <<
endl;
292 rotateFields(args, runTime, R.
R());
298 Info<<
"Scaling points by " << v <<
endl;
wordList ReadFields(const Mesh &mesh, const IOobjectList &objects, PtrList< GeoField > &fields, const bool syncPar=true)
Read all fields of the specified type.
#define forAll(list, i)
Loop across all elements in list.
A class for handling file names.
List of IOobjects with searching and retrieving facilities.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
static unsigned int defaultPrecision()
Return the default precision.
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
tensor R() const
The rotation tensor corresponding the quaternion.
static word defaultRegion
Return the default region name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Field reading functions for post-processing utilities.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Vector< scalar > vector
A scalar version of the templated Vector.
Generic dimensioned Type class.
tensor rotationTensor(const vector &n1, const vector &n2)
Rotational transformation tensor from vector n1 to n2.
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
const Foam::HashTable< string > & options() const
Return options.
word findInstance(const fileName &dir, const word &name=word::null, const IOobject::readOption rOpt=IOobject::MUST_READ, const word &stopInstance=word::null) const
Return the location of "dir" containing the file "name".
An ordered pair of two objects of type <T> with first() and second() elements.
bool optionFound(const word &opt) const
Return true if the named option is found.
A class for handling words, derived from string.
Extract command arguments and options from the supplied argc and argv parameters. ...
static void addOption(const word &opt, const string ¶m="", const string &usage="")
Add to an option to validOptions with usage information.
Quaternion class used to perform rotations in 3D space.
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
#define R(A, B, C, D, E, F, K, M)
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Mesh data needed to do the Finite Volume discretisation.
IStringStream optionLookup(const word &opt) const
Return an IStringStream from the named option.
dimensioned< scalar > mag(const dimensioned< Type > &)
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
virtual bool write() const
Write mesh using IO settings from time.
dimensionSet transform(const dimensionSet &)