From 8d0522633e087ed68d94b2da95191894114688ad Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 9 Dec 2009 09:03:49 +0100 Subject: [PATCH 01/16] 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 02/16] 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 03/16] 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 04/16] 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 17846a6bda7d6573a7fe4eb2a18cafffa99b8f6b Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 10 Dec 2009 15:27:21 +0000 Subject: [PATCH 05/16] Removed unused include file --- src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H | 1 - 1 file changed, 1 deletion(-) diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H index 0be663b733..595a53de9c 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H @@ -54,7 +54,6 @@ SourceFiles #define fvMeshDistribute_H #include "Field.H" -#include "uLabel.H" #include "fvMeshSubset.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // From 35eeedeaa511514b5933ba1d5fa8eb8735c133c5 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 10 Dec 2009 15:31:04 +0000 Subject: [PATCH 06/16] Added allowFreeStandingZoneFaces flag This determines when faceZones and cellZones are being meshed any zone faces can only be on the boundary of the cellZone or also 'free standing'. The latter option can be used to e.g. create free-standing baffles (that do not separate two regions) --- .../autoHexMeshDriver/autoRefineDriver.C | 6 +++++- .../refinementParameters/refinementParameters.C | 2 ++ .../refinementParameters/refinementParameters.H | 12 ++++++++++++ .../autoHexMesh/meshRefinement/meshRefinement.H | 6 +++++- .../meshRefinement/meshRefinementBaffles.C | 13 ++++++++----- 5 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C index a1346b4e8e..cff924d864 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C @@ -560,7 +560,11 @@ void Foam::autoRefineDriver::zonify const_cast(mesh.time())++; } - meshRefiner_.zonify(refineParams.keepPoints()[0]); + meshRefiner_.zonify + ( + refineParams.keepPoints()[0], + refineParams.allowFreeStandingZoneFaces() + ); if (debug) { diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C index a181662b27..7a8a16cfb7 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C @@ -44,6 +44,7 @@ Foam::refinementParameters::refinementParameters curvature_(readScalar(dict.lookup("curvature"))), nBufferLayers_(readLabel(dict.lookup("nBufferLayers"))), keepPoints_(dict.lookup("keepPoints")), + allowFreeStandingZoneFaces_(dict.lookup("allowFreeStandingZoneFaces")), maxLoadUnbalance_(dict.lookupOrDefault("maxLoadUnbalance",0)) {} @@ -55,6 +56,7 @@ Foam::refinementParameters::refinementParameters(const dictionary& dict) minRefineCells_(readLabel(dict.lookup("minRefinementCells"))), nBufferLayers_(readLabel(dict.lookup("nCellsBetweenLevels"))), keepPoints_(pointField(1, dict.lookup("locationInMesh"))), + allowFreeStandingZoneFaces_(dict.lookup("allowFreeStandingZoneFaces")), maxLoadUnbalance_(dict.lookupOrDefault("maxLoadUnbalance",0)) { scalar featAngle(readScalar(dict.lookup("resolveFeatureAngle"))); diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.H index ae09e3fc0e..32d6777276 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.H +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.H @@ -38,6 +38,7 @@ SourceFiles #include "dictionary.H" #include "pointField.H" +#include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -73,6 +74,10 @@ class refinementParameters //- Areas to keep const pointField keepPoints_; + //- FaceZone faces allowed which have owner and neighbour in same + // cellZone? + Switch allowFreeStandingZoneFaces_; + //- Allowed load unbalance scalar maxLoadUnbalance_; @@ -137,6 +142,13 @@ public: return keepPoints_; } + //- Are zone faces allowed only inbetween different cell zones + // or also just free standing? + bool allowFreeStandingZoneFaces() const + { + return allowFreeStandingZoneFaces_; + } + //- Allowed load unbalance scalar maxLoadUnbalance() const { diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H index 5b603ddbac..6347570cac 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H @@ -704,7 +704,11 @@ public: //- Put faces/cells into zones according to surface specification. // Returns null if no zone surfaces present. Region containing // the keepPoint will not be put into a cellZone. - autoPtr zonify(const point& keepPoint); + autoPtr zonify + ( + const point& keepPoint, + const bool allowFreeStandingZoneFaces + ); // Other topo changes diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C index 307cb743f8..f7adea091d 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C @@ -2032,7 +2032,8 @@ Foam::autoPtr Foam::meshRefinement::dupNonManifoldPoints() // Zoning Foam::autoPtr Foam::meshRefinement::zonify ( - const point& keepPoint + const point& keepPoint, + const bool allowFreeStandingZoneFaces ) { const wordList& cellZoneNames = surfaces_.cellZoneNames(); @@ -2344,9 +2345,11 @@ Foam::autoPtr Foam::meshRefinement::zonify } - //// Make sure namedSurfaceIndex is unset inbetween same cell cell zones. - //makeConsistentFaceIndex(cellToZone, namedSurfaceIndex); - + // Make sure namedSurfaceIndex is unset inbetween same cell cell zones. + if (!allowFreeStandingZoneFaces) + { + makeConsistentFaceIndex(cellToZone, namedSurfaceIndex); + } // Topochange container polyTopoChange meshMod(mesh_); @@ -2440,7 +2443,7 @@ Foam::autoPtr Foam::meshRefinement::zonify } else if (ownZone == neiZone) { - // Can only happen for coupled boundaries. Keep master + // Free-standing zone face or coupled boundary. Keep master // face unflipped. flip = !isMasterFace[faceI]; } From 9d817bfbdfb3e512627a66cf7497364f3ca65078 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 11 Dec 2009 11:55:07 +0000 Subject: [PATCH 07/16] Added -region option --- .../redistributeMeshPar/redistributeMeshPar.C | 108 ++++++++++-------- 1 file changed, 63 insertions(+), 45 deletions(-) diff --git a/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C b/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C index dbcb9e1643..b45843e31c 100644 --- a/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C +++ b/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C @@ -34,13 +34,19 @@ Description Can also work like decomposePar: @verbatim + # Create empty processor directories (have to exist for argList) mkdir processor0 + .. + mkdir processorN + + # Copy undecomposed polyMesh cp -r constant processor0 + + # Distribute mpirun -np ddd redistributeMeshPar -parallel @endverbatim \*---------------------------------------------------------------------------*/ -#include "Field.H" #include "fvMesh.H" #include "decompositionMethod.H" #include "PstreamReduceOps.H" @@ -62,6 +68,7 @@ static const scalar defaultMergeTol = 1E-6; autoPtr createMesh ( const Time& runTime, + const word& regionName, const fileName& instDir, const bool haveMesh ) @@ -69,43 +76,33 @@ autoPtr createMesh Pout<< "Create mesh for time = " << runTime.timeName() << nl << endl; - // Create dummy mesh. Only used on procs that don't have mesh. - // Note constructed on all processors since does parallel comms. - fvMesh dummyMesh + IOobject io ( - IOobject - ( - fvMesh::defaultRegion, - instDir, - runTime, - IOobject::MUST_READ - ), - xferCopy(pointField()), - xferCopy(faceList()), - xferCopy(labelList()), - xferCopy(labelList()) + regionName, + instDir, + runTime, + IOobject::MUST_READ ); if (!haveMesh) { - Pout<< "Writing dummy mesh to " << runTime.path()/instDir << endl; + // Create dummy mesh. Only used on procs that don't have mesh. + fvMesh dummyMesh + ( + io, + xferCopy(pointField()), + xferCopy(faceList()), + xferCopy(labelList()), + xferCopy(labelList()), + false + ); + Pout<< "Writing dummy mesh to " << dummyMesh.polyMesh::objectPath() + << endl; dummyMesh.write(); } - Pout<< "Reading mesh from " << runTime.path()/instDir << endl; - autoPtr meshPtr - ( - new fvMesh - ( - IOobject - ( - fvMesh::defaultRegion, - instDir, - runTime, - IOobject::MUST_READ - ) - ) - ); + Pout<< "Reading mesh from " << io.objectPath() << endl; + autoPtr meshPtr(new fvMesh(io)); fvMesh& mesh = meshPtr(); @@ -229,8 +226,9 @@ autoPtr createMesh if (!haveMesh) { // We created a dummy mesh file above. Delete it. - Pout<< "Removing dummy mesh in " << runTime.path()/instDir << endl; - rmDir(runTime.path()/instDir/polyMesh::meshSubDir); + Pout<< "Removing dummy mesh " << io.objectPath() + << endl; + rmDir(io.objectPath()); } // Force recreation of globalMeshData. @@ -285,7 +283,6 @@ scalar getMergeDistance void printMeshData(Ostream& os, const polyMesh& mesh) { os << "Number of points: " << mesh.points().size() << nl - << " edges: " << mesh.edges().size() << nl << " faces: " << mesh.faces().size() << nl << " internal faces: " << mesh.faceNeighbour().size() << nl << " cells: " << mesh.cells().size() << nl @@ -506,33 +503,53 @@ void compareFields int main(int argc, char *argv[]) { +# include "addRegionOption.H" argList::addOption("mergeTol", "relative merge distance"); + // Create argList. This will check for non-existing processor dirs. # include "setRootCase.H" - // Create processor directory if non-existing - if (!Pstream::master() && !isDir(args.path())) - { - Pout<< "Creating case directory " << args.path() << endl; - mkDir(args.path()); - } + //- Not useful anymore. See above. + //// Create processor directory if non-existing + //if (!Pstream::master() && !isDir(args.path())) + //{ + // Pout<< "Creating case directory " << args.path() << endl; + // mkDir(args.path()); + //} # include "createTime.H" + word regionName = polyMesh::defaultRegion; + fileName meshSubDir; + + if (args.optionReadIfPresent("region", regionName)) + { + meshSubDir = regionName/polyMesh::meshSubDir; + } + else + { + meshSubDir = polyMesh::meshSubDir; + } + Info<< "Using mesh subdirectory " << meshSubDir << nl << endl; + + // Get time instance directory. Since not all processors have meshes // just use the master one everywhere. fileName masterInstDir; if (Pstream::master()) { - masterInstDir = runTime.findInstance(polyMesh::meshSubDir, "points"); + masterInstDir = runTime.findInstance(meshSubDir, "points"); } Pstream::scatter(masterInstDir); // Check who has a mesh - const fileName meshDir = runTime.path()/masterInstDir/polyMesh::meshSubDir; + const fileName meshPath = runTime.path()/masterInstDir/meshSubDir; + + Info<< "Found points in " << meshPath << nl << endl; + boolList haveMesh(Pstream::nProcs(), false); - haveMesh[Pstream::myProcNo()] = isDir(meshDir); + haveMesh[Pstream::myProcNo()] = isDir(meshPath); Pstream::gatherList(haveMesh); Pstream::scatterList(haveMesh); Info<< "Per processor mesh availability : " << haveMesh << endl; @@ -542,6 +559,7 @@ int main(int argc, char *argv[]) autoPtr meshPtr = createMesh ( runTime, + regionName, masterInstDir, haveMesh[Pstream::myProcNo()] ); @@ -799,7 +817,7 @@ int main(int argc, char *argv[]) << nl << "the processor directories with 0 sized meshes in them." << nl << "Below is a sample set of commands to do this." - << " Take care when issueing these" << nl + << " Take care when issuing these" << nl << "commands." << nl << endl; forAll(nFaces, procI) @@ -812,8 +830,8 @@ int main(int argc, char *argv[]) } else { - fileName timeDir = procDir/runTime.timeName()/polyMesh::meshSubDir; - fileName constDir = procDir/runTime.constant()/polyMesh::meshSubDir; + fileName timeDir = procDir/runTime.timeName()/meshSubDir; + fileName constDir = procDir/runTime.constant()/meshSubDir; Info<< " rm -r " << constDir.c_str() << nl << " mv " << timeDir.c_str() From 88e407043e88137c1fbdcb8dd6d4d3f4046a6930 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 11 Dec 2009 11:55:36 +0000 Subject: [PATCH 08/16] Fixed typo in printing --- src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C index 7dc416b98f..848ec35d21 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C @@ -1461,7 +1461,7 @@ Foam::autoPtr Foam::fvMeshDistribute::distribute getNeighbourData(distribution, sourceFace, sourceProc, sourceNewProc); - // Remove meshPhi. Since this would otherwise dissappear anyway + // Remove meshPhi. Since this would otherwise disappear anyway // during topo changes and we have to guarantee that all the fields // can be sent. mesh_.clearOut(); From 834e493812b044e4a500f98184fc98da9ab990cd Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 11 Dec 2009 11:56:04 +0000 Subject: [PATCH 09/16] Fixed missing arguments in error message --- .../polyTopoChange/polyTopoChange/addObject/polyAddFace.H | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/addObject/polyAddFace.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/addObject/polyAddFace.H index 944e645fe0..8ae310fd36 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/addObject/polyAddFace.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/addObject/polyAddFace.H @@ -264,6 +264,10 @@ public: " const face& f,\n" " const label owner," " const label neighbour,\n" + " const label masterPointID,\n" + " const label masterEdgeID,\n" + " const label masterFaceID,\n" + " const bool flipFaceFlux,\n" " const label patchID,\n" " const label zoneID" ")" @@ -292,6 +296,7 @@ public: " const label masterPointID,\n" " const label masterEdgeID,\n" " const label masterFaceID,\n" + " const bool flipFaceFlux,\n" " const label patchID,\n" " const label zoneID,\n" " const bool zoneFlip\n" From ce7274639d2761a8b04edb59ec3d4d6b6e096a12 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 11 Dec 2009 11:58:12 +0000 Subject: [PATCH 10/16] Added missing face-flipping flag --- src/dynamicMesh/polyTopoChange/polyTopoChange/removeCells.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/removeCells.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/removeCells.C index 6be85d87c1..770d350e25 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/removeCells.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/removeCells.C @@ -339,7 +339,7 @@ void Foam::removeCells::setRefinement faceI, // label of face being modified nei, // owner -1, // neighbour - false, // face flip + true, // face flip newPatchID[faceI], // patch for face false, // remove from zone zoneID, // zone for face From 6791d105703f0858d680d1b99ca3bebc7646c135 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 11 Dec 2009 11:59:28 +0000 Subject: [PATCH 11/16] Changed indentation --- src/dynamicMesh/polyTopoChange/polyTopoChange/removeFaces.H | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/removeFaces.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/removeFaces.H index 6d217a3f4f..e691a4f4e3 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/removeFaces.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/removeFaces.H @@ -137,8 +137,7 @@ class removeFaces ) const; //- Return face with all pointsToRemove removed. - face filterFace(const labelHashSet& pointsToRemove, const label) - const; + face filterFace(const labelHashSet&, const label) const; //- Wrapper for meshMod.modifyFace. Reverses face if own>nei. void modFace From 46a455ccea2d6e6874f8b898f0595de4d24b21cf Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 11 Dec 2009 15:04:28 +0100 Subject: [PATCH 12/16] 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 13/16] 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