Go to the documentation of this file.
89 template<
class GeoField>
90 void readAndRotateFields
101 Info<<
"Transforming " << flds[i].name() <<
endl;
118 readAndRotateFields(vsFlds,
mesh,
T, objects);
121 readAndRotateFields(vvFlds,
mesh,
T, objects);
124 readAndRotateFields(vstFlds,
mesh,
T, objects);
127 readAndRotateFields(vsymtFlds,
mesh,
T, objects);
130 readAndRotateFields(vtFlds,
mesh,
T, objects);
135 readAndRotateFields(ssFlds,
mesh,
T, objects);
138 readAndRotateFields(svFlds,
mesh,
T, objects);
141 readAndRotateFields(sstFlds,
mesh,
T, objects);
144 readAndRotateFields(ssymtFlds,
mesh,
T, objects);
147 readAndRotateFields(stFlds,
mesh,
T, objects);
154 int main(
int argc,
char *argv[])
158 "Transform (translate / rotate / scale) mesh points.\n"
159 "Note: roll=rotate about x, pitch=rotate about y, yaw=rotate about z"
165 "Specify the time to search from and apply the transformation"
166 " (default is latest)"
172 "Translate by specified <vector> - eg, '(1 0 0)' before rotations"
178 "Use specified <point> as origin for rotations"
184 "Rotate from <vectorA> to <vectorB> - eg, '((1 0 0) (0 0 1))'"
190 "Rotate <angle> degrees about <vector> - eg, '((1 0 0) 45)'"
196 "Rotate by '(roll pitch yaw)' degrees"
202 "Rotate by '(yaw pitch roll)' degrees"
207 "Read and transform vector and tensor fields too"
213 "Scale by the specified amount - Eg, for uniform [mm] to [m] scaling "
214 "use either '(0.001 0.001 0.001)' or simply '0.001'"
220 const bool doRotateFields =
args.
found(
"rotateFields");
237 <<
"No operation supplied, "
238 <<
"use at least one of the following:" <<
nl
241 for (
const auto& opName : operationNames)
264 if (
args[
"time"] ==
"constant")
270 const scalar timeValue =
args.
get<scalar>(
"time");
292 Info<<
"Translating points by " << v <<
endl;
301 Info<<
"Set origin for rotations to " << origin <<
endl;
316 Info<<
"Rotating points by " << rot <<
endl;
331 const vector& axis = rotAxisAngle.first();
332 const scalar& angle = rotAxisAngle.second();
334 Info<<
"Rotating points " <<
nl
335 <<
" about " << axis <<
nl
336 <<
" angle " << angle <<
nl;
340 Info<<
"Rotating points by " << rot <<
endl;
350 Info<<
"Rotating points by" <<
nl
351 <<
" roll " << v.
x() <<
nl
352 <<
" pitch " << v.
y() <<
nl
353 <<
" yaw " << v.
z() <<
nl;
357 Info<<
"Rotating points by " << rot <<
endl;
367 Info<<
"Rotating points by" <<
nl
368 <<
" yaw " << v.
x() <<
nl
369 <<
" pitch " << v.
y() <<
nl
370 <<
" roll " << v.
z() <<
nl;
374 Info<<
"Rotating points by " << rot <<
endl;
388 if (scaling.size() == 1)
390 Info<<
"Scaling points uniformly by " << scaling[0] <<
nl;
393 else if (scaling.size() == 3)
395 Info<<
"Scaling points by ("
398 << scaling[2] <<
")" <<
nl;
407 <<
"-scale with 1 or 3 components only" <<
nl
408 <<
"given: " <<
args[
"scale"] <<
endl
415 Info<<
"Unset origin for rotations from " << origin <<
endl;
label count(const UList< word > &optionNames) const
Return how many of the specified options were used.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const Cmpt & x() const
Access to the vector x component.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
A class for handling file names.
A primitive field of type <T> with automated input and output.
virtual bool write(const bool valid=true) const
Write mesh using IO settings from time.
static word defaultRegion
Return the default region name.
wordList ReadFields(const typename GeoMesh::Mesh &mesh, const IOobjectList &objects, PtrList< GeometricField< Type, PatchField, GeoMesh >> &fields, const bool syncPar=true, const bool readOldTime=false)
Read Geometric fields of templated type.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
static word timeName(const scalar t, const int precision=precision_)
static void addNote(const string ¬e)
Add extra notes for the usage information.
Extract command arguments and options from the supplied argc and argv parameters.
bool readListIfPresent(const word &optName, List< T > &list) const
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
T get(const label index) const
Get a value from the argument at index.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
const Cmpt & z() const
Access to the vector z component.
#define forAll(list, i)
Loop across all elements in list.
ITstream lookup(const word &optName) const
Return an input stream from the named option.
static tensor rotation(const vector &axis, const scalar angle, bool degrees=false)
The rotation tensor for given axis/angle.
messageStream Info
Information stream (uses stdout - output is on the master only)
Namespace for coordinate system rotations.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Generic dimensioned Type class.
Mesh data needed to do the Finite Volume discretisation.
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
List of IOobjects with searching and retrieving facilities.
word findInstance(const fileName &dir, const word &name=word::null, const IOobject::readOption rOpt=IOobject::MUST_READ, const word &stopInstance=word::null) const
errorManipArg< error, int > exit(error &err, const int errNo=1)
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
const Cmpt & y() const
Access to the vector y component.
Field reading functions for post-processing utilities.
An ordered pair of two objects of type <T> with first() and second() elements.
static unsigned int defaultPrecision()
Return the default precision.
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
static tensor rotation(const vector &angles, bool degrees=false)
An instant of time. Contains the time value and name.
tensor rotationTensor(const vector &n1, const vector &n2)
Rotational transformation tensor from vector n1 to n2.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
Foam::argList args(argc, argv)
bool found(const word &optName) const
Return true if the named option is found.