81 template<
class GeoField>
82 void readAndRotateFields
93 Info<<
"Transforming " << flds[i].name() <<
endl;
110 readAndRotateFields(vsFlds, mesh, T, objects);
113 readAndRotateFields(vvFlds, mesh, T, objects);
116 readAndRotateFields(vstFlds, mesh, T, objects);
119 readAndRotateFields(vsymtFlds, mesh, T, objects);
122 readAndRotateFields(vtFlds, mesh, T, objects);
127 readAndRotateFields(ssFlds, mesh, T, objects);
130 readAndRotateFields(svFlds, mesh, T, objects);
133 readAndRotateFields(sstFlds, mesh, T, objects);
136 readAndRotateFields(ssymtFlds, mesh, T, objects);
139 readAndRotateFields(stFlds, mesh, T, objects);
147 int main(
int argc,
char *argv[])
153 "translate by the specified <vector> - eg, '(1 0 0)'" 159 "transform in terms of a rotation between <vectorA> and <vectorB> " 160 "- eg, '( (1 0 0) (0 0 1) )'" 166 "transform in terms of '(roll pitch yaw)' in degrees" 172 "transform in terms of '(yaw pitch roll)' in degrees" 177 "read and transform vector and tensor fields too" 183 "scale by the specified amount - eg, '(0.001 0.001 0.001)' for a " 184 "uniform [mm] to [m] scaling" 194 forAll(regionNames, regioni)
196 const word& regionName = regionNames[regioni];
215 const bool doRotateFields = args.
optionFound(
"rotateFields");
221 <<
"No options supplied, please use one or more of " 222 "-translate, -rotate or -scale options." 229 Info<<
"Translating points by " << v <<
endl;
240 n1n2[0] /=
mag(n1n2[0]);
241 n1n2[1] /=
mag(n1n2[1]);
244 Info<<
"Rotating points by " << T <<
endl;
250 rotateFields(args, runTime, T);
255 Info<<
"Rotating points by" <<
nl 256 <<
" roll " << v.
x() <<
nl 257 <<
" pitch " << v.
y() <<
nl 258 <<
" yaw " << v.
z() <<
nl;
263 quaternion R(quaternion::rotationSequence::XYZ, v);
265 Info<<
"Rotating points by quaternion " << R <<
endl;
270 rotateFields(args, runTime, R.
R());
275 Info<<
"Rotating points by" <<
nl 276 <<
" yaw " << v.
x() <<
nl 277 <<
" pitch " << v.
y() <<
nl 278 <<
" roll " << v.
z() <<
nl;
284 scalar pitch = v.
y();
291 Info<<
"Rotating points by quaternion " << R <<
endl;
296 rotateFields(args, runTime, R.
R());
302 Info<<
"Scaling points by " << v <<
endl;
PtrList< surfaceSphericalTensorField > sstFlds
PtrList< volTensorField > vtFlds
PtrList< volSphericalTensorField > vstFlds
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.
tensor R() const
The rotation tensor corresponding the quaternion.
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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool optionFound(const word &opt) const
Return true if the named option is found.
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".
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.
virtual bool write(const bool write=true) const
Write mesh using IO settings from time.
PtrList< volVectorField > vvFlds
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
PtrList< volScalarField > vsFlds
const word & regionDir(const word ®ionName)
const Foam::HashTable< string > & options() const
Return options.
An ordered pair of two objects of type <T> with first() and second() elements.
A class for handling words, derived from string.
Extract command arguments and options from the supplied argc and argv parameters. ...
PtrList< surfaceSymmTensorField > ssymtFlds
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.
PtrList< volSymmTensorField > vsymtFlds
PtrList< surfaceTensorField > stFlds
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
PtrList< surfaceScalarField > ssFlds
PtrList< surfaceVectorField > svFlds
#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.
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...
A primitive field of type <T> with automated input and output.
wordList selectRegionNames(const argList &args, const Time &runTime)
dimensionSet transform(const dimensionSet &)
IStringStream optionLookup(const word &opt) const
Return an IStringStream from the named option.