Merge commit 'OpenCFD/master' into olesenm

This commit is contained in:
Mark Olesen
2009-03-16 08:28:08 +01:00
133 changed files with 8084 additions and 348 deletions

View File

@ -306,7 +306,7 @@ label findEdge
FatalErrorIn("findEdge") << "Cannot find edge with labels " << v0
<< ' ' << v1 << " in candidates " << edgeLabels
<< " with vertices:" << IndirectList<edge>(surf.edges(), edgeLabels)()
<< " with vertices:" << UIndirectList<edge>(surf.edges(), edgeLabels)()
<< abort(FatalError);
return -1;
@ -346,7 +346,7 @@ label otherEdge
FatalErrorIn("otherEdge") << "Cannot find other edge on face " << faceI
<< " verts:" << surf.localPoints()[faceI]
<< " connected to point " << pointI
<< " faceEdges:" << IndirectList<edge>(surf.edges(), fEdges)()
<< " faceEdges:" << UIndirectList<edge>(surf.edges(), fEdges)()
<< abort(FatalError);
return -1;

View File

@ -23,9 +23,16 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Transform (scale/rotate) a surface. Like transforPoints but then for
Transform (scale/rotate) a surface. Like transformPoints but then for
surfaces.
The rollPitchYaw option takes three angles (degrees):
- roll (rotation about x) followed by
- pitch (rotation about y) followed by
- yaw (rotation about z)
The yawPitchRoll does yaw followed by pitch followed by roll.
\*---------------------------------------------------------------------------*/
#include "triSurface.H"
@ -35,8 +42,10 @@ Description
#include "boundBox.H"
#include "transformField.H"
#include "Pair.H"
#include "quaternion.H"
using namespace Foam;
using namespace Foam::mathematicalConstant;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,6 +61,8 @@ int main(int argc, char *argv[])
argList::validOptions.insert("translate", "vector");
argList::validOptions.insert("rotate", "(vector vector)");
argList::validOptions.insert("scale", "vector");
argList::validOptions.insert("rollPitchYaw", "(roll pitch yaw)");
argList::validOptions.insert("yawPitchRoll", "(yaw pitch roll)");
argList args(argc, argv);
fileName surfFileName(args.additionalArgs()[0]);
@ -96,6 +107,48 @@ int main(int argc, char *argv[])
points = transform(T, points);
}
else if (args.options().found("rollPitchYaw"))
{
vector v(IStringStream(args.options()["rollPitchYaw"])());
Info<< "Rotating points by" << nl
<< " roll " << v.x() << nl
<< " pitch " << v.y() << nl
<< " yaw " << v.z() << endl;
// Convert to radians
v *= pi/180.0;
quaternion R(v.x(), v.y(), v.z());
Info<< "Rotating points by quaternion " << R << endl;
points = transform(R, points);
}
else if (args.options().found("yawPitchRoll"))
{
vector v(IStringStream(args.options()["yawPitchRoll"])());
Info<< "Rotating points by" << nl
<< " yaw " << v.x() << nl
<< " pitch " << v.y() << nl
<< " roll " << v.z() << endl;
// Convert to radians
v *= pi/180.0;
scalar yaw = v.x();
scalar pitch = v.y();
scalar roll = v.z();
quaternion R = quaternion(vector(0, 0, 1), yaw);
R *= quaternion(vector(0, 1, 0), pitch);
R *= quaternion(vector(1, 0, 0), roll);
Info<< "Rotating points by quaternion " << R << endl;
points = transform(R, points);
}
if (args.options().found("scale"))
{