Go to the documentation of this file.
93 template<
class GeoField>
94 void readAndRotateFields
103 for (GeoField&
fld : flds)
129 readAndRotateFields(vsFlds,
mesh,
T, objects);
132 readAndRotateFields(vvFlds,
mesh,
T, objects);
135 readAndRotateFields(vstFlds,
mesh,
T, objects);
138 readAndRotateFields(vsymtFlds,
mesh,
T, objects);
141 readAndRotateFields(vtFlds,
mesh,
T, objects);
146 readAndRotateFields(ssFlds,
mesh,
T, objects);
149 readAndRotateFields(svFlds,
mesh,
T, objects);
152 readAndRotateFields(sstFlds,
mesh,
T, objects);
155 readAndRotateFields(ssymtFlds,
mesh,
T, objects);
158 readAndRotateFields(stFlds,
mesh,
T, objects);
176 if (scaling.size() == 1)
180 else if (scaling.size() == 3)
185 equal(scaling[0], scaling[1])
186 &&
equal(scaling[0], scaling[2])
192 else if (!scaling.empty())
195 <<
"Incorrect number of components, must be 1 or 3." <<
nl
196 <<
" -" << optName <<
' ' <<
args[optName].c_str() <<
endl
200 if (scaling.size() == 1 &&
equal(scaling[0], 1))
214 if (scaling.size() == 1)
216 Info<<
"Scaling points uniformly by " << scaling[0] <<
nl;
219 else if (scaling.size() == 3)
221 Info<<
"Scaling points by ("
224 << scaling[2] <<
')' <<
nl;
235 int main(
int argc,
char *argv[])
239 "Transform (translate / rotate / scale) mesh points.\n"
240 "Note: roll=rotate about x, pitch=rotate about y, yaw=rotate about z"
246 "Specify the time to search from and apply the transformation"
247 " (default is latest)"
252 "Recentre the bounding box before other operations"
258 "Translate by specified <vector> before rotations"
263 "Use bounding box centre as origin for rotations"
269 "Use specified <point> as origin for rotations"
275 "Rotate from <vectorA> to <vectorB> - eg, '((1 0 0) (0 0 1))'"
281 "Rotate <angle> degrees about <vector> - eg, '((1 0 0) 45)'"
287 "Rotate by '(roll pitch yaw)' degrees"
293 "Rotate by '(yaw pitch roll)' degrees"
298 "Read and transform vector and tensor fields too"
304 "Scale by the specified amount - Eg, for uniform [mm] to [m] scaling "
305 "use either '(0.001 0.001 0.001)' or simply '0.001'"
314 const bool doRotateFields =
args.
found(
"rotateFields");
332 <<
"No operation supplied, "
333 <<
"use at least one of the following:" <<
nl
336 for (
const auto& opName : operationNames)
353 if (
args[
"time"] ==
"constant")
359 const scalar timeValue =
args.
get<scalar>(
"time");
404 Info<<
"Adjust centre " << v <<
" -> (0 0 0)" <<
endl;
410 Info<<
"Translating points by " << v <<
endl;
416 if (
args.
found(
"auto-origin") && !useOrigin)
424 Info<<
"Set origin for rotations to " << origin <<
endl;
439 Info<<
"Rotating points by " << rot <<
endl;
454 const vector& axis = rotAxisAngle.first();
455 const scalar angle = rotAxisAngle.second();
457 Info<<
"Rotating points " <<
nl
458 <<
" about " << axis <<
nl
459 <<
" angle " << angle <<
nl;
463 Info<<
"Rotating points by " << rot <<
endl;
473 Info<<
"Rotating points by" <<
nl
474 <<
" roll " << v.
x() <<
nl
475 <<
" pitch " << v.
y() <<
nl
476 <<
" yaw " << v.
z() <<
nl;
480 Info<<
"Rotating points by " << rot <<
endl;
490 Info<<
"Rotating points by" <<
nl
491 <<
" yaw " << v.
x() <<
nl
492 <<
" pitch " << v.
y() <<
nl
493 <<
" roll " << v.
z() <<
nl;
497 Info<<
"Rotating points by " << rot <<
endl;
507 applyScaling(
points, getScalingOpt(
"scale",
args));
511 Info<<
"Unset origin for rotations from " << origin <<
endl;
519 Info<<
"Writing points into directory "
label count(const UList< word > &optionNames) const
A templated (3 x 3) tensor of objects of <T> derived from MatrixSpace.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
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
void resize(const label len)
static word defaultRegion
wordList ReadFields(const typename GeoMesh::Mesh &mesh, const IOobjectList &objects, PtrList< GeometricField< Type, PatchField, GeoMesh >> &fields, const bool syncPar=true, const bool readOldTime=false)
static word timeName(const scalar t, const int precision=precision_)
static void addNote(const string ¬e)
static void addOptionCompat(const word &optName, std::pair< const char *, int > compat)
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)
dimensionSet transform(const dimensionSet &ds)
T get(const label index) const
bool readIfPresent(const word &optName, T &val) const
fileName relativePath(const fileName &input, const bool caseTag=false) const
ITstream lookup(const word &optName) const
static tensor rotation(const vector &axis, const scalar angle, bool degrees=false)
Generic templated field type.
Namespace for coordinate system rotations.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
void replace(const direction, const UList< cmptType > &)
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
label max(const labelHashSet &set, label maxValue=labelMin)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Generic dimensioned Type class.
Mesh data needed to do the Finite Volume discretisation.
tmp< Field< cmptType > > component(const direction) const
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)
static unsigned int defaultPrecision() noexcept
Field reading functions for post-processing utilities.
An ordered pair of two objects of type <T> with first() and second() elements.
virtual void setTime(const Time &t)
A bounding box defined in terms of min/max extrema points.
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)
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Foam::argList args(argc, argv)
bool equal(const T &s1, const T &s2)
bool found(const word &optName) const