diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.C index e671a256c9..5f04825a94 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.H index 4bdfb84fcb..329b8cce65 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/test/PackedList/PackedListTest.C b/applications/test/PackedList/PackedListTest.C index f1f58f3abc..41796562ba 100644 --- a/applications/test/PackedList/PackedListTest.C +++ b/applications/test/PackedList/PackedListTest.C @@ -52,27 +52,47 @@ int main(int argc, char *argv[]) list1 = -1; list1.print(Info); + Info<< "\ntest zero\n"; + list1 = 0; + list1.print(Info); + + Info<< "\ntest set() with default argument (max_value)\n"; + list1.set(3); + list1.print(Info); + Info<< "\ntest assign between references\n"; list1[2] = 3; list1[4] = list1[2]; list1.print(Info); Info<< "\ntest assign between references, with chaining\n"; - list1[4] = list1[2] = 1; + list1[0] = list1[4] = 1; + list1.print(Info); + + Info<< "\ntest assign between references, with chaining and auto-vivify\n"; + list1[1] = list1[8] = list1[10] = list1[14] = 2; list1.print(Info); { const PackedList<3>& constLst = list1; Info<< "\ntest operator[] const with out-of-range index\n"; constLst.print(Info); - if (!constLst[20]) + if (constLst[20]) + { + Info<< "[20] is true (unexpected)\n"; + } + else { Info<< "[20] is false (expected) list size should be unchanged (const)\n"; } constLst.print(Info); Info<< "\ntest operator[] non-const with out-of-range index\n"; - if (!list1[20]) + if (list1[20]) + { + Info<< "[20] is true (unexpected)\n"; + } + else { Info<< "[20] is false (expected) but list was resized?? (non-const)\n"; } @@ -91,6 +111,14 @@ int main(int argc, char *argv[]) list1.resize(8, list1.max_value()); list1.print(Info); + Info<< "\ntest flip() function\n"; + list1.flip(); + list1.print(Info); + + Info<< "\nre-flip()\n"; + list1.flip(); + list1.print(Info); + Info<< "\ntest set() function\n"; list1.set(1, 5); list1.print(Info); @@ -188,15 +216,23 @@ int main(int argc, char *argv[]) { Info<< "\ntest assignment of iterator\n"; list1.print(Info); - PackedList<3>::iterator cit = list1[25]; - cit.print(Info); + Info<< "cend()\n"; list1.end().print(Info); + PackedList<3>::iterator cit = list1[100]; + Info<< "out-of-range: "; + cit.print(Info); + cit = list1[15]; + Info<< "in-range: "; + cit.print(Info); + Info<< "out-of-range: "; + cit = list1[1000]; + cit.print(Info); } for ( - PackedList<3>::iterator cit = list1[5]; + PackedList<3>::iterator cit = list1[30]; cit != list1.end(); ++cit ) @@ -204,14 +240,19 @@ int main(int argc, char *argv[]) cit.print(Info); } -// Info<< "\ntest operator[] auto-vivify\n"; -// const unsigned int val = list1[45]; -// -// Info<< "list[45]:" << val << "\n"; -// list1[45] = list1.max_value(); -// Info<< "list[45]:" << list1[45] << "\n"; -// list1[49] = list1.max_value(); -// list1.print(Info); + Info<< "\ntest operator[] auto-vivify\n"; + Info<< "size:" << list1.size() << "\n"; + + const unsigned int val = list1[45]; + + Info<< "list[45]:" << val << "\n"; + Info<< "size after read:" << list1.size() << "\n"; + + list1[45] = list1.max_value(); + Info<< "size after write:" << list1.size() << "\n"; + Info<< "list[45]:" << list1[45] << "\n"; + list1[49] = list1[100]; + list1.print(Info); Info<< "\ntest copy constructor + append\n"; @@ -235,6 +276,23 @@ int main(int argc, char *argv[]) Info<< "removed final value: " << list3.remove() << endl; list3.print(Info); + + List list4(4, true); + { + const List& constLst = list4; + Info<< "\ntest operator[] const with out-of-range index\n"; + Info<< constLst << endl; + if (constLst[20]) + { + Info<< "[20] is true (unexpected)\n"; + } + else + { + Info<< "[20] is false (expected) list size should be unchanged (const)\n"; + } + Info<< constLst << endl; + } + Info<< "\n\nDone.\n"; return 0; diff --git a/applications/test/fileName/fileNameTest.C b/applications/test/fileName/fileNameTest.C index f5a4a93542..c4791f6f38 100644 --- a/applications/test/fileName/fileNameTest.C +++ b/applications/test/fileName/fileNameTest.C @@ -32,6 +32,7 @@ Description #include "fileName.H" #include "SubList.H" +#include "IOobject.H" #include "IOstreams.H" #include "OSspecific.H" @@ -61,7 +62,8 @@ int main() << endl; // try with different combination - for (label start = 0; start < wrdList.size(); ++start) + // The final one should emit warnings + for (label start = 0; start <= wrdList.size(); ++start) { fileName instance, local; word name; @@ -69,26 +71,28 @@ int main() fileName path(SubList(wrdList, wrdList.size()-start, start)); fileName path2 = "." / path; - path.IOobjectComponents + IOobject::fileNameComponents ( + path, instance, local, name ); - Info<< "IOobjectComponents for " << path << nl + Info<< "IOobject::fileNameComponents for " << path << nl << " instance = " << instance << nl << " local = " << local << nl << " name = " << name << endl; - path2.IOobjectComponents + IOobject::fileNameComponents ( + path2, instance, local, name ); - Info<< "IOobjectComponents for " << path2 << nl + Info<< "IOobject::fileNameComponents for " << path2 << nl << " instance = " << instance << nl << " local = " << local << nl << " name = " << name << endl; diff --git a/applications/test/primitivePatch/testPrimitivePatch.C b/applications/test/primitivePatch/testPrimitivePatch.C index 7130e90628..e19b7d0512 100644 --- a/applications/test/primitivePatch/testPrimitivePatch.C +++ b/applications/test/primitivePatch/testPrimitivePatch.C @@ -69,7 +69,7 @@ void checkFaceEdges forAll(f, fp) { - label fp1 = (fp + 1) % f.size(); + label fp1 = f.fcIndex(fp); if (edges[myEdges[fp]] != edge(f[fp], f[fp1])) { diff --git a/applications/test/sha1/Make/files b/applications/test/sha1/Make/files new file mode 100644 index 0000000000..2da85a30dd --- /dev/null +++ b/applications/test/sha1/Make/files @@ -0,0 +1,3 @@ +testSHA1.C + +EXE = $(FOAM_USER_APPBIN)/testSHA1 diff --git a/applications/test/sha1/Make/options b/applications/test/sha1/Make/options new file mode 100644 index 0000000000..e69de29bb2 diff --git a/applications/test/sha1/testSHA1.C b/applications/test/sha1/testSHA1.C new file mode 100644 index 0000000000..9a2ac37c48 --- /dev/null +++ b/applications/test/sha1/testSHA1.C @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Application + testSHA1 + +Description + + +\*---------------------------------------------------------------------------*/ + +#include "OSHA1stream.H" +#include "IStringStream.H" +#include "dictionary.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char * argv[]) +{ + SHA1 sha; + SHA1Digest shaDig; + + std::string str("The quick brown fox jumps over the lazy dog"); + Info<< shaDig << nl; + Info<< SHA1("The quick brown fox jumps over the lazy dog") << nl; + + sha.append("The quick brown fox jumps over the lazy dog"); + Info<< sha << nl; + + sha.clear(); + sha.append("The quick brown fox jumps over the lazy dog"); + shaDig = sha; + + sha.append("\n"); + Info<< sha << nl; + Info<< shaDig << nl; + + if (sha == shaDig) + { + Info<<"SHA1 digests are identical\n"; + } + else + { + Info<<"SHA1 digests are different\n"; + } + Info<<"lhs:" << sha << " rhs:" << shaDig << endl; + + // start over: + sha.clear(); + sha.append(str); + + SHA1Digest shaDig_A = sha; + + SHA1 sha_A = sha; + + sha.append("\n"); + + Info<< "digest1: " << sha_A << nl; + Info<< "digest2: " << sha << nl; + + // start over: + sha.clear(); + sha.append("\""); + sha.append(str); + sha.append("\""); + + Info<< "digest3: " << sha << nl; + + // try the output buffer interface + { + OSHA1stream os; + + os << str; + Info<< os.digest() << endl; + + os << str; + Info<< os.digest() << endl; + + os.rewind(); + os << "The quick brown fox jumps over the lazy dog"; + Info<< os.digest() << endl; + + } + + { + dictionary dict + ( + IStringStream + ( + "parent { Default_Boundary_Region { type zeroGradient; } }" + "inlet_1 { value inlet_1; }" + "inlet_2 { value inlet_2; }" + "inlet_3 { value inlet_3; }" + "\"inlet_.*\" { value XXX; }" + ) () + ); + + Info<< "dict:" << endl; + dict.write(Info, false); + + dictionary dict2(dict); + + OSHA1stream os; + dict.write(os, false); + Info<< os.digest() << endl; + + Info<< dict2.digest() << endl; + } + + + return 0; +} diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C index a780d8aecb..e87078cc39 100644 --- a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C +++ b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C @@ -74,20 +74,17 @@ labelList getSortedEdges const edge& e = edges[edgeI]; label fp = findIndex(f, e[0]); - - label fp1 = (fp+1) % f.size(); + label fp1 = f.fcIndex(fp); if (f[fp1] == e[1]) { - // Edgei in fp-fp1 order + // EdgeI between fp -> fp1 faceEdges[fp] = edgeI; } else { - // Edgei between fp-1 and fp - label fpMin1 = (fp == 0 ? f.size()-1 : fp-1); - - faceEdges[fpMin1] = edgeI; + // EdgeI between fp-1 -> fp + faceEdges[f.rcIndex(fp)] = edgeI; } } diff --git a/applications/utilities/mesh/advanced/modifyMesh/cellSplitter.C b/applications/utilities/mesh/advanced/modifyMesh/cellSplitter.C index ce532b979f..3ae39131a1 100644 --- a/applications/utilities/mesh/advanced/modifyMesh/cellSplitter.C +++ b/applications/utilities/mesh/advanced/modifyMesh/cellSplitter.C @@ -211,7 +211,7 @@ void Foam::cellSplitter::setRefinement // Add other pyramids for (label i = 1; i < cFaces.size(); i++) - { + { label addedCellI = meshMod.setAction ( @@ -277,7 +277,7 @@ void Foam::cellSplitter::setRefinement label index = findIndex(f0, e[0]); - bool edgeInFaceOrder = (f0[(index+1) % f0.size()] == e[1]); + bool edgeInFaceOrder = (f0[f0.fcIndex(index)] == e[1]); // Check if cellI is the face owner @@ -323,7 +323,7 @@ void Foam::cellSplitter::setRefinement label index = findIndex(f1, e[0]); - bool edgeInFaceOrder = (f1[(index+1) % f1.size()] == e[1]); + bool edgeInFaceOrder = (f1[f1.fcIndex(index)] == e[1]); // Check if cellI is the face owner @@ -362,7 +362,7 @@ void Foam::cellSplitter::setRefinement } } } - + // // Update all existing faces for split owner or neighbour. @@ -441,7 +441,7 @@ void Foam::cellSplitter::setRefinement label patchID, zoneID, zoneFlip; getFaceInfo(faceI, patchID, zoneID, zoneFlip); - + meshMod.setAction ( polyModifyFace @@ -458,7 +458,7 @@ void Foam::cellSplitter::setRefinement ) ); } - + faceUpToDate[faceI] = true; } } diff --git a/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C b/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C index 025709fac8..47ec7f9137 100644 --- a/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C +++ b/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C @@ -615,7 +615,7 @@ int main(int argc, char *argv[]) { fileName ccmFile(args.additionalArgs()[0]); - if (!exists(ccmFile)) + if (!isFile(ccmFile)) { FatalErrorIn(args.executable()) << "Cannot read file " << ccmFile diff --git a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C index 7fcf2a586b..486041c714 100644 --- a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C +++ b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C @@ -129,14 +129,14 @@ int main(int argc, char *argv[]) Info<< "Reading .face file for boundary information" << nl << endl; } - if (!exists(nodeFile) || !exists(eleFile)) + if (!isFile(nodeFile) || !isFile(eleFile)) { FatalErrorIn(args.executable()) << "Cannot read " << nodeFile << " or " << eleFile << exit(FatalError); } - if (readFaceFile && !exists(faceFile)) + if (readFaceFile && !isFile(faceFile)) { FatalErrorIn(args.executable()) << "Cannot read " << faceFile << endl diff --git a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C index 69439764c7..815f082ec7 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C @@ -108,7 +108,11 @@ int main(int argc, char *argv[]) ( new IOobject ( - ( dictPath.isDir() ? dictPath/dictName : dictPath ), + ( + isDir(dictPath) + ? dictPath/dictName + : dictPath + ), runTime, IOobject::MUST_READ, IOobject::NO_WRITE, diff --git a/applications/utilities/mesh/manipulation/setSet/setSet.C b/applications/utilities/mesh/manipulation/setSet/setSet.C index 8f49a94766..a5909c398a 100644 --- a/applications/utilities/mesh/manipulation/setSet/setSet.C +++ b/applications/utilities/mesh/manipulation/setSet/setSet.C @@ -746,7 +746,8 @@ int main(int argc, char *argv[]) Pout<< "Reading commands from file " << batchFile << endl; - if (!exists(batchFile)) + // we also cannot handle .gz files + if (!isFile(batchFile, false)) { FatalErrorIn(args.executable()) << "Cannot open file " << batchFile << exit(FatalError); diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index aa83952b88..582a6ca9bf 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -627,7 +627,7 @@ autoPtr createRegionMesh Info<< "Testing:" << io.objectPath() << endl; if (!io.headerOk()) - //if (!exists(io.objectPath())) + // if (!exists(io.objectPath())) { Info<< "Writing dummy " << regionName/io.name() << endl; dictionary dummyDict; diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index b6eaf39258..a7328cb487 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -105,7 +105,7 @@ int main(int argc, char *argv[]) // determine the existing processor count directly label nProcs = 0; - while (dir(runTime.path()/(word("processor") + name(nProcs)))) + while (isDir(runTime.path()/(word("processor") + name(nProcs)))) { ++nProcs; } @@ -480,7 +480,7 @@ int main(int argc, char *argv[]) // Any uniform data to copy/link? fileName uniformDir("uniform"); - if (dir(runTime.timePath()/uniformDir)) + if (isDir(runTime.timePath()/uniformDir)) { Info<< "Detected additional non-decomposed files in " << runTime.timePath()/uniformDir diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict index 7ece22c5ae..288797ed1e 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict +++ b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict @@ -59,7 +59,7 @@ manualCoeffs } -//// Is the case distributred +//// Is the case distributed //distributed yes; //// Per slave (so nProcs-1 entries) the directory above the case. //roots diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C index ac08b17645..20def06b9c 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C @@ -63,7 +63,7 @@ int main(int argc, char *argv[]) // determine the processor count directly label nProcs = 0; - while (dir(args.path()/(word("processor") + name(nProcs)))) + while (isDir(args.path()/(word("processor") + name(nProcs)))) { ++nProcs; } @@ -383,7 +383,7 @@ int main(int argc, char *argv[]) // the master processor. fileName uniformDir0 = databases[0].timePath()/"uniform"; - if (dir(uniformDir0)) + if (isDir(uniformDir0)) { cp(uniformDir0, runTime.timePath()); } diff --git a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C index 1e102fb0e5..627f2b15b4 100644 --- a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C +++ b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C @@ -355,7 +355,7 @@ int main(int argc, char *argv[]) while ( - exists + isDir ( args.rootPath() / args.caseName() diff --git a/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C b/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C index 379dd70b91..c46a41b273 100644 --- a/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C +++ b/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C @@ -503,7 +503,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" // Create processor directory if non-existing - if (!Pstream::master() && !dir(args.path())) + if (!Pstream::master() && !isDir(args.path())) { Pout<< "Creating case directory " << args.path() << endl; mkDir(args.path()); @@ -525,7 +525,7 @@ int main(int argc, char *argv[]) const fileName meshDir = runTime.path()/masterInstDir/polyMesh::meshSubDir; boolList haveMesh(Pstream::nProcs(), false); - haveMesh[Pstream::myProcNo()] = dir(meshDir); + haveMesh[Pstream::myProcNo()] = isDir(meshDir); Pstream::gatherList(haveMesh); Pstream::scatterList(haveMesh); Info<< "Per processor mesh availability : " << haveMesh << endl; diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C index 8fc7636f2a..bb7c1880f0 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C @@ -131,7 +131,7 @@ int main(int argc, char *argv[]) if (Pstream::master()) { - if (dir(postProcPath)) + if (isDir(postProcPath)) { rmDir(postProcPath); } diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C index 1d31a4e31c..329dda87f9 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C @@ -136,7 +136,7 @@ int main(int argc, char *argv[]) // Ensight and Ensight/data directories must exist // do not remove old data - we might wish to convert new results // or a particular time interval - if (dir(ensightDir)) + if (isDir(ensightDir)) { Info<<"Warning: reusing existing directory" << nl << " " << ensightDir << endl; @@ -324,7 +324,7 @@ int main(int argc, char *argv[]) { const word& cloudName = cloudIter.key(); - if (!dir(runTime.timePath()/regionPrefix/"lagrangian"/cloudName)) + if (!isDir(runTime.timePath()/regionPrefix/"lagrangian"/cloudName)) { continue; } diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C index 81ac4facac..7fc54a8cf2 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C +++ b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C @@ -260,7 +260,7 @@ int main(int argc, char *argv[]) // make a directory called FieldView in the case fileName fvPath(runTime.path()/"Fieldview"); - if (dir(fvPath)) + if (isDir(fvPath)) { rmDir(fvPath); } @@ -346,7 +346,7 @@ int main(int argc, char *argv[]) // Output the magic number. writeInt(fvFile, FV_MAGIC); - + // Output file header and version number. writeStr80(fvFile, "FIELDVIEW"); @@ -417,7 +417,7 @@ int main(int argc, char *argv[]) { if (volFieldPtrs[fieldI] == NULL) { - Info<< " dummy field for " + Info<< " dummy field for " << volFieldNames[fieldI].c_str() << endl; } diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C index 45c5f37996..e03c76c057 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C @@ -333,7 +333,7 @@ int main(int argc, char *argv[]) regionPrefix = regionName; } - if (dir(fvPath)) + if (isDir(fvPath)) { if ( diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C index 779cddac39..7a8fd89e9e 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C @@ -228,7 +228,7 @@ Foam::vtkPV3Foam::vtkPV3Foam // avoid argList and get rootPath/caseName directly from the file fileName fullCasePath(fileName(FileName).path()); - if (!dir(fullCasePath)) + if (!isDir(fullCasePath)) { return; } @@ -518,7 +518,7 @@ double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps) if ( - file(runTime.path()/timeName/meshDir_/"points") + isFile(runTime.path()/timeName/meshDir_/"points") && IOobject("points", timeName, meshDir_, runTime).headerOk() ) { diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H index cb25ac5089..af0fb849a4 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H @@ -156,7 +156,7 @@ class vtkPV3Foam bool empty() const { - return (size_ == 0); + return !size_; } void reset() diff --git a/applications/utilities/postProcessing/graphics/PVFoamReader/vtkFoam/vtkFoam.C b/applications/utilities/postProcessing/graphics/PVFoamReader/vtkFoam/vtkFoam.C index 6d6eef9b5f..6a1830b5d1 100644 --- a/applications/utilities/postProcessing/graphics/PVFoamReader/vtkFoam/vtkFoam.C +++ b/applications/utilities/postProcessing/graphics/PVFoamReader/vtkFoam/vtkFoam.C @@ -194,7 +194,7 @@ void Foam::vtkFoam::updateSelectedRegions() // Read the selected patches and add to the region list for (int i=0; iGetRegionSelection()->GetArraySetting(i); } } @@ -282,7 +282,7 @@ void Foam::vtkFoam::convertMesh() else { // A patch already existent in the list and which - // continues to exist found + // continues to exist found regioni++; } } @@ -391,7 +391,7 @@ Foam::vtkFoam::vtkFoam(const char* const FileName, vtkFoamReader* reader) { fileName fullCasePath(fileName(FileName).path()); - if (!dir(fullCasePath)) + if (!isDir(fullCasePath)) { return; } @@ -572,7 +572,7 @@ void Foam::vtkFoam::Update() { Info<< "Reading Mesh" << endl; } - meshPtr_ = + meshPtr_ = new fvMesh ( IOobject diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H index f01839a930..90f2d3f415 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H @@ -47,7 +47,7 @@ int USERD_set_filenames } caseDir = tmp; - if (!dir(rootDir/caseDir)) + if (!isDir(rootDir/caseDir)) { Info<< rootDir/caseDir << " is not a valid directory." << endl; @@ -144,7 +144,7 @@ int USERD_set_filenames } isTensor[n] = isitTensor; } - + bool lagrangianNamesFound = false; label n = 0; while (!lagrangianNamesFound && n < Num_time_steps) @@ -176,7 +176,7 @@ int USERD_set_filenames Info << "[Found lagrangian]" << endl; delete sprayPtr; - + sprayPtr = new Cloud(*meshPtr); IOobjectList objects(*meshPtr, runTime.timeName(), "lagrangian"); diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/fieldview9Reader.C b/applications/utilities/postProcessing/graphics/fieldview9Reader/fieldview9Reader.C index 10b29fc8b3..11fd038f16 100644 --- a/applications/utilities/postProcessing/graphics/fieldview9Reader/fieldview9Reader.C +++ b/applications/utilities/postProcessing/graphics/fieldview9Reader/fieldview9Reader.C @@ -132,8 +132,8 @@ static void errorMsg(const string& msg) // Simple check if directory is valid case directory. static bool validCase(const fileName& rootAndCase) { - //if (dir(rootAndCase/"system") && dir(rootAndCase/"constant")) - if (dir(rootAndCase/"constant")) + //if (isDir(rootAndCase/"system") && isDir(rootAndCase/"constant")) + if (isDir(rootAndCase/"constant")) { return true; } @@ -528,7 +528,7 @@ void user_query_file_function return; } - + } fileName rootDir(rootAndCase.path()); diff --git a/applications/utilities/postProcessing/sampling/sample/sampleDict b/applications/utilities/postProcessing/sampling/sample/sampleDict index b605f29e57..215add79a7 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleDict +++ b/applications/utilities/postProcessing/sampling/sample/sampleDict @@ -180,7 +180,7 @@ surfaces triangleCut { - // Cutingplaneusing iso surface + // Cutingplane using iso surface type cuttingPlane; planeType pointAndNormal; pointAndNormalDict diff --git a/applications/utilities/postProcessing/velocityField/Mach/Mach.C b/applications/utilities/postProcessing/velocityField/Mach/Mach.C index 917a53668f..02c69df34a 100644 --- a/applications/utilities/postProcessing/velocityField/Mach/Mach.C +++ b/applications/utilities/postProcessing/velocityField/Mach/Mach.C @@ -63,7 +63,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) volVectorField U(Uheader, mesh); - if (file(runTime.constantPath()/"thermophysicalProperties")) + if (isFile(runTime.constantPath()/"thermophysicalProperties")) { // thermophysical Mach autoPtr thermo diff --git a/applications/utilities/surface/surfaceCoordinateSystemTransform/Make/files b/applications/utilities/surface/surfaceCoordinateSystemTransform/Make/files deleted file mode 100644 index b937625a71..0000000000 --- a/applications/utilities/surface/surfaceCoordinateSystemTransform/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -surfaceCoordinateSystemTransform.C - -EXE = $(FOAM_APPBIN)/surfaceCoordinateSystemTransform diff --git a/applications/utilities/surface/surfaceMeshConvert/Make/options b/applications/utilities/surface/surfaceMeshConvert/Make/options index 5293dabe4c..42b30c8652 100644 --- a/applications/utilities/surface/surfaceMeshConvert/Make/options +++ b/applications/utilities/surface/surfaceMeshConvert/Make/options @@ -1,5 +1,5 @@ EXE_INC = \ - -I$(LIB_SRC)/triSurface/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude -EXE_LIBS = -lsurfMesh +EXE_LIBS = -lmeshTools -lsurfMesh diff --git a/applications/utilities/surface/surfaceCoordinateSystemTransform/coordinateSystems b/applications/utilities/surface/surfaceMeshConvert/coordinateSystems similarity index 100% rename from applications/utilities/surface/surfaceCoordinateSystemTransform/coordinateSystems rename to applications/utilities/surface/surfaceMeshConvert/coordinateSystems diff --git a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C index 9b5c2cb8f7..3a48a5deda 100644 --- a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C +++ b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C @@ -26,25 +26,30 @@ Application surfaceMeshConvert Description - Converts from one surface mesh format to another + + Convert between surface formats with optional scaling or + transformations (rotate/translate) on a coordinateSystem. Usage - surfaceMeshConvert inputFile outputFile [OPTION] @param -clean \n - Perform some surface checking/cleanup on the input surface + Perform some surface checking/cleanup on the input surface. - @param -orient \n - Check face orientation on the input surface + @param -scaleIn \ \n + Specify a scaling factor when reading files. - @param -scale \ \n - Specify a scaling factor for writing the files + @param -scaleOut \ \n + Specify a scaling factor when writing files. - @param -triSurface \n - Use triSurface library for input/output + @param -dict \ \n + Specify an alternative dictionary for constant/coordinateSystems. - @param -keyed \n - Use keyedSurface for input/output + @param -from \ \n + Specify a coordinate System when reading files. + + @param -to \ \n + Specify a coordinate System when writing files. Note The filename extensions are used to determine the file format type. @@ -54,12 +59,9 @@ Note #include "argList.H" #include "timeSelector.H" #include "Time.H" -#include "polyMesh.H" -#include "triSurface.H" -#include "PackedBoolList.H" #include "MeshedSurfaces.H" -#include "UnsortedMeshedSurfaces.H" +#include "coordinateSystems.H" using namespace Foam; @@ -71,24 +73,21 @@ int main(int argc, char *argv[]) argList::noParallel(); argList::validArgs.append("inputFile"); argList::validArgs.append("outputFile"); - argList::validOptions.insert("clean", ""); - argList::validOptions.insert("orient", ""); - argList::validOptions.insert("scale", "scale"); - argList::validOptions.insert("triSurface", ""); - argList::validOptions.insert("unsorted", ""); - argList::validOptions.insert("triFace", ""); -# include "setRootCase.H" - const stringList& params = args.additionalArgs(); + argList::validOptions.insert("clean", "scale"); + argList::validOptions.insert("scaleIn", "scale"); + argList::validOptions.insert("scaleOut", "scale"); + argList::validOptions.insert("dict", "coordinateSystemsDict"); + argList::validOptions.insert("from", "sourceCoordinateSystem"); + argList::validOptions.insert("to", "targetCoordinateSystem"); - scalar scaleFactor = 0; - if (args.options().found("scale")) - { - IStringStream(args.options()["scale"])() >> scaleFactor; - } + argList args(argc, argv); + Time runTime(args.rootPath(), args.caseName()); + const stringList& params = args.additionalArgs(); fileName importName(params[0]); fileName exportName(params[1]); + // disable inplace editing if (importName == exportName) { FatalErrorIn(args.executable()) @@ -96,165 +95,161 @@ int main(int argc, char *argv[]) << exit(FatalError); } + // check that reading/writing is supported if ( - !meshedSurface::canRead(importName, true) - || !meshedSurface::canWriteType(exportName.ext(), true) + !MeshedSurface::canRead(importName, true) + || !MeshedSurface::canWriteType(exportName.ext(), true) ) { return 1; } - if (args.options().found("triSurface")) + + // get the coordinate transformations + autoPtr fromCsys; + autoPtr toCsys; + + if (args.options().found("from") || args.options().found("to")) { - triSurface surf(importName); + autoPtr csDictIoPtr; - Info<< "Read surface:" << endl; - surf.writeStats(Info); - Info<< endl; - - if (args.options().found("orient")) + if (args.options().found("dict")) { - Info<< "Checking surface orientation" << endl; - PatchTools::checkOrientation(surf, true); - Info<< endl; - } + fileName dictPath(args.options()["dict"]); - if (args.options().found("clean")) - { - Info<< "Cleaning up surface" << endl; - surf.cleanup(true); - surf.writeStats(Info); - Info<< endl; - } - - Info<< "writing " << exportName; - if (scaleFactor <= 0) - { - Info<< " without scaling" << endl; + csDictIoPtr.set + ( + new IOobject + ( + ( + isDir(dictPath) + ? dictPath/coordinateSystems::typeName + : dictPath + ), + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ); } else { - Info<< " with scaling " << scaleFactor << endl; - surf.scalePoints(scaleFactor); - surf.writeStats(Info); - Info<< endl; + csDictIoPtr.set + ( + new IOobject + ( + coordinateSystems::typeName, + runTime.constant(), + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ); } - // write sorted by region - surf.write(exportName, true); + + if (!csDictIoPtr->headerOk()) + { + FatalErrorIn(args.executable()) + << "Cannot open coordinateSystems file\n " + << csDictIoPtr->objectPath() << nl + << exit(FatalError); + } + + coordinateSystems csLst(csDictIoPtr()); + + if (args.options().found("from")) + { + const word csName(args.options()["from"]); + + label csId = csLst.find(csName); + if (csId < 0) + { + FatalErrorIn(args.executable()) + << "Cannot find -from " << csName << nl + << "available coordinateSystems: " << csLst.toc() << nl + << exit(FatalError); + } + + fromCsys.reset(new coordinateSystem(csLst[csId])); + } + + if (args.options().found("to")) + { + const word csName(args.options()["to"]); + + label csId = csLst.find(csName); + if (csId < 0) + { + FatalErrorIn(args.executable()) + << "Cannot find -to " << csName << nl + << "available coordinateSystems: " << csLst.toc() << nl + << exit(FatalError); + } + + toCsys.reset(new coordinateSystem(csLst[csId])); + } + + + // maybe fix this later + if (fromCsys.valid() && toCsys.valid()) + { + FatalErrorIn(args.executable()) + << "Only allowed '-from' or '-to' option at the moment." + << exit(FatalError); + } } - else if (args.options().found("unsorted")) + + scalar scaleIn = 0; + scalar scaleOut = 0; + if (args.options().found("scaleIn")) { - UnsortedMeshedSurface surf(importName); - - Info<< "Read surface:" << endl; - surf.writeStats(Info); - Info<< endl; - - if (args.options().found("orient")) - { - Info<< "Checking surface orientation" << endl; - PatchTools::checkOrientation(surf, true); - Info<< endl; - } - - if (args.options().found("clean")) - { - Info<< "Cleaning up surface" << endl; - surf.cleanup(true); - surf.writeStats(Info); - Info<< endl; - } - - Info<< "writing " << exportName; - if (scaleFactor <= 0) - { - Info<< " without scaling" << endl; - } - else - { - Info<< " with scaling " << scaleFactor << endl; - surf.scalePoints(scaleFactor); - surf.writeStats(Info); - Info<< endl; - } - surf.write(exportName); + IStringStream(args.options()["scaleIn"])() >> scaleIn; } -#if 1 - else if (args.options().found("triFace")) + if (args.options().found("scaleOut")) { - MeshedSurface surf(importName); - - Info<< "Read surface:" << endl; - surf.writeStats(Info); - Info<< endl; - - if (args.options().found("orient")) - { - Info<< "Checking surface orientation" << endl; - PatchTools::checkOrientation(surf, true); - Info<< endl; - } - - if (args.options().found("clean")) - { - Info<< "Cleaning up surface" << endl; - surf.cleanup(true); - surf.writeStats(Info); - Info<< endl; - } - - Info<< "writing " << exportName; - if (scaleFactor <= 0) - { - Info<< " without scaling" << endl; - } - else - { - Info<< " with scaling " << scaleFactor << endl; - surf.scalePoints(scaleFactor); - surf.writeStats(Info); - Info<< endl; - } - surf.write(exportName); + IStringStream(args.options()["scaleOut"])() >> scaleOut; } -#endif - else + + { MeshedSurface surf(importName); - Info<< "Read surface:" << endl; - surf.writeStats(Info); - Info<< endl; - - if (args.options().found("orient")) - { - Info<< "Checking surface orientation" << endl; - PatchTools::checkOrientation(surf, true); - Info<< endl; - } - if (args.options().found("clean")) { - Info<< "Cleaning up surface" << endl; surf.cleanup(true); - surf.writeStats(Info); - Info<< endl; + } + + if (scaleIn > 0) + { + Info<< " -scaleIn " << scaleIn << endl; + surf.scalePoints(scaleIn); + } + + if (fromCsys.valid()) + { + Info<< " -from " << fromCsys().name() << endl; + tmp tpf = fromCsys().localPosition(surf.points()); + surf.movePoints(tpf()); + } + + if (toCsys.valid()) + { + Info<< " -to " << toCsys().name() << endl; + tmp tpf = toCsys().globalPosition(surf.points()); + surf.movePoints(tpf()); + } + + if (scaleOut > 0) + { + Info<< " -scaleOut " << scaleOut << endl; + surf.scalePoints(scaleOut); } Info<< "writing " << exportName; - if (scaleFactor <= 0) - { - Info<< " without scaling" << endl; - } - else - { - Info<< " with scaling " << scaleFactor << endl; - surf.scalePoints(scaleFactor); - surf.writeStats(Info); - Info<< endl; - } surf.write(exportName); } diff --git a/applications/utilities/surface/surfaceMeshConvertTesting/Make/files b/applications/utilities/surface/surfaceMeshConvertTesting/Make/files new file mode 100644 index 0000000000..6fd163a054 --- /dev/null +++ b/applications/utilities/surface/surfaceMeshConvertTesting/Make/files @@ -0,0 +1,3 @@ +surfaceMeshConvertTesting.C + +EXE = $(FOAM_APPBIN)/surfaceMeshConvertTesting diff --git a/applications/utilities/surface/surfaceMeshConvertTesting/Make/options b/applications/utilities/surface/surfaceMeshConvertTesting/Make/options new file mode 100644 index 0000000000..3b91e457ea --- /dev/null +++ b/applications/utilities/surface/surfaceMeshConvertTesting/Make/options @@ -0,0 +1,5 @@ +EXE_INC = \ + -I$(LIB_SRC)/triSurface/lnInclude \ + -I$(LIB_SRC)/surfMesh/lnInclude + +EXE_LIBS = -ltriSurface -lsurfMesh diff --git a/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C b/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C new file mode 100644 index 0000000000..ccd85d8e5a --- /dev/null +++ b/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C @@ -0,0 +1,348 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Application + surfaceMeshConvertTesting + +Description + Converts from one surface mesh format to another, but primarily + used for testing functionality. + +Usage + - surfaceMeshConvertTesting inputFile outputFile [OPTION] + + @param -clean \n + Perform some surface checking/cleanup on the input surface + + @param -orient \n + Check face orientation on the input surface + + @param -scale \ \n + Specify a scaling factor for writing the files + + @param -triSurface \n + Use triSurface library for input/output + + @param -keyed \n + Use keyedSurface for input/output + +Note + The filename extensions are used to determine the file format type. + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "timeSelector.H" +#include "Time.H" +#include "polyMesh.H" +#include "triSurface.H" +#include "surfMesh.H" +#include "surfFields.H" +#include "surfPointFields.H" +#include "PackedBoolList.H" + +#include "MeshedSurfaces.H" +#include "UnsortedMeshedSurfaces.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + argList::noParallel(); + argList::validArgs.append("inputFile"); + argList::validArgs.append("outputFile"); + argList::validOptions.insert("clean", ""); + argList::validOptions.insert("orient", ""); + argList::validOptions.insert("surfMesh", ""); + argList::validOptions.insert("scale", "scale"); + argList::validOptions.insert("triSurface", ""); + argList::validOptions.insert("unsorted", ""); + argList::validOptions.insert("triFace", ""); +# include "setRootCase.H" + const stringList& params = args.additionalArgs(); + + scalar scaleFactor = 0; + if (args.options().found("scale")) + { + IStringStream(args.options()["scale"])() >> scaleFactor; + } + + fileName importName(params[0]); + fileName exportName(params[1]); + + if (importName == exportName) + { + FatalErrorIn(args.executable()) + << "Output file " << exportName << " would overwrite input file." + << exit(FatalError); + } + + if + ( + !MeshedSurface::canRead(importName, true) + || !MeshedSurface::canWriteType(exportName.ext(), true) + ) + { + return 1; + } + + if (args.options().found("triSurface")) + { + triSurface surf(importName); + + Info<< "Read surface:" << endl; + surf.writeStats(Info); + Info<< endl; + + if (args.options().found("orient")) + { + Info<< "Checking surface orientation" << endl; + PatchTools::checkOrientation(surf, true); + Info<< endl; + } + + if (args.options().found("clean")) + { + Info<< "Cleaning up surface" << endl; + surf.cleanup(true); + surf.writeStats(Info); + Info<< endl; + } + + Info<< "writing " << exportName; + if (scaleFactor <= 0) + { + Info<< " without scaling" << endl; + } + else + { + Info<< " with scaling " << scaleFactor << endl; + surf.scalePoints(scaleFactor); + surf.writeStats(Info); + Info<< endl; + } + + // write sorted by region + surf.write(exportName, true); + } + else if (args.options().found("unsorted")) + { + UnsortedMeshedSurface surf(importName); + + Info<< "Read surface:" << endl; + surf.writeStats(Info); + Info<< endl; + + if (args.options().found("orient")) + { + Info<< "Checking surface orientation" << endl; + PatchTools::checkOrientation(surf, true); + Info<< endl; + } + + if (args.options().found("clean")) + { + Info<< "Cleaning up surface" << endl; + surf.cleanup(true); + surf.writeStats(Info); + Info<< endl; + } + + Info<< "writing " << exportName; + if (scaleFactor <= 0) + { + Info<< " without scaling" << endl; + } + else + { + Info<< " with scaling " << scaleFactor << endl; + surf.scalePoints(scaleFactor); + surf.writeStats(Info); + Info<< endl; + } + surf.write(exportName); + } +#if 1 + else if (args.options().found("triFace")) + { + MeshedSurface surf(importName); + + Info<< "Read surface:" << endl; + surf.writeStats(Info); + Info<< endl; + + if (args.options().found("orient")) + { + Info<< "Checking surface orientation" << endl; + PatchTools::checkOrientation(surf, true); + Info<< endl; + } + + if (args.options().found("clean")) + { + Info<< "Cleaning up surface" << endl; + surf.cleanup(true); + surf.writeStats(Info); + Info<< endl; + } + + Info<< "writing " << exportName; + if (scaleFactor <= 0) + { + Info<< " without scaling" << endl; + } + else + { + Info<< " with scaling " << scaleFactor << endl; + surf.scalePoints(scaleFactor); + surf.writeStats(Info); + Info<< endl; + } + surf.write(exportName); + } +#endif + else + { + MeshedSurface surf(importName); + + Info<< "Read surface:" << endl; + surf.writeStats(Info); + Info<< endl; + + if (args.options().found("orient")) + { + Info<< "Checking surface orientation" << endl; + PatchTools::checkOrientation(surf, true); + Info<< endl; + } + + if (args.options().found("clean")) + { + Info<< "Cleaning up surface" << endl; + surf.cleanup(true); + surf.writeStats(Info); + Info<< endl; + } + + + Info<< "writing " << exportName; + if (scaleFactor <= 0) + { + Info<< " without scaling" << endl; + } + else + { + Info<< " with scaling " << scaleFactor << endl; + surf.scalePoints(scaleFactor); + surf.writeStats(Info); + Info<< endl; + } + surf.write(exportName); + + if (args.options().found("surfMesh")) + { + Foam::Time runTime + ( + args.rootPath(), + args.caseName() + ); + + surfMesh surfOut + ( + IOobject + ( + "mySurf", + runTime.instance(), + runTime + ), + surf.xfer() + ); + + Info<< "writing surfMesh as well: " << surfOut.objectPath() << endl; + surfOut.write(); + + surfLabelField zoneIds + ( + IOobject + ( + "zoneIds", + surfOut.instance(), + surfOut, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + surfOut, + dimless + ); + + const surfZoneList& zones = surfOut.surfZones(); + forAll(zones, zoneI) + { + SubList