diff --git a/applications/test/tokenizeTest/tokenizeTest.C b/applications/test/tokenizeTest/tokenizeTest.C index cd80997f61..c8be29cbf3 100644 --- a/applications/test/tokenizeTest/tokenizeTest.C +++ b/applications/test/tokenizeTest/tokenizeTest.C @@ -67,9 +67,15 @@ int main(int argc, char *argv[]) while (is.good()) { token tok(is); + // char ch; + // is.get(ch); + // is.putback(ch); + int lookahead = is.peek(); + if (count == 0) { - Info<< "token: " << tok.info() << endl; + Info<< "token: " << tok.info(); + Info<< " lookahead: '" << char(lookahead) << "'" << endl; } } 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 facc70d1f7..3997eff244 100644 --- a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C +++ b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C @@ -142,16 +142,43 @@ void rotateFields(const argList& args, const Time& runTime, const tensor& T) int main(int argc, char *argv[]) { -# include "addRegionOption.H" - argList::addOption("translate", "vector"); - argList::addOption("rotate", "(vector vector)"); - argList::addOption("rollPitchYaw", "(roll pitch yaw)"); - argList::addOption("yawPitchRoll", "(yaw pitch roll)"); + #include "addRegionOption.H" + 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" + #include "setRootCase.H" + #include "createTime.H" word regionName = polyMesh::defaultRegion; fileName meshDir; 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() 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" 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