transformPoints: Added option to restrict transformation to a point set
Transformation can now be restricted to a specific point set by means of
a new -pointSet option. For example, to move the rotating part of a
geometry through 45 degrees around the Z axis, the following command
could be used:
transformPoints -pointSet rotating "Rz=45"
This assumes a point set called "rotating" has been defined during
meshing or by calling topoSet.
This commit is contained in:
@ -1,8 +1,10 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude
|
-I$(LIB_SRC)/regionModels/regionModel/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
|
-lmeshTools \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
-lgenericPatchFields \
|
-lgenericPatchFields \
|
||||||
-lregionModels
|
-lregionModels
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -51,6 +51,8 @@ Usage
|
|||||||
Options:
|
Options:
|
||||||
- \par -rotateFields \n
|
- \par -rotateFields \n
|
||||||
Additionally transform vector and tensor fields.
|
Additionally transform vector and tensor fields.
|
||||||
|
- \par -pointSet \<name\> \n
|
||||||
|
Only transform points in the given point set.
|
||||||
|
|
||||||
Example usage:
|
Example usage:
|
||||||
transformPoints \
|
transformPoints \
|
||||||
@ -71,6 +73,7 @@ See also
|
|||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
#include "ReadFields.H"
|
#include "ReadFields.H"
|
||||||
#include "pointFields.H"
|
#include "pointFields.H"
|
||||||
|
#include "pointSet.H"
|
||||||
#include "transformField.H"
|
#include "transformField.H"
|
||||||
#include "transformGeometricField.H"
|
#include "transformGeometricField.H"
|
||||||
#include "unitConversion.H"
|
#include "unitConversion.H"
|
||||||
@ -164,7 +167,6 @@ int main(int argc, char *argv[])
|
|||||||
"\"translate=(1.2 0 0), Rx=90, translate=(-1.2 0 0)\""
|
"\"translate=(1.2 0 0), Rx=90, translate=(-1.2 0 0)\""
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
argList::validArgs.append("transformations");
|
argList::validArgs.append("transformations");
|
||||||
|
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
@ -173,6 +175,13 @@ int main(int argc, char *argv[])
|
|||||||
"transform vector and tensor fields"
|
"transform vector and tensor fields"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"pointSet",
|
||||||
|
"pointSet",
|
||||||
|
"Point set to limit the transformation to"
|
||||||
|
);
|
||||||
|
|
||||||
#include "addRegionOption.H"
|
#include "addRegionOption.H"
|
||||||
#include "addAllRegionsOption.H"
|
#include "addAllRegionsOption.H"
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
@ -186,6 +195,17 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
const bool doRotateFields = args.optionFound("rotateFields");
|
const bool doRotateFields = args.optionFound("rotateFields");
|
||||||
|
|
||||||
|
word pointSetName = word::null;
|
||||||
|
const bool doPointSet = args.optionReadIfPresent("pointSet", pointSetName);
|
||||||
|
|
||||||
|
if (doRotateFields && doPointSet)
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Rotation of fields across the entire mesh, and limiting the "
|
||||||
|
<< "transformation of points to a set, cannot be done "
|
||||||
|
<< "simultaneously" << exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
forAll(regionNames, regioni)
|
forAll(regionNames, regioni)
|
||||||
{
|
{
|
||||||
const word& regionName = regionNames[regioni];
|
const word& regionName = regionNames[regioni];
|
||||||
@ -207,7 +227,35 @@ int main(int argc, char *argv[])
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
transforms.transformPosition(points, points);
|
if (doPointSet)
|
||||||
|
{
|
||||||
|
const labelList setPointIDs
|
||||||
|
(
|
||||||
|
pointSet
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
pointSetName,
|
||||||
|
runTime.findInstance(meshDir/"sets", word::null),
|
||||||
|
polyMesh::meshSubDir/"sets",
|
||||||
|
runTime,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
).toc()
|
||||||
|
);
|
||||||
|
|
||||||
|
pointField setPoints(UIndirectList<point>(points, setPointIDs));
|
||||||
|
|
||||||
|
transforms.transformPosition(setPoints, setPoints);
|
||||||
|
|
||||||
|
UIndirectList<point>(points, setPointIDs) = setPoints;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
transforms.transformPosition(points, points);
|
||||||
|
}
|
||||||
|
|
||||||
if (doRotateFields)
|
if (doRotateFields)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user