From 8d0522633e087ed68d94b2da95191894114688ad Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 9 Dec 2009 09:03:49 +0100 Subject: [PATCH 1/7] argList - surround option parameters with <> - increase usageMin to 20 to compensate for extra <> - look for _source.html instead of -source.html to match newer doxygen --- src/OpenFOAM/global/argList/argList.C | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index 0e3d05b72b..cd2de41fa9 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -43,7 +43,7 @@ Foam::SLList Foam::argList::validArgs; Foam::HashTable Foam::argList::validOptions; Foam::HashTable Foam::argList::validParOptions; Foam::HashTable Foam::argList::optionUsage; -Foam::string::size_type Foam::argList::usageMin = 16; +Foam::string::size_type Foam::argList::usageMin = 20; Foam::string::size_type Foam::argList::usageMax = 80; @@ -51,7 +51,7 @@ Foam::argList::initValidTables::initValidTables() { argList::addOption ( - "case", "DIR", + "case", "dir", "specify alternate case directory, default is the cwd" ); argList::addBoolOption("parallel", "run in parallel"); @@ -769,8 +769,9 @@ void Foam::argList::printUsage() const if (iter().size()) { - len += iter().size() + 1; // include space between option and param - Info<< ' ' << iter().c_str(); + // length includes space and between option/param and '<>' + len += iter().size() + 3; + Info<< " <" << iter().c_str() << '>'; } HashTable::const_iterator usageIter = @@ -827,12 +828,12 @@ void Foam::argList::displayDoc(bool source) const List docDirs(docDict.lookup("doxyDocDirs")); List docExts(docDict.lookup("doxySourceFileExts")); - // for source code: change foo_8C.html to foo_8C-source.html + // for source code: change foo_8C.html to foo_8C_source.html if (source) { forAll(docExts, extI) { - docExts[extI].replace(".", "-source."); + docExts[extI].replace(".", "_source."); } } From dd8f4f657a1c11f1007cce12b0b614c1bb52e3f9 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 9 Dec 2009 10:19:53 +0100 Subject: [PATCH 2/7] adjust usage for a few applications to account for new style --- .../mesh/generation/blockMesh/blockMeshApp.C | 4 +- .../transformPoints/transformPoints.C | 37 +++++++++++++--- .../foamToEnsight/foamToEnsight.C | 6 +-- .../foamToEnsightParts/foamToEnsightParts.C | 2 +- .../dataConversion/foamToVTK/foamToVTK.C | 42 +++++++++++++++---- 5 files changed, 72 insertions(+), 19 deletions(-) diff --git a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C index 93a6536506..9140c090ec 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C @@ -42,7 +42,7 @@ Usage @param -region \ \n Specify an alternative mesh region. - @param -dict \ \n + @param -dict \ \n Specify an alternative dictionary for the block mesh description. \*---------------------------------------------------------------------------*/ @@ -80,7 +80,7 @@ int main(int argc, char *argv[]) argList::addOption ( "dict", - "NAME", + "file", "specify an alternative dictionary for the blockMesh description" ); diff --git a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C index 9fdc9681c6..2ea94212ca 100644 --- a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C +++ b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C @@ -142,12 +142,39 @@ void rotateFields(const Time& runTime, const tensor& T) int main(int argc, char *argv[]) { - argList::addOption("translate", "vector"); - argList::addOption("rotate", "(vector vector)"); - argList::addOption("rollPitchYaw", "(roll pitch yaw)"); - argList::addOption("yawPitchRoll", "(yaw pitch roll)"); + argList::addOption + ( + "translate", + "vector", + "translate by the specified - eg, '(1 0 0)'" + ); + argList::addOption + ( + "rotate", + "(vectorA vectorB)", + "transform in terms of a rotation between and " + "- eg, '( (1 0 0) (0 0 1) )'" + ); + argList::addOption + ( + "rollPitchYaw", + "vector", + "transform in terms of '( roll pitch yaw )' in degrees" + ); + argList::addOption + ( + "yawPitchRoll", + "vector", + "transform in terms of '( yaw pitch roll )' in degrees" + ); argList::addBoolOption("rotateFields"); - argList::addOption("scale", "vector"); + argList::addOption + ( + "scale", + "vector", + "scale by the specified amount - eg, '(0.001 0.001 0.001)' for a " + "uniform [mm] to [m] scaling" + ); # include "setRootCase.H" # include "createTime.H" diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C index 94cf1dfecf..c0ea000959 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C @@ -101,13 +101,13 @@ int main(int argc, char *argv[]) argList::addBoolOption ( "noPatches", - "Suppress writing any patches" + "suppress writing any patches" ); argList::addOption ( "patches", - "patchList", - "Specify particular patches to write. " + "wordList", + "specify particular patches to write - eg '(inlet outlet)'. " "An empty list suppresses writing the internalMesh." ); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C index 862816a946..22ba937868 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C @@ -94,7 +94,7 @@ int main(int argc, char *argv[]) argList::addBoolOption ( "noMesh", - "Suppress writing the geometry. " + "suppress writing the geometry. " "Can be useful for converting partial results for a static geometry" ); diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C index 9a82419e20..73dc60b762 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C @@ -241,20 +241,46 @@ int main(int argc, char *argv[]) # include "addRegionOption.H" - argList::addOption("fields", "fields"); - argList::addOption("cellSet", "cellSet name"); - argList::addOption("faceSet", "faceSet name"); - argList::addOption("pointSet", "pointSet name"); - argList::addBoolOption("ascii"); + argList::addOption + ( + "fields", "wordList", + "only convert the specified fields - eg '(p T U)'" + ); + argList::addOption + ( + "cellSet", + "name", + "convert a mesh subset corresponding to the specified cellSet" + ); + argList::addOption("faceSet", "name"); + argList::addOption("pointSet", "name"); + argList::addBoolOption + ( + "ascii", + "write in ASCII format instead of binary" + ); argList::addBoolOption("surfaceFields"); argList::addBoolOption("nearCellValue"); argList::addBoolOption("noInternal"); argList::addBoolOption("noPointValues"); argList::addBoolOption("allPatches"); - argList::addOption("excludePatches","patches to exclude"); + argList::addOption + ( + "excludePatches", + "wordReList", + "a list of patches to exclude - eg '( inlet \".*Wall\" )' " + ); argList::addBoolOption("noFaceZones"); - argList::addBoolOption("noLinks"); - argList::addBoolOption("useTimeName"); + argList::addBoolOption + ( + "noLinks", + "don't link processor VTK files - parallel only" + ); + argList::addBoolOption + ( + "useTimeName", + "use the time name instead of the time index when naming the files" + ); # include "setRootCase.H" # include "createTime.H" From 30eac79d5551483cde101a4bdd3b2192566f9367 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 9 Dec 2009 10:58:32 +0100 Subject: [PATCH 3/7] argList gets addNote() static method - output any notes in the usage --- .../surfaceTransformPoints.C | 47 +++++++++++++++---- src/OpenFOAM/global/argList/argList.C | 28 ++++++++++- src/OpenFOAM/global/argList/argList.H | 9 +++- 3 files changed, 74 insertions(+), 10 deletions(-) diff --git a/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C b/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C index 85e3cc1172..8bb87d3ee9 100644 --- a/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C +++ b/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C @@ -23,8 +23,8 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Description - Transform (scale/rotate) a surface. Like transformPoints but then for - surfaces. + Transform (scale/rotate) a surface. + Like transformPoints but for surfaces. The rollPitchYaw option takes three angles (degrees): - roll (rotation about x) followed by @@ -54,16 +54,47 @@ using namespace Foam::constant::mathematical; int main(int argc, char *argv[]) { + argList::addNote + ( + "Transform (scale/rotate) a surface. " + "Like transformPoints but for surfaces." + ); argList::noParallel(); argList::validArgs.clear(); - argList::validArgs.append("surface file"); argList::validArgs.append("output surface file"); - argList::addOption("translate", "vector"); - argList::addOption("rotate", "(vector vector)"); - argList::addOption("scale", "vector"); - argList::addOption("rollPitchYaw", "(roll pitch yaw)"); - argList::addOption("yawPitchRoll", "(yaw pitch roll)"); + argList::addOption + ( + "translate", + "vector", + "translate by the specified - eg, '(1 0 0)'" + ); + argList::addOption + ( + "rotate", + "(vectorA vectorB)", + "transform in terms of a rotation between and " + "- eg, '( (1 0 0) (0 0 1) )'" + ); + argList::addOption + ( + "scale", + "vector", + "scale by the specified amount - eg, '(0.001 0.001 0.001)' for a " + "uniform [mm] to [m] scaling" + ); + argList::addOption + ( + "rollPitchYaw", + "vector", + "transform in terms of '( roll pitch yaw )' in degrees" + ); + argList::addOption + ( + "yawPitchRoll", + "vector", + "transform in terms of '( yaw pitch roll )' in degrees" + ); argList args(argc, argv); fileName surfFileName(args.additionalArgs()[0]); diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index cd2de41fa9..f574fde3e6 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -43,6 +43,7 @@ Foam::SLList Foam::argList::validArgs; Foam::HashTable Foam::argList::validOptions; Foam::HashTable Foam::argList::validParOptions; Foam::HashTable Foam::argList::optionUsage; +Foam::SLList Foam::argList::notes; Foam::string::size_type Foam::argList::usageMin = 20; Foam::string::size_type Foam::argList::usageMax = 80; @@ -108,6 +109,15 @@ void Foam::argList::addUsage } +void Foam::argList::addNote(const string& note) +{ + if (!note.empty()) + { + notes.append(note); + } +} + + void Foam::argList::removeOption(const word& opt) { validOptions.erase(opt); @@ -765,7 +775,7 @@ void Foam::argList::printUsage() const HashTable::const_iterator iter = validOptions.find(optionName); Info<< " -" << optionName; - label len = optionName.size() + 3; // include leading " -" + label len = optionName.size() + 3; // length includes leading ' -' if (iter().size()) { @@ -815,6 +825,22 @@ void Foam::argList::printUsage() const "print the usage" ); + + // output notes directly - no automatic text wrapping + if (!notes.empty()) + { + Info<< nl; + for + ( + SLList::const_iterator iter = notes.begin(); + iter != notes.end(); + ++iter + ) + { + Info<< iter().c_str() << nl; + } + } + Info<< nl <<"Using OpenFOAM-" << Foam::FOAMversion <<" (build: " << Foam::FOAMbuild << ") - see www.OpenFOAM.org" diff --git a/src/OpenFOAM/global/argList/argList.H b/src/OpenFOAM/global/argList/argList.H index b1efcb0669..da75c4d066 100644 --- a/src/OpenFOAM/global/argList/argList.H +++ b/src/OpenFOAM/global/argList/argList.H @@ -153,7 +153,10 @@ public: //- Short usage information for validOptions static HashTable optionUsage; - //- Min offset for displaying usage (default: 16) + //- Additional notes for usage + static SLList notes; + + //- Min offset for displaying usage (default: 20) static string::size_type usageMin; //- Max screen width for displaying usage (default: 80) @@ -287,6 +290,10 @@ public: const string& usage ); + //- Add extra notes for the usage information + // This string is used "as-is" without additional formatting + static void addNote(const string&); + //- Remove option from validOptions and from optionUsage static void removeOption(const word& opt); From 0fc464254aa0559ba190d0dc5bf767b224ca0a15 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 9 Dec 2009 13:50:31 +0100 Subject: [PATCH 4/7] Fix minor bug in surfaceFeatureExtract.C --- .../surface/surfaceFeatureExtract/surfaceFeatureExtract.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C index 307edd8568..f38bf13cc5 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C +++ b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C @@ -199,7 +199,7 @@ int main(int argc, char *argv[]) } // Trim away small groups of features - if (minLen > 0 || minLen > 0) + if (minElem > 0 || minLen > 0) { set.trimFeatures(minLen, minElem); Pout<< endl << "Removed small features" << endl; From 46a455ccea2d6e6874f8b898f0595de4d24b21cf Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 11 Dec 2009 15:04:28 +0100 Subject: [PATCH 5/7] Remove unused Istream methods from surfMesh classes. Move compilation edgeMesh and surfMesh up in the list (they are independent of triSurface). --- src/Allwmake | 2 +- src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H | 6 ------ src/surfMesh/surfMesh/surfMeshIO.C | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Allwmake b/src/Allwmake index 6592f244d7..969687eb83 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -22,9 +22,9 @@ wmake libso OpenFOAM wmake libso lagrangian/basic -wmake libso triSurface wmake libso edgeMesh wmake libso surfMesh +wmake libso triSurface # Decomposition methods needed by meshTools wmake libso parallel/decompositionMethods diff --git a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H index 7e16cc909d..4b46eb7c40 100644 --- a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H +++ b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H @@ -110,9 +110,6 @@ private: //- Disable setSize with value void setSize(const label, const Face&); - //- Read OpenFOAM Surface format - bool read(Istream&); - protected: @@ -198,9 +195,6 @@ public: //- Construct from file name (uses extension to determine type) UnsortedMeshedSurface(const fileName&, const word&); - //- Construct from Istream - UnsortedMeshedSurface(Istream&); - //- Construct from objectRegistry and a named surface UnsortedMeshedSurface(const Time&, const word& surfName=""); diff --git a/src/surfMesh/surfMesh/surfMeshIO.C b/src/surfMesh/surfMesh/surfMeshIO.C index ca2d840d07..7c2089f820 100644 --- a/src/surfMesh/surfMesh/surfMeshIO.C +++ b/src/surfMesh/surfMesh/surfMeshIO.C @@ -31,7 +31,7 @@ License void Foam::surfMesh::setInstance(const fileName& inst) { - if (debug or true) + if (debug) { Info<< "void surfMesh::setInstance(const fileName& inst) : " << "Resetting file instance to " << inst << endl; From d016db1bc6193c609716cd21ed276a74219e7c43 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 11 Dec 2009 16:29:55 +0100 Subject: [PATCH 6/7] Enhance edgeMesh to support more formats. Read only support: .bdf, .nas - NASTRAN format. Handles both CBEAM and CROD as lines. CROD is what Hypermesh happens to output. Write only support: .vtk - VTK legacy format in ASCII Read/write support: .eMesh - native format, which is simply a list of points, edges with an additional IOobject header that lets them be moved about easily to use as a featureEdgeMesh. .inp - STAR-CD inp/cel/vrt combination IOobject header) .obj - Alias waverfront format Radically simplify surfaceFeatureConvert by using the new edgeMesh functionality. --- applications/utilities/surface/README | 2 +- .../surfaceFeatureConvert.C | 293 +++---------- src/edgeMesh/Make/files | 23 +- src/edgeMesh/edgeFormats/edgeFormatsCore.C | 200 +++++++++ src/edgeMesh/edgeFormats/edgeFormatsCore.H | 118 ++++++ .../edgeFormats/emesh/EMESHedgeFormat.C | 195 +++++++++ .../edgeFormats/emesh/EMESHedgeFormat.H | 148 +++++++ .../emesh/EMESHedgeFormatRunTime.C | 61 +++ src/edgeMesh/edgeFormats/nas/NASedgeFormat.C | 260 ++++++++++++ src/edgeMesh/edgeFormats/nas/NASedgeFormat.H | 113 +++++ .../edgeFormats/nas/NASedgeFormatRunTime.C | 60 +++ src/edgeMesh/edgeFormats/obj/OBJedgeFormat.C | 245 +++++++++++ src/edgeMesh/edgeFormats/obj/OBJedgeFormat.H | 121 ++++++ .../edgeFormats/obj/OBJedgeFormatRunTime.C | 61 +++ .../edgeFormats/starcd/STARCDedgeFormat.C | 387 ++++++++++++++++++ .../edgeFormats/starcd/STARCDedgeFormat.H | 159 +++++++ .../starcd/STARCDedgeFormatRunTime.C | 61 +++ src/edgeMesh/edgeFormats/vtk/VTKedgeFormat.C | 107 +++++ src/edgeMesh/edgeFormats/vtk/VTKedgeFormat.H | 116 ++++++ .../edgeFormats/vtk/VTKedgeFormatRunTime.C | 51 +++ src/edgeMesh/edgeMesh.C | 184 ++++++++- src/edgeMesh/edgeMesh.H | 169 +++++++- src/edgeMesh/edgeMeshI.H | 27 +- src/edgeMesh/edgeMeshIO.C | 107 ++++- src/edgeMesh/edgeMeshNew.C | 65 +++ .../{ => featureEdgeMesh}/featureEdgeMesh.C | 59 ++- .../{ => featureEdgeMesh}/featureEdgeMesh.H | 19 +- 27 files changed, 3074 insertions(+), 337 deletions(-) create mode 100644 src/edgeMesh/edgeFormats/edgeFormatsCore.C create mode 100644 src/edgeMesh/edgeFormats/edgeFormatsCore.H create mode 100644 src/edgeMesh/edgeFormats/emesh/EMESHedgeFormat.C create mode 100644 src/edgeMesh/edgeFormats/emesh/EMESHedgeFormat.H create mode 100644 src/edgeMesh/edgeFormats/emesh/EMESHedgeFormatRunTime.C create mode 100644 src/edgeMesh/edgeFormats/nas/NASedgeFormat.C create mode 100644 src/edgeMesh/edgeFormats/nas/NASedgeFormat.H create mode 100644 src/edgeMesh/edgeFormats/nas/NASedgeFormatRunTime.C create mode 100644 src/edgeMesh/edgeFormats/obj/OBJedgeFormat.C create mode 100644 src/edgeMesh/edgeFormats/obj/OBJedgeFormat.H create mode 100644 src/edgeMesh/edgeFormats/obj/OBJedgeFormatRunTime.C create mode 100644 src/edgeMesh/edgeFormats/starcd/STARCDedgeFormat.C create mode 100644 src/edgeMesh/edgeFormats/starcd/STARCDedgeFormat.H create mode 100644 src/edgeMesh/edgeFormats/starcd/STARCDedgeFormatRunTime.C create mode 100644 src/edgeMesh/edgeFormats/vtk/VTKedgeFormat.C create mode 100644 src/edgeMesh/edgeFormats/vtk/VTKedgeFormat.H create mode 100644 src/edgeMesh/edgeFormats/vtk/VTKedgeFormatRunTime.C create mode 100644 src/edgeMesh/edgeMeshNew.C rename src/edgeMesh/{ => featureEdgeMesh}/featureEdgeMesh.C (81%) rename src/edgeMesh/{ => featureEdgeMesh}/featureEdgeMesh.H (85%) diff --git a/applications/utilities/surface/README b/applications/utilities/surface/README index 292d8ca0b5..a66c2463a1 100644 --- a/applications/utilities/surface/README +++ b/applications/utilities/surface/README @@ -21,7 +21,7 @@ surfaceFind - Finds nearest vertex and face to given point. surfaceMeshTriangulate -- Triangulate external facses of mesh and write as surface. +- Triangulate external faces of mesh and write as surface. surfacePointMerge - Explicit point merge of surface. diff --git a/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C b/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C index 046f9cefe8..ee221f992a 100644 --- a/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C +++ b/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C @@ -26,266 +26,85 @@ Application surfaceFeatureConvert Description - Extracts and writes surface features to file + Convert between edgeMesh formats \*---------------------------------------------------------------------------*/ -#include "featureEdgeMesh.H" #include "argList.H" #include "Time.H" -#include "IFstream.H" -#include "IStringStream.H" -#include "OFstream.H" -#include "Map.H" + +#include "edgeMesh.H" using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -void readNASEdges -( - const fileName& inFileName, - pointField& allPoints, - edgeList& allEdges -) -{ - IFstream is(inFileName); - - if (!is.good()) - { - FatalErrorIn("readNASEdges") - << "Cannot read file " << inFileName - << exit(FatalError); - } - - // coordinates of point - DynamicList points; - // Nastran index of point - DynamicList