From b968e62ef9fcf2a19a7ae84c3566895941491cd2 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 6 Mar 2009 15:18:00 +0100 Subject: [PATCH 01/36] objectRegistry fixes - objectRegistry gets a rename() that also adjusts the dbDir - cloud reworked to use static variables subInstance and defaultName. This avoids writing "lagrangian" everywhere string fixes - avoid masking of std::string::replace in string.H - avoid old strstream in PV3FoamReader --- applications/test/string/stringTest.C | 25 ++++++++++++++-- .../decomposePar/decomposePar.C | 6 ++-- ...lagrangianFieldDecomposerDecomposeFields.C | 2 +- .../reconstructPar/reconstructLagrangian.H | 1 + .../reconstructLagrangianFields.C | 6 ++-- .../reconstructPar/reconstructPar.C | 4 +-- .../foamToEnsight/ensightCloudField.H | 1 + .../foamToEnsight/foamToEnsight.C | 10 +++---- .../foamToEnsightParts/ensightOutputCase.H | 4 +-- .../ensightOutputFunctions.C | 5 ++-- .../ensightOutputFunctions.H | 5 ++-- .../foamToEnsightParts/findFields.H | 4 +-- .../foamToEnsightParts/foamToEnsightParts.C | 14 +++++++-- .../foamToFieldview9/createSprayFields.H | 4 +-- .../foamToFieldview9/getFieldNames.H | 2 +- .../dataConversion/foamToGMV/foamToGMV.C | 18 +++++------ .../dataConversion/foamToGMV/gmvOutput.H | 30 +++++++++---------- .../foamToGMV/gmvOutputLagrangian.H | 4 +-- .../dataConversion/foamToGMV/gmvOutputSpray.H | 2 +- .../dataConversion/foamToVTK/foamToVTK.C | 8 ++--- .../foamToVTK/lagrangianWriter.H | 1 + .../foamToVTK/lagrangianWriterTemplates.C | 2 +- .../PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H | 5 ++++ .../vtkPV3Foam/vtkPV3FoamFields.C | 2 +- .../vtkPV3Foam/vtkPV3FoamLagrangianFields.H | 2 ++ .../vtkPV3Foam/vtkPV3FoamMeshLagrangian.C | 4 +-- .../vtkPV3Foam/vtkPV3FoamUpdateInfo.C | 11 +++---- .../USERD_get_gold_part_build_info.H | 11 +++++-- .../ensightFoamReader/USERD_set_filenames.H | 4 +-- .../ensightFoamReader/getLagrangianScalar.H | 2 +- .../ensightFoamReader/getLagrangianVector.H | 2 +- .../graphics/ensightFoamReader/globalFoam.H | 1 - .../mapFields/MapLagrangianFields.H | 6 ++-- .../preProcessing/mapFields/mapLagrangian.C | 4 +-- .../db/IOstreams/Sstreams/readHexLabel.H | 2 +- .../db/objectRegistry/objectRegistry.C | 28 +++++++++++++---- .../db/objectRegistry/objectRegistry.H | 3 ++ src/OpenFOAM/fields/cloud/cloud.C | 12 ++++---- src/OpenFOAM/fields/cloud/cloud.H | 13 ++++---- .../primitives/strings/string/string.H | 3 ++ .../primitives/strings/wordRe/wordRe.H | 2 +- 41 files changed, 171 insertions(+), 104 deletions(-) diff --git a/applications/test/string/stringTest.C b/applications/test/string/stringTest.C index b8442102f3..2ed59bf88f 100644 --- a/applications/test/string/stringTest.C +++ b/applications/test/string/stringTest.C @@ -70,6 +70,28 @@ int main(int argc, char *argv[]) string test2("~OpenFOAM/controlDict"); Info<< test2 << " => " << test2.expand() << endl; + // replace controlDict with "newName" + { + string::size_type i = test2.rfind('/'); + + if (i == string::npos) + { + test2 = "newName"; + } + else + { + // this uses the std::string::replace + test2.replace(i+1, string::npos, "newName"); + } + Info<< "after replace: " << test2 << endl; + + // do another replace + // this uses the Foam::string::replace + test2.replace("OpenFOAM", "openfoam"); + + Info<< "after replace: " << test2 << endl; + } + string s; Sin.getLine(s); @@ -78,8 +100,7 @@ int main(int argc, char *argv[]) cout<< "output string with " << s2.length() << " characters\n"; cout<< "ostream<< >" << s2 << "<\n"; Info<< "Ostream<< >" << s2 << "<\n"; - Info<< "hash:" << unsigned(string::hash()(s2)) << endl; - + Info<< "hash:" << hex << string::hash()(s2) << endl; Info << "End\n" << endl; diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index fff19e006d..d011fe4a4b 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -312,7 +312,7 @@ int main(int argc, char *argv[]) fileNameList cloudDirs ( - readDir(runTime.timePath()/"lagrangian", fileName::DIRECTORY) + readDir(runTime.timePath()/cloud::subInstance, fileName::DIRECTORY) ); // Particles @@ -344,7 +344,7 @@ int main(int argc, char *argv[]) ( mesh, runTime.timeName(), - "lagrangian"/cloudDirs[i] + cloud::subInstance/cloudDirs[i] ); IOobject* positionsPtr = sprayObjs.lookup("positions"); @@ -418,7 +418,7 @@ int main(int argc, char *argv[]) ( mesh, runTime.timeName(), - "lagrangian"/cloudDirs[cloudI] + cloud::subInstance/cloudDirs[cloudI] ); lagrangianFieldDecomposer::readFields diff --git a/applications/utilities/parallelProcessing/decomposePar/lagrangianFieldDecomposerDecomposeFields.C b/applications/utilities/parallelProcessing/decomposePar/lagrangianFieldDecomposerDecomposeFields.C index 4f11f4d53f..0ed0071aae 100644 --- a/applications/utilities/parallelProcessing/decomposePar/lagrangianFieldDecomposerDecomposeFields.C +++ b/applications/utilities/parallelProcessing/decomposePar/lagrangianFieldDecomposerDecomposeFields.C @@ -88,7 +88,7 @@ tmp > lagrangianFieldDecomposer::decomposeField ( field.name(), procMesh_.time().timeName(), - "lagrangian"/cloudName, + cloud::subInstance/cloudName, procMesh_, IOobject::NO_READ, IOobject::NO_WRITE diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructLagrangian.H b/applications/utilities/parallelProcessing/reconstructPar/reconstructLagrangian.H index 0cefe9e641..18d282a909 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructLagrangian.H +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructLagrangian.H @@ -36,6 +36,7 @@ SourceFiles #ifndef reconstructLagrangian_H #define reconstructLagrangian_H +#include "cloud.H" #include "polyMesh.H" #include "IOobjectList.H" #include "fvMesh.H" diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructLagrangianFields.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructLagrangianFields.C index 1f357fa64f..705881be10 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructLagrangianFields.C +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructLagrangianFields.C @@ -47,7 +47,7 @@ Foam::tmp > Foam::reconstructLagrangianField ( fieldName, mesh.time().timeName(), - "lagrangian"/cloudName, + cloud::subInstance/cloudName, mesh, IOobject::NO_READ, IOobject::NO_WRITE @@ -61,10 +61,10 @@ Foam::tmp > Foam::reconstructLagrangianField { // Check object on local mesh IOobject localIOobject - ( + ( fieldName, meshes[i].time().timeName(), - "lagrangian"/cloudName, + cloud::subInstance/cloudName, meshes[i], IOobject::MUST_READ, IOobject::NO_WRITE diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C index 20def06b9c..fe43c44251 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C @@ -277,7 +277,7 @@ int main(int argc, char *argv[]) ( readDir ( - databases[procI].timePath()/regionPrefix/"lagrangian", + databases[procI].timePath()/regionPrefix/cloud::subInstance, fileName::DIRECTORY ) ); @@ -295,7 +295,7 @@ int main(int argc, char *argv[]) ( procMeshes.meshes()[procI], databases[procI].timeName(), - "lagrangian"/cloudDirs[i] + cloud::subInstance/cloudDirs[i] ); IOobject* positionsPtr = sprayObjs.lookup("positions"); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudField.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudField.H index 3e06a1674d..f6cd858dc6 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudField.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudField.H @@ -35,6 +35,7 @@ SourceFiles #ifndef ensightCloudField_H #define ensightCloudField_H +#include "Cloud.H" #include "IOobject.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C index bb7c1880f0..06dd108985 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C @@ -211,7 +211,7 @@ int main(int argc, char *argv[]) fileNameList cloudDirs = readDir ( - runTime.timePath()/regionPrefix/"lagrangian", + runTime.timePath()/regionPrefix/cloud::subInstance, fileName::DIRECTORY ); @@ -221,7 +221,7 @@ int main(int argc, char *argv[]) ( mesh, runTime.timeName(), - "lagrangian"/cloudDirs[cloudI] + cloud::subInstance/cloudDirs[cloudI] ); IOobject* positionsPtr = cloudObjs.lookup("positions"); @@ -266,7 +266,7 @@ int main(int argc, char *argv[]) ( mesh, runTime.timeName(), - "lagrangian"/cloudIter.key() + cloud::subInstance/cloudIter.key() ); forAllConstIter(IOobjectList, cloudObjs, fieldIter) @@ -426,7 +426,7 @@ int main(int argc, char *argv[]) fileNameList currentCloudDirs = readDir ( - runTime.timePath()/regionPrefix/"lagrangian", + runTime.timePath()/regionPrefix/cloud::subInstance, fileName::DIRECTORY ); @@ -449,7 +449,7 @@ int main(int argc, char *argv[]) ( fieldName, mesh.time().timeName(), - "lagrangian"/cloudName, + cloud::subInstance/cloudName, mesh, IOobject::MUST_READ ); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputCase.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputCase.H index d8f079ea6d..1ef4c55032 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputCase.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputCase.H @@ -42,7 +42,7 @@ forAllConstIter(HashTable >, cloudFields, cloudIter) caseFile << setw(16) << "measured: 2" - << fileName(dataMask/"lagrangian"/cloudName/"positions").c_str() + << fileName(dataMask/cloud::subInstance/cloudName/"positions").c_str() << nl; } caseFile @@ -122,7 +122,7 @@ forAllConstIter(HashTable >, cloudFields, cloudIter) ensightType, fieldName, dataMask, - "lagrangian"/cloudName, + cloud::subInstance/cloudName, cloudNo, 2 ); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.C index ca472e073c..7e1a992f88 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.C @@ -27,7 +27,6 @@ License #include "ensightOutputFunctions.H" #include "passiveParticle.H" -#include "Cloud.H" #include "IOField.H" #include "volFields.H" #include "surfaceFields.H" @@ -101,7 +100,7 @@ void ensightParticlePositions { Cloud parcels(mesh, cloudName, false); - fileName cloudDir = subDir/"lagrangian"/cloudName; + fileName cloudDir = subDir/cloud::subInstance/cloudName; fileName postFileName = cloudDir/"positions"; // the ITER/lagrangian subdirectory must exist @@ -165,7 +164,7 @@ void ensightLagrangianField { Info<< " " << fieldObject.name() << flush; - fileName cloudDir = subDir/"lagrangian"/cloudName; + fileName cloudDir = subDir/cloud::subInstance/cloudName; fileName postFileName = cloudDir/fieldObject.name(); string title = diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.H index 7afc250fe3..75437c2d69 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.H @@ -23,9 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Description - - miscellaneous collection of functions and template related - to Ensight data + Miscellaneous collection of functions and template related to Ensight data SourceFiles ensightOutputFunctions.C @@ -36,6 +34,7 @@ SourceFiles #define ensightOutputFunctions_H #include "ensightFile.H" +#include "Cloud.H" #include "polyMesh.H" #include "IOobject.H" diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H index cca3fbbcd3..7170059b08 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H @@ -36,7 +36,7 @@ if (timeDirs.size() > 1) runTime.path() / timeDirs[timeDirs.size() - 1].name() / regionPrefix - / "lagrangian", + / cloud::subInstance, fileName::DIRECTORY ); @@ -55,7 +55,7 @@ if (timeDirs.size() > 1) ( mesh, timeDirs[timeDirs.size() - 1].name(), - "lagrangian"/cloudName + cloud::subInstance/cloudName ); bool hasPositions = false; diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C index 329dda87f9..1665550632 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C @@ -324,7 +324,14 @@ int main(int argc, char *argv[]) { const word& cloudName = cloudIter.key(); - if (!isDir(runTime.timePath()/regionPrefix/"lagrangian"/cloudName)) + if + ( + !isDir + ( + runTime.timePath()/regionPrefix/ + cloud::subInstance/cloudName + ) + ) { continue; } @@ -333,7 +340,7 @@ int main(int argc, char *argv[]) ( mesh, runTime.timeName(), - "lagrangian"/cloudName + cloud::subInstance/cloudName ); // check that the positions field is present for this time @@ -365,7 +372,8 @@ int main(int argc, char *argv[]) if (!fieldObject) { Info<< "missing " - << runTime.timeName()/"lagrangian"/cloudName/fieldName + << runTime.timeName()/cloud::subInstance/cloudName + / fieldName << endl; continue; } diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/createSprayFields.H b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/createSprayFields.H index e28a04b58c..f6ee45f1bb 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/createSprayFields.H +++ b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/createSprayFields.H @@ -21,7 +21,7 @@ List* > sprayVectorFieldPtrs ( sprayScalarNames[fieldI], runTime.timeName(), - "lagrangian", + cloud::subInstance, mesh, IOobject::MUST_READ, IOobject::NO_WRITE @@ -53,7 +53,7 @@ List* > sprayVectorFieldPtrs ( sprayVectorNames[fieldI], runTime.timeName(), - "lagrangian", + cloud::subInstance, mesh, IOobject::MUST_READ, IOobject::NO_WRITE diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H index 9a97899625..4b39cf68bb 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H +++ b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H @@ -42,7 +42,7 @@ forAll(Times, timeI) // Same for spray - IOobjectList sprayObjects(mesh, runTime.timeName(), "lagrangian"); + IOobjectList sprayObjects(mesh, runTime.timeName(), cloud::subInstance); { wordList fieldNames(sprayObjects.names(scalarIOField::typeName)); forAll(fieldNames, fieldI) diff --git a/applications/utilities/postProcessing/dataConversion/foamToGMV/foamToGMV.C b/applications/utilities/postProcessing/dataConversion/foamToGMV/foamToGMV.C index b32952e9bb..de0776df6c 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToGMV/foamToGMV.C +++ b/applications/utilities/postProcessing/dataConversion/foamToGMV/foamToGMV.C @@ -44,21 +44,21 @@ Description int main(int argc, char *argv[]) { const label nTypes = 4; - const word fieldTypes[] = - { - "volScalarField", - "volVectorField", + const word fieldTypes[] = + { + "volScalarField", + "volVectorField", "surfaceScalarField", - "lagrangian" + cloud::subInstance }; # include "setRootCase.H" - + # include "createTime.H" # include "createMesh.H" # include "readConversionProperties.H" - + // get the available time-steps instantList TimeList = runTime.times(); Info << TimeList << endl; @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) // Set Time runTime.setTime(TimeList[n], n); word CurTime = runTime.timeName(); - + IOobjectList objects(mesh, runTime.timeName()); # include "moveMesh.H" @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) // set the filename of the GMV file fileName gmvFileName = "plotGMV." + itoa(n); OFstream gmvFile(args.rootPath()/args.caseName()/gmvFileName); - + # include "gmvOutputHeader.H" # include "gmvOutput.H" # include "gmvOutputTail.H" diff --git a/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H b/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H index 76f834c431..237c8765b8 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H +++ b/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H @@ -2,13 +2,13 @@ for(label i=0; i < nTypes; i++) { wordList fieldNames = objects.names(fieldTypes[i]); - if ( fieldTypes[i] == "volScalarField" ) + if ( fieldTypes[i] == "volScalarField" ) { gmvFile << "variable" << nl; } for(label j=0; j < fieldNames.size(); j++) { - + word fieldName = fieldNames[j]; IOobject fieldObject @@ -19,8 +19,8 @@ for(label i=0; i < nTypes; i++) IOobject::MUST_READ, IOobject::NO_WRITE ); - - if ( fieldTypes[i] == "volScalarField" ) + + if ( fieldTypes[i] == "volScalarField" ) { volScalarField gmvScalarField(fieldObject, mesh); gmvFile << fieldName << " 0" << nl; @@ -30,8 +30,8 @@ for(label i=0; i < nTypes; i++) } gmvFile << nl; } - - if ( fieldTypes[i] == "volVectorField" ) + + if ( fieldTypes[i] == "volVectorField" ) { if (fieldName == vComp) { @@ -52,21 +52,21 @@ for(label i=0; i < nTypes; i++) gmvFile << nl; } } - - if ( fieldTypes[i] == "surfaceScalarField" ) + + if ( fieldTypes[i] == "surfaceScalarField" ) { // ... } - + } - if ( fieldTypes[i] == "lagrangian") + if ( fieldTypes[i] == cloud::subInstance ) { IOobject lagrangianHeader ( "positions", runTime.timeName(), - "lagrangian", + cloud::subInstance, mesh, IOobject::NO_READ ); @@ -74,9 +74,9 @@ for(label i=0; i < nTypes; i++) if (lagrangianHeader.headerOk()) { Cloud particles(mesh); - - IOobjectList objects(mesh, runTime.timeName(), "lagrangian"); - + + IOobjectList objects(mesh, runTime.timeName(), cloud::subInstance); + wordList lagrangianScalarNames = objects.names("scalarField"); wordList lagrangianVectorNames = objects.names("vectorField"); @@ -87,7 +87,7 @@ for(label i=0; i < nTypes; i++) } } - if ( fieldTypes[i] == "volScalarField" ) + if ( fieldTypes[i] == "volScalarField" ) { gmvFile << "endvars" << nl; } diff --git a/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutputLagrangian.H b/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutputLagrangian.H index 89c126c1e3..28104661de 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutputLagrangian.H +++ b/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutputLagrangian.H @@ -42,7 +42,7 @@ forAll(lagrangianScalarNames, i) ( name, runTime.timeName(), - "lagrangian", + cloud::subInstance, mesh, IOobject::MUST_READ, IOobject::NO_WRITE @@ -73,7 +73,7 @@ forAll(lagrangianVectorNames, i) ( name, runTime.timeName(), - "lagrangian", + cloud::subInstance, mesh, IOobject::MUST_READ, IOobject::NO_WRITE diff --git a/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutputSpray.H b/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutputSpray.H index f5d5b3c8c6..b0beea2274 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutputSpray.H +++ b/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutputSpray.H @@ -40,7 +40,7 @@ forAll(lagrangianScalarNames, i) ( name, runTime.timeName(), - "lagrangian", + cloud::subInstance, mesh, IOobject::MUST_READ, IOobject::NO_WRITE diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C index e03c76c057..c98088ff46 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C @@ -914,7 +914,7 @@ int main(int argc, char *argv[]) ( readDir ( - runTime.timePath()/regionPrefix/"lagrangian", + runTime.timePath()/regionPrefix/cloud::subInstance, fileName::DIRECTORY ) ); @@ -925,18 +925,18 @@ int main(int argc, char *argv[]) ( mesh, runTime.timeName(), - "lagrangian"/cloudDirs[i] + cloud::subInstance/cloudDirs[i] ); IOobject* positionsPtr = sprayObjs.lookup("positions"); if (positionsPtr) { - mkDir(fvPath/"lagrangian"/cloudDirs[i]); + mkDir(fvPath/cloud::subInstance/cloudDirs[i]); fileName lagrFileName ( - fvPath/"lagrangian"/cloudDirs[i]/cloudDirs[i] + fvPath/cloud::subInstance/cloudDirs[i]/cloudDirs[i] + "_" + name(timeI) + ".vtk" ); diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/lagrangianWriter.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/lagrangianWriter.H index 8923ba8590..bd13ec2571 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/lagrangianWriter.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/lagrangianWriter.H @@ -39,6 +39,7 @@ SourceFiles #include "globalPointPatch.H" #include "OFstream.H" +#include "Cloud.H" #include "volFields.H" #include "pointFields.H" #include "vtkMesh.H" diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/lagrangianWriterTemplates.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/lagrangianWriterTemplates.C index 37c8051383..e558186e39 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/lagrangianWriterTemplates.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/lagrangianWriterTemplates.C @@ -41,7 +41,7 @@ void Foam::lagrangianWriter::writeIOField(const wordList& objects) ( object, vMesh_.mesh().time().timeName(), - "lagrangian"/cloudName_, + cloud::subInstance/cloudName_, vMesh_.mesh(), IOobject::MUST_READ, IOobject::NO_WRITE, diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H index 985f6a3d17..9b339f6433 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H @@ -58,6 +58,11 @@ SourceFiles #ifndef vtkPV3Foam_H #define vtkPV3Foam_H +// do not include legacy strstream headers +#ifndef VTK_EXCLUDE_STRSTREAM_HEADERS +# define VTK_EXCLUDE_STRSTREAM_HEADERS +#endif + #include "className.H" #include "fileName.H" #include "volPointInterpolation.H" diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFields.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFields.C index 4da5f7de7e..6efa7e9bf7 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFields.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFields.C @@ -268,7 +268,7 @@ void Foam::vtkPV3Foam::convertLagrangianFields ( mesh, dbPtr_().timeName(), - "lagrangian"/cloudName + cloud::subInstance/cloudName ); pruneObjectList(objects, selectedFields); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamLagrangianFields.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamLagrangianFields.H index ade6112e61..58422d69f4 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamLagrangianFields.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamLagrangianFields.H @@ -30,6 +30,8 @@ InClass #ifndef vtkPV3FoamLagrangianFields_H #define vtkPV3FoamLagrangianFields_H +#include "Cloud.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C index bfcffeb787..b84194cd7b 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C @@ -53,7 +53,7 @@ vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh if (debug) { Info<< " Foam::vtkPV3Foam::lagrangianVTKMesh - timePath " - << mesh.time().timePath()/"lagrangian"/cloudName << endl; + << mesh.time().timePath()/cloud::subInstance/cloudName << endl; printMemory(); } @@ -63,7 +63,7 @@ vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh ( mesh, mesh.time().timeName(), - "lagrangian"/cloudName + cloud::subInstance/cloudName ); IOobject* positionsPtr = sprayObjs.lookup("positions"); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C index e587c0cb1f..0c8fd5bf2a 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C @@ -34,6 +34,7 @@ License #include "IOPtrList.H" #include "polyBoundaryMeshEntries.H" #include "entry.H" +#include "Cloud.H" #include "vtkPV3FoamReader.h" // local headers @@ -148,16 +149,16 @@ void Foam::vtkPV3Foam::updateInfoLagrangian() if (debug) { Info<< " Foam::vtkPV3Foam::updateInfoLagrangian" << nl - << " " << dbPtr_->timePath()/"lagrangian" << endl; + << " " << dbPtr_->timePath()/cloud::subInstance << endl; } // use the db directly since this might be called without a mesh, // but the region must get added back in - fileName lagrangianPrefix("lagrangian"); + fileName lagrangianPrefix(cloud::subInstance); if (meshRegion_ != polyMesh::defaultRegion) { - lagrangianPrefix = meshRegion_/"lagrangian"; + lagrangianPrefix = meshRegion_/cloud::subInstance; } // Search for list of lagrangian objects for this time @@ -463,10 +464,10 @@ void Foam::vtkPV3Foam::updateInfoLagrangianFields() // use the db directly since this might be called without a mesh, // but the region must get added back in - fileName lagrangianPrefix("lagrangian"); + fileName lagrangianPrefix(cloud::subInstance); if (meshRegion_ != polyMesh::defaultRegion) { - lagrangianPrefix = meshRegion_/"lagrangian"; + lagrangianPrefix = meshRegion_/cloud::subInstance; } IOobjectList objects diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_gold_part_build_info.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_gold_part_build_info.H index 70d5c9f2a7..6eb8c22a82 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_gold_part_build_info.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_gold_part_build_info.H @@ -35,7 +35,7 @@ int USERD_get_gold_part_build_info for(label i=0; iboundary()[i].name()); - strncpy(part_descriptions[i+1], patchName.c_str(), Z_BUFL); + strncpy(part_descriptions[i+1], patchName.c_str(), Z_BUFL); } label nHex08 = 0; @@ -101,7 +101,7 @@ int USERD_get_gold_part_build_info */ number_of_nodes[0] = meshPtr->nPoints(); - + const polyBoundaryMesh& bMesh = meshPtr->boundaryMesh(); for(label i=0; i nPatches+1) { - strncpy(part_descriptions[nPatches+1], sprayName.c_str(), Z_BUFL); + strncpy + ( + part_descriptions[nPatches+1], + cloud::subInstance.c_str(), + Z_BUFL + ); number_of_elements[nPatches+1][Z_POINT] = sprayPtr->size(); number_of_nodes[nPatches+1] = sprayPtr->size(); } diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H index 90f2d3f415..e1f655cecb 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H @@ -164,7 +164,7 @@ int USERD_set_filenames ( "positions", runTime.timeName(), - "lagrangian", + cloud::subInstance, runTime, IOobject::NO_READ, IOobject::NO_WRITE, @@ -179,7 +179,7 @@ int USERD_set_filenames sprayPtr = new Cloud(*meshPtr); - IOobjectList objects(*meshPtr, runTime.timeName(), "lagrangian"); + IOobjectList objects(*meshPtr, runTime.timeName(), cloud::subInstance); lagrangianScalarNames = (const wordList&)objects.names(sprayScalarFieldName); diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianScalar.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianScalar.H index e9259e3cc7..2093fd05af 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianScalar.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianScalar.H @@ -12,7 +12,7 @@ if (nVar >= 0) ( name, runTime.timeName(), - "lagrangian", + cloud::subInstance, mesh, IOobject::MUST_READ, IOobject::NO_WRITE diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianVector.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianVector.H index 42fcc8560f..9e41fe02c0 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianVector.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianVector.H @@ -14,7 +14,7 @@ if (nVar >= 0) ( name, runTime.timeName(), - "lagrangian", + cloud::subInstance, mesh, IOobject::MUST_READ, IOobject::NO_WRITE diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/globalFoam.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/globalFoam.H index 4606671860..d68861b138 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/globalFoam.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/globalFoam.H @@ -32,7 +32,6 @@ static bool isSpray[maxNames]; static word scalarName = "volScalarField"; static word vectorName = "volVectorField"; static word tensorName = "volTensorField"; -static word sprayName = "lagrangian"; static word sprayScalarFieldName = "scalarField"; static word sprayVectorFieldName = "vectorField"; static word sprayTensorFieldName = "tensorField"; diff --git a/applications/utilities/preProcessing/mapFields/MapLagrangianFields.H b/applications/utilities/preProcessing/mapFields/MapLagrangianFields.H index 830d6d825d..373b393eac 100644 --- a/applications/utilities/preProcessing/mapFields/MapLagrangianFields.H +++ b/applications/utilities/preProcessing/mapFields/MapLagrangianFields.H @@ -34,6 +34,7 @@ Description #ifndef MapLagrangianFields_H #define MapLagrangianFields_H +#include "cloud.H" #include "GeometricField.H" #include "meshToMesh.H" #include "IOobjectList.H" @@ -60,8 +61,7 @@ void MapLagrangianFields forAllIter(IOobjectList, fields, fieldIter) { - Info<< " mapping lagrangian field " - << fieldIter()->name() << endl; + Info<< " mapping lagrangian field " << fieldIter()->name() << endl; // Read field (does not need mesh) IOField fieldSource(*fieldIter()); @@ -73,7 +73,7 @@ void MapLagrangianFields ( fieldIter()->name(), meshTarget.time().timeName(), - "lagrangian"/cloudName, + cloud::subInstance/cloudName, meshTarget, IOobject::NO_READ, IOobject::NO_WRITE, diff --git a/applications/utilities/preProcessing/mapFields/mapLagrangian.C b/applications/utilities/preProcessing/mapFields/mapLagrangian.C index e57aa9761c..fe5e1c70dd 100644 --- a/applications/utilities/preProcessing/mapFields/mapLagrangian.C +++ b/applications/utilities/preProcessing/mapFields/mapLagrangian.C @@ -94,7 +94,7 @@ void mapLagrangian(const meshToMesh& meshToMeshInterp) ( readDir ( - meshSource.time().timePath()/"lagrangian", + meshSource.time().timePath()/cloud::subInstance, fileName::DIRECTORY ) ); @@ -106,7 +106,7 @@ void mapLagrangian(const meshToMesh& meshToMeshInterp) ( meshSource, meshSource.time().timeName(), - "lagrangian"/cloudDirs[cloudI] + cloud::subInstance/cloudDirs[cloudI] ); IOobject* positionsPtr = objects.lookup("positions"); diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/readHexLabel.H b/src/OpenFOAM/db/IOstreams/Sstreams/readHexLabel.H index fffccc4525..37811c0d67 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/readHexLabel.H +++ b/src/OpenFOAM/db/IOstreams/Sstreams/readHexLabel.H @@ -45,7 +45,7 @@ namespace Foam { //- Read a hex label from an input stream -label readHexLabel(ISstream& is); +label readHexLabel(ISstream&); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.C b/src/OpenFOAM/db/objectRegistry/objectRegistry.C index 1038ecffa1..b8324dd8a8 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistry.C +++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.C @@ -98,7 +98,7 @@ Foam::wordList Foam::objectRegistry::names() const wordList objectNames(size()); label count=0; - for (const_iterator iter = begin(); iter != end(); ++iter) + for (const_iterator iter = cbegin(); iter != cend(); ++iter) { objectNames[count++] = iter()->name(); } @@ -112,7 +112,7 @@ Foam::wordList Foam::objectRegistry::names(const word& ClassName) const wordList objectNames(size()); label count=0; - for (const_iterator iter = begin(); iter != end(); ++iter) + for (const_iterator iter = cbegin(); iter != cend(); ++iter) { if (iter()->type() == ClassName) { @@ -195,15 +195,33 @@ bool Foam::objectRegistry::checkOut(regIOobject& io) const << " in registry " << name() << endl; } + } + + return false; +} - return false; + +void Foam::objectRegistry::rename(const word& newName) +{ + regIOobject::rename(newName); + + // adjust dbDir_ as well + string::size_type i = dbDir_.rfind('/'); + + if (i == string::npos) + { + dbDir_ = newName; + } + else + { + dbDir_.replace(i+1, string::npos, newName); } } bool Foam::objectRegistry::modified() const { - for (const_iterator iter = begin(); iter != end(); ++iter) + for (const_iterator iter = cbegin(); iter != cend(); ++iter) { if (iter()->modified()) { @@ -248,7 +266,7 @@ bool Foam::objectRegistry::writeObject { bool ok = true; - for (const_iterator iter = begin(); iter != end(); ++iter) + for (const_iterator iter = cbegin(); iter != cend(); ++iter) { if (objectRegistry::debug) { diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.H b/src/OpenFOAM/db/objectRegistry/objectRegistry.H index 6c701e1d85..98f3b4b1f5 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistry.H +++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.H @@ -154,6 +154,9 @@ public: // Edit + //- Rename + virtual void rename(const word& newName); + //- Add an regIOobject to registry bool checkIn(regIOobject&) const; diff --git a/src/OpenFOAM/fields/cloud/cloud.C b/src/OpenFOAM/fields/cloud/cloud.C index 2dd30b5f3c..5dcb6f8328 100644 --- a/src/OpenFOAM/fields/cloud/cloud.C +++ b/src/OpenFOAM/fields/cloud/cloud.C @@ -29,10 +29,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - defineTypeNameAndDebug(cloud, 0); -} +defineTypeNameAndDebug(Foam::cloud, 0); + +const Foam::word Foam::cloud::subInstance("lagrangian"); +Foam::word Foam::cloud::defaultName("defaultCloud"); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -42,9 +42,9 @@ Foam::cloud::cloud(const objectRegistry& obr, const word& cloudName) ( IOobject ( - cloudName, + ( cloudName.size() ? cloudName : defaultName ), obr.time().timeName(), - "lagrangian", + subInstance, obr, IOobject::NO_READ, IOobject::AUTO_WRITE diff --git a/src/OpenFOAM/fields/cloud/cloud.H b/src/OpenFOAM/fields/cloud/cloud.H index 68743e6e96..0891255d14 100644 --- a/src/OpenFOAM/fields/cloud/cloud.H +++ b/src/OpenFOAM/fields/cloud/cloud.H @@ -47,7 +47,7 @@ namespace Foam class mapPolyMesh; /*---------------------------------------------------------------------------*\ - Class cloud Declaration + Class cloud Declaration \*---------------------------------------------------------------------------*/ class cloud @@ -69,15 +69,16 @@ public: //- Runtime type information TypeName("cloud"); + //- The subInstance (local) to prefix: %lagrangian + static const word subInstance; + + //- The default cloud name: %defaultCloud + static word defaultName; // Constructors //- Construct for the given objectRegistry and named cloud instance - cloud - ( - const objectRegistry& obr, - const word& cloudName = "defaultCloud" - ); + cloud(const objectRegistry&, const word& cloudName = ""); // Destructor diff --git a/src/OpenFOAM/primitives/strings/string/string.H b/src/OpenFOAM/primitives/strings/string/string.H index 247b031d6c..97c6dd4d4d 100644 --- a/src/OpenFOAM/primitives/strings/string/string.H +++ b/src/OpenFOAM/primitives/strings/string/string.H @@ -144,6 +144,9 @@ public: template static inline string quotemeta(const string&, const char quote='\\'); + //- Avoid masking the normal std::string replace + using std::string::replace; + //- Replace first occurence of sub-string oldStr with newStr // starting at start string& replace diff --git a/src/OpenFOAM/primitives/strings/wordRe/wordRe.H b/src/OpenFOAM/primitives/strings/wordRe/wordRe.H index aee6c3a883..5ab07b0e66 100644 --- a/src/OpenFOAM/primitives/strings/wordRe/wordRe.H +++ b/src/OpenFOAM/primitives/strings/wordRe/wordRe.H @@ -41,7 +41,7 @@ Description Note If the string contents are changed - eg, by the operator+=() or by string::replace(), etc - it will be necessary to use compile() or - recompile() to sychronize the regular expression. + recompile() to synchronize the regular expression. SourceFiles wordRe.C From 6309810e2e4873cb94ece54010666ea8a3a245d1 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Sun, 8 Mar 2009 00:59:33 +0100 Subject: [PATCH 02/36] surfMesh reworked - treat 'ofs' IO just like any other format - dropped BasicMeshedSurface, since MeshedSurface can now also have zero or more zones - UnsortedMeshedSurface is a special type of MeshedSurface with zero zones, but with additional zoneId labels - use MeshedSurfaceProxy for writing surfaces with points/faces/zones and optional faceMap - provides output interface for MeshedSurface, UnsortedMeshedSurface and surfMesh. - simplify output to filenames only, I can't see that the Ostream is needed anywhere - surfMesh renaming now works, after the objectRegistry fix --- .../surfaceMeshConvertTesting.C | 57 +- src/sampling/cuttingPlane/cuttingPlane.H | 4 +- .../sampledPatch/sampledPatch.H | 4 +- .../BasicMeshedSurface/BasicMeshedSurface.C | 572 ---------- .../BasicMeshedSurface/BasicMeshedSurface.H | 223 ---- src/surfMesh/Make/files | 13 +- src/surfMesh/MeshedSurface/MeshedSurface.C | 993 ++++++++++++------ src/surfMesh/MeshedSurface/MeshedSurface.H | 232 ++-- .../MeshedSurface/MeshedSurfaceCore.C | 2 +- src/surfMesh/MeshedSurface/MeshedSurfaceIO.C | 123 +-- src/surfMesh/MeshedSurface/MeshedSurfaceNew.C | 9 +- .../MeshedSurface/MeshedSurfaceZones.C | 214 ++++ .../MeshedSurfaceIOAllocator.C | 147 +++ .../MeshedSurfaceIOAllocator.H | 194 ++++ .../MeshedSurfaceProxy/MeshedSurfaceProxy.C | 153 +++ .../MeshedSurfaceProxy/MeshedSurfaceProxy.H | 207 ++++ .../MeshedSurfaceProxyCore.C} | 48 +- .../UnsortedMeshedSurface.C | 332 +++--- .../UnsortedMeshedSurface.H | 75 +- .../UnsortedMeshedSurfaceIO.C | 108 -- .../UnsortedMeshedSurfaceNew.C | 11 +- .../surfFields/{ => surfFields}/surfFields.C | 0 .../surfFields/{ => surfFields}/surfFields.H | 0 .../{ => surfFields}/surfFieldsFwd.H | 0 .../surfFields/{ => surfFields}/surfGeoMesh.H | 0 .../surfPointFields/surfPointFields.C | 0 .../surfPointFields/surfPointFields.H | 0 .../surfPointFields/surfPointFieldsFwd.H | 0 .../surfPointFields/surfPointGeoMesh.H | 0 src/surfMesh/surfMesh/surfMesh.C | 235 +++-- src/surfMesh/surfMesh/surfMesh.H | 141 +-- src/surfMesh/surfMesh/surfMeshClear.C | 2 +- src/surfMesh/surfMesh/surfMeshIO.C | 41 +- .../surfaceFormats/ac3d/AC3DsurfaceFormat.C | 173 +-- .../surfaceFormats/ac3d/AC3DsurfaceFormat.H | 64 +- .../ac3d/AC3DsurfaceFormatCore.H | 2 +- .../ac3d/AC3DsurfaceFormatRunTime.C | 11 +- .../surfaceFormats/ftr/FTRsurfaceFormat.H | 3 +- .../ftr/FTRsurfaceFormatRunTime.C | 4 +- .../surfaceFormats/gts/GTSsurfaceFormat.C | 75 +- .../surfaceFormats/gts/GTSsurfaceFormat.H | 53 +- .../gts/GTSsurfaceFormatRunTime.C | 6 +- .../surfaceFormats/nas/NASsurfaceFormat.C | 10 +- .../surfaceFormats/nas/NASsurfaceFormat.H | 3 +- .../surfaceFormats/nas/NASsurfaceFormatCore.C | 3 +- .../nas/NASsurfaceFormatRunTime.C | 7 +- .../surfaceFormats/obj/OBJsurfaceFormat.C | 155 +-- .../surfaceFormats/obj/OBJsurfaceFormat.H | 61 +- .../obj/OBJsurfaceFormatRunTime.C | 30 +- .../surfaceFormats/off/OFFsurfaceFormat.C | 139 +-- .../surfaceFormats/off/OFFsurfaceFormat.H | 60 +- .../surfaceFormats/off/OFFsurfaceFormatCore.C | 78 -- .../off/OFFsurfaceFormatRunTime.C | 29 +- .../surfaceFormats/ofs/OFSsurfaceFormat.C | 260 +++++ .../surfaceFormats/ofs/OFSsurfaceFormat.H | 155 +++ .../OFSsurfaceFormatCore.C} | 52 +- .../OFSsurfaceFormatCore.H} | 17 +- .../OFSsurfaceFormatRunTime.C} | 85 +- .../surfaceFormats/smesh/SMESHsurfaceFormat.C | 142 ++- .../surfaceFormats/smesh/SMESHsurfaceFormat.H | 57 +- .../smesh/SMESHsurfaceFormatCore.C | 71 -- .../smesh/SMESHsurfaceFormatRunTime.C | 27 +- .../starcd/STARCDsurfaceFormat.C | 104 +- .../starcd/STARCDsurfaceFormat.H | 37 +- .../starcd/STARCDsurfaceFormatCore.C | 2 +- .../starcd/STARCDsurfaceFormatCore.H | 2 +- .../starcd/STARCDsurfaceFormatRunTime.C | 29 +- .../surfaceFormats/stl/STLsurfaceFormat.C | 346 +++--- .../surfaceFormats/stl/STLsurfaceFormat.H | 85 +- .../stl/STLsurfaceFormatASCII.L | 4 +- .../surfaceFormats/stl/STLsurfaceFormatCore.C | 22 +- .../surfaceFormats/stl/STLsurfaceFormatCore.H | 7 +- .../stl/STLsurfaceFormatRunTime.C | 17 +- .../surfaceFormats/surfaceFormatsCore.C | 2 +- .../surfaceFormats/surfaceFormatsCore.H | 61 +- .../surfaceFormats/tri/TRIsurfaceFormat.C | 100 +- .../surfaceFormats/tri/TRIsurfaceFormat.H | 60 +- .../surfaceFormats/tri/TRIsurfaceFormatCore.H | 1 + .../tri/TRIsurfaceFormatRunTime.C | 11 +- .../surfaceFormats/vtk/VTKsurfaceFormat.C | 95 +- .../surfaceFormats/vtk/VTKsurfaceFormat.H | 51 +- .../surfaceFormats/vtk/VTKsurfaceFormatCore.C | 6 +- .../surfaceFormats/vtk/VTKsurfaceFormatCore.H | 1 - .../vtk/VTKsurfaceFormatRunTime.C | 9 +- 84 files changed, 3800 insertions(+), 3224 deletions(-) delete mode 100644 src/surfMesh/BasicMeshedSurface/BasicMeshedSurface.C delete mode 100644 src/surfMesh/BasicMeshedSurface/BasicMeshedSurface.H create mode 100644 src/surfMesh/MeshedSurface/MeshedSurfaceZones.C create mode 100644 src/surfMesh/MeshedSurfaceAllocator/MeshedSurfaceIOAllocator.C create mode 100644 src/surfMesh/MeshedSurfaceAllocator/MeshedSurfaceIOAllocator.H create mode 100644 src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.C create mode 100644 src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.H rename src/surfMesh/{surfaceFormats/off/OFFsurfaceFormatCore.H => MeshedSurfaceProxy/MeshedSurfaceProxyCore.C} (61%) delete mode 100644 src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurfaceIO.C rename src/surfMesh/surfFields/{ => surfFields}/surfFields.C (100%) rename src/surfMesh/surfFields/{ => surfFields}/surfFields.H (100%) rename src/surfMesh/surfFields/{ => surfFields}/surfFieldsFwd.H (100%) rename src/surfMesh/surfFields/{ => surfFields}/surfGeoMesh.H (100%) rename src/surfMesh/{ => surfFields}/surfPointFields/surfPointFields.C (100%) rename src/surfMesh/{ => surfFields}/surfPointFields/surfPointFields.H (100%) rename src/surfMesh/{ => surfFields}/surfPointFields/surfPointFieldsFwd.H (100%) rename src/surfMesh/{ => surfFields}/surfPointFields/surfPointGeoMesh.H (100%) delete mode 100644 src/surfMesh/surfaceFormats/off/OFFsurfaceFormatCore.C create mode 100644 src/surfMesh/surfaceFormats/ofs/OFSsurfaceFormat.C create mode 100644 src/surfMesh/surfaceFormats/ofs/OFSsurfaceFormat.H rename src/surfMesh/surfaceFormats/{obj/OBJsurfaceFormatCore.C => ofs/OFSsurfaceFormatCore.C} (63%) rename src/surfMesh/surfaceFormats/{obj/OBJsurfaceFormatCore.H => ofs/OFSsurfaceFormatCore.H} (86%) rename src/surfMesh/surfaceFormats/{smesh/SMESHsurfaceFormatCore.H => ofs/OFSsurfaceFormatRunTime.C} (54%) delete mode 100644 src/surfMesh/surfaceFormats/smesh/SMESHsurfaceFormatCore.C diff --git a/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C b/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C index ccd85d8e5a..daece06c1d 100644 --- a/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C +++ b/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C @@ -271,13 +271,40 @@ int main(int argc, char *argv[]) args.caseName() ); + // start with "constant" + runTime.setTime(instant(0, runTime.constant()), 0); + + Info<< "runTime.instance() = " << runTime.instance() << endl; + Info<< "runTime.timeName() = " << runTime.timeName() << endl; + + + surfMesh surfIn + ( + IOobject + ( + "default", + runTime.timeName(), + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ); + + + Info<< "surfIn = " << surfIn.nFaces() << endl; + + Info<< "runTime.instance() = " << runTime.instance() << endl; + surfMesh surfOut ( IOobject ( "mySurf", runTime.instance(), - runTime + runTime, + IOobject::NO_READ, + IOobject::NO_WRITE, + false ), surf.xfer() ); @@ -299,6 +326,25 @@ int main(int argc, char *argv[]) dimless ); + Info<<" surf name= " << surfOut.name() < + public MeshedSurface { //- Private typedefs for convenience - typedef BasicMeshedSurface MeshStorage; + typedef MeshedSurface MeshStorage; // Private data diff --git a/src/sampling/sampledSurface/sampledPatch/sampledPatch.H b/src/sampling/sampledSurface/sampledPatch/sampledPatch.H index fbc0b56ebe..2890a7bd34 100644 --- a/src/sampling/sampledSurface/sampledPatch/sampledPatch.H +++ b/src/sampling/sampledSurface/sampledPatch/sampledPatch.H @@ -50,11 +50,11 @@ namespace Foam class sampledPatch : - public BasicMeshedSurface, + public MeshedSurface, public sampledSurface { //- Private typedefs for convenience - typedef BasicMeshedSurface MeshStorage; + typedef MeshedSurface MeshStorage; // Private data diff --git a/src/surfMesh/BasicMeshedSurface/BasicMeshedSurface.C b/src/surfMesh/BasicMeshedSurface/BasicMeshedSurface.C deleted file mode 100644 index 41295b44b6..0000000000 --- a/src/surfMesh/BasicMeshedSurface/BasicMeshedSurface.C +++ /dev/null @@ -1,572 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 - -\*---------------------------------------------------------------------------*/ - -#include "BasicMeshedSurface.H" -#include "boundBox.H" -#include "mergePoints.H" - -// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // - -template -inline bool Foam::BasicMeshedSurface::isTri() -{ - return false; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -Foam::BasicMeshedSurface::BasicMeshedSurface() -: - ParentType(List(), pointField()) -{} - - -template -Foam::BasicMeshedSurface::BasicMeshedSurface -( - const Xfer< pointField >& pointLst, - const Xfer< List >& faceLst -) -: - ParentType(List(), pointField()) -{ - reset(pointLst, faceLst); -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::BasicMeshedSurface::~BasicMeshedSurface() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -void Foam::BasicMeshedSurface::clear() -{ - ParentType::clearOut(); - - storedPoints().clear(); - storedFaces().clear(); -} - - -template -void Foam::BasicMeshedSurface::movePoints(const pointField& newPoints) -{ - // Remove all geometry dependent data - ParentType::clearTopology(); - - // Adapt for new point position - ParentType::movePoints(newPoints); - - // Copy new points - storedPoints() = newPoints; -} - - -template -void Foam::BasicMeshedSurface::scalePoints(const scalar& scaleFactor) -{ - // avoid bad scaling - if (scaleFactor > 0 && scaleFactor != 1.0) - { - // Remove all geometry dependent data - ParentType::clearTopology(); - - // Adapt for new point position - ParentType::movePoints(pointField()); - - storedPoints() *= scaleFactor; - } -} - - -template -void Foam::BasicMeshedSurface::reset -( - const Xfer< pointField >& pointLst, - const Xfer< List >& faceLst -) -{ - ParentType::clearOut(); - - // Take over new primitive data. - // Optimized to avoid overwriting data at all - if (&pointLst) - { - storedPoints().transfer(pointLst()); - } - - if (&faceLst) - { - storedFaces().transfer(faceLst()); - } -} - - -template -void Foam::BasicMeshedSurface::reset -( - const Xfer< List >& pointLst, - const Xfer< List >& faceLst -) -{ - ParentType::clearOut(); - - // Take over new primitive data. - // Optimized to avoid overwriting data at all - if (&pointLst) - { - storedPoints().transfer(pointLst()); - } - - if (&faceLst) - { - storedFaces().transfer(faceLst()); - } -} - - -// Remove badly degenerate faces, double faces. -template -void Foam::BasicMeshedSurface::cleanup(const bool verbose) -{ - // merge points (already done for STL, TRI) - stitchFaces(SMALL, verbose); - - checkFaces(verbose); - this->checkTopology(verbose); -} - - -template -bool Foam::BasicMeshedSurface::stitchFaces -( - const scalar tol, - const bool verbose -) -{ - pointField& pointLst = this->storedPoints(); - - // Merge points - labelList pointMap(pointLst.size()); - pointField newPoints(pointLst.size()); - - bool hasMerged = mergePoints(pointLst, tol, verbose, pointMap, newPoints); - - if (!hasMerged) - { - return false; - } - - if (verbose) - { - Info<< "BasicMeshedSurface::stitchFaces : Renumbering all faces" - << endl; - } - - // Set the coordinates to the merged ones - pointLst.transfer(newPoints); - - List& faceLst = this->storedFaces(); - - List