From 51b470c0ee91c50716e447324f09bd5202292e00 Mon Sep 17 00:00:00 2001 From: henry Date: Tue, 7 Apr 2009 12:52:59 +0100 Subject: [PATCH] Improved argument handling and error messages. Changed "axisNormal" to "axis": it isn't the normal to the axis. --- .../mesh/generation/extrudeMesh/extrudeMesh.C | 42 +++++++++---------- .../extrudeMesh/extrudeModel/wedge/wedge.C | 7 ++-- .../extrudeMesh/extrudeModel/wedge/wedge.H | 9 ++-- .../generation/extrudeMesh/extrudeProperties | 3 +- .../mesh/generation/extrudeMesh/setRoots.H | 2 - 5 files changed, 30 insertions(+), 33 deletions(-) diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C index 0bb37f6727..37860e27b2 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C @@ -52,19 +52,18 @@ using namespace Foam; int main(int argc, char *argv[]) { -# include "setRoots.H" -# include "createTimeExtruded.H" + #include "setRoots.H" + #include "createTimeExtruded.H" - - if (args.options().found("sourceRoot") == args.options().found("surface")) + if (args.options().found("sourceCase") == args.options().found("surface")) { FatalErrorIn(args.executable()) - << "Need to specify either -sourceRoot/Case/Patch or -surface" - << " option to specify the source of the patch to extrude" + << "Specify either -sourceCase and -sourcePatch" + " or -surface options\n" + " to specify the source of the patch to extrude" << exit(FatalError); } - autoPtr meshPtr(NULL); autoPtr model @@ -84,23 +83,24 @@ int main(int argc, char *argv[]) ) ); - if (args.options().found("sourceRoot")) + if (args.options().found("sourceCase")) { - fileName rootDirSource(args.options()["sourceRoot"]); - fileName caseDirSource(args.options()["sourceCase"]); - fileName patchName(args.options()["sourcePatch"]); + fileName sourceCasePath(args.options()["sourceCase"]); + fileName sourceRootDir = sourceCasePath.path(); + fileName sourceCaseDir = sourceCasePath.name(); + word patchName(args.options()["sourcePatch"]); Info<< "Extruding patch " << patchName - << " on mesh " << rootDirSource << ' ' << caseDirSource << nl + << " on mesh " << sourceCasePath << nl << endl; Time runTime ( Time::controlDictName, - rootDirSource, - caseDirSource + sourceRootDir, + sourceCaseDir ); -# include "createPolyMesh.H" + #include "createPolyMesh.H" label patchID = mesh.boundaryMesh().findPatchID(patchName); @@ -171,7 +171,7 @@ int main(int argc, char *argv[]) fMesh, model() ) - ); + ); } extrudedMesh& mesh = meshPtr(); @@ -180,7 +180,7 @@ int main(int argc, char *argv[]) const vector span = bb.span(); const scalar mergeDim = 1E-4 * bb.minDim(); - Pout<< "Mesh bounding box:" << bb << nl + Info<< "Mesh bounding box:" << bb << nl << " with span:" << span << nl << "Merge distance :" << mergeDim << nl << endl; @@ -201,7 +201,7 @@ int main(int argc, char *argv[]) // ~~~~~~~~~~~~~~ { - Pout<< "Collapsing edges < " << mergeDim << " ..." << nl << endl; + Info<< "Collapsing edges < " << mergeDim << " ..." << nl << endl; // Edge collapsing engine edgeCollapser collapser(mesh); @@ -217,7 +217,7 @@ int main(int argc, char *argv[]) if (d < mergeDim) { - Pout<< "Merging edge " << e << " since length " << d + Info<< "Merging edge " << e << " since length " << d << " << " << mergeDim << nl; // Collapse edge to e[0] @@ -252,8 +252,8 @@ int main(int argc, char *argv[]) if (args.options().found("mergeFaces")) { - Pout<< "Assuming full 360 degree axisymmetric case;" - << " stitching faces on patches " + Info<< "Assuming full 360 degree axisymmetric case;" + << " stitching faces on patches " << patches[origPatchID].name() << " and " << patches[otherPatchID].name() << " together ..." << nl << endl; diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C index 27dec921b7..6da971a1bf 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C @@ -48,7 +48,7 @@ wedge::wedge(const dictionary& dict) : extrudeModel(typeName, dict), axisPt_(coeffDict_.lookup("axisPt")), - axisNormal_(coeffDict_.lookup("axisNormal")), + axis_(coeffDict_.lookup("axis")), angle_ ( readScalar(coeffDict_.lookup("angle")) @@ -96,7 +96,7 @@ point wedge::operator() // of surface point and surface normal. point d = surfacePoint - axisPt_; - d -= (axisNormal_ & d)*axisNormal_; + d -= (axis_ & d)*axis_; scalar dMag = mag(d); @@ -107,7 +107,7 @@ point wedge::operator() if (dMag > VSMALL) { - vector n = (d/dMag) ^ axisNormal_; + vector n = (d/dMag) ^ axis_; rotatedPoint += + cos(sliceAngle)*d @@ -124,4 +124,3 @@ point wedge::operator() } // End namespace Foam // ************************************************************************* // - diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.H b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.H index 38b862630d..39c4b4a2d3 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.H +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.H @@ -60,13 +60,13 @@ class wedge { // Private data - //- point on axis + //- Point on axis const point axisPt_; - //- normalized direction of axis - const vector axisNormal_; + //- Normalized direction of axis + const vector axis_; - //- overall angle (radians) + //- Overall angle (radians) const scalar angle_; @@ -80,6 +80,7 @@ public: //- Construct from components wedge(const dictionary& dict); + //- Destrcuctor ~wedge(); diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeProperties b/applications/utilities/mesh/generation/extrudeMesh/extrudeProperties index c9b7977508..ecbe160a15 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudeProperties +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeProperties @@ -24,7 +24,7 @@ nLayers 1; wedgeCoeffs { axisPt (0 0 0); - axisNormal (0 -1 0); + axis (0 -1 0); angle 2.0; } @@ -47,4 +47,3 @@ sigmaRadialCoeffs // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - diff --git a/applications/utilities/mesh/generation/extrudeMesh/setRoots.H b/applications/utilities/mesh/generation/extrudeMesh/setRoots.H index 255949426b..9c13db28d1 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/setRoots.H +++ b/applications/utilities/mesh/generation/extrudeMesh/setRoots.H @@ -1,7 +1,6 @@ argList::validArgs.clear(); argList::noParallel(); - argList::validOptions.insert("sourceRoot", "source root"); argList::validOptions.insert("sourceCase", "source case"); argList::validOptions.insert("sourcePatch", "source patch"); @@ -15,4 +14,3 @@ { FatalError.exit(); } -