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
This commit is contained in:
parent
9ce984d1dc
commit
b968e62ef9
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -88,7 +88,7 @@ tmp<IOField<Type> > lagrangianFieldDecomposer::decomposeField
|
||||
(
|
||||
field.name(),
|
||||
procMesh_.time().timeName(),
|
||||
"lagrangian"/cloudName,
|
||||
cloud::subInstance/cloudName,
|
||||
procMesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
|
@ -36,6 +36,7 @@ SourceFiles
|
||||
#ifndef reconstructLagrangian_H
|
||||
#define reconstructLagrangian_H
|
||||
|
||||
#include "cloud.H"
|
||||
#include "polyMesh.H"
|
||||
#include "IOobjectList.H"
|
||||
#include "fvMesh.H"
|
||||
|
@ -47,7 +47,7 @@ Foam::tmp<Foam::IOField<Type> > 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::IOField<Type> > 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
|
||||
|
@ -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");
|
||||
|
@ -35,6 +35,7 @@ SourceFiles
|
||||
#ifndef ensightCloudField_H
|
||||
#define ensightCloudField_H
|
||||
|
||||
#include "Cloud.H"
|
||||
#include "IOobject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
@ -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
|
||||
);
|
||||
|
@ -42,7 +42,7 @@ forAllConstIter(HashTable<HashTable<word> >, 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<HashTable<word> >, cloudFields, cloudIter)
|
||||
ensightType,
|
||||
fieldName,
|
||||
dataMask,
|
||||
"lagrangian"/cloudName,
|
||||
cloud::subInstance/cloudName,
|
||||
cloudNo,
|
||||
2
|
||||
);
|
||||
|
@ -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<passiveParticle> 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 =
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ List<IOField<vector>* > sprayVectorFieldPtrs
|
||||
(
|
||||
sprayScalarNames[fieldI],
|
||||
runTime.timeName(),
|
||||
"lagrangian",
|
||||
cloud::subInstance,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
@ -53,7 +53,7 @@ List<IOField<vector>* > sprayVectorFieldPtrs
|
||||
(
|
||||
sprayVectorNames[fieldI],
|
||||
runTime.timeName(),
|
||||
"lagrangian",
|
||||
cloud::subInstance,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
|
@ -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)
|
||||
|
@ -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"
|
||||
|
@ -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<passiveParticle> 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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -40,7 +40,7 @@ forAll(lagrangianScalarNames, i)
|
||||
(
|
||||
name,
|
||||
runTime.timeName(),
|
||||
"lagrangian",
|
||||
cloud::subInstance,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
|
@ -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"
|
||||
);
|
||||
|
||||
|
@ -39,6 +39,7 @@ SourceFiles
|
||||
|
||||
#include "globalPointPatch.H"
|
||||
#include "OFstream.H"
|
||||
#include "Cloud.H"
|
||||
#include "volFields.H"
|
||||
#include "pointFields.H"
|
||||
#include "vtkMesh.H"
|
||||
|
@ -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,
|
||||
|
@ -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"
|
||||
|
@ -268,7 +268,7 @@ void Foam::vtkPV3Foam::convertLagrangianFields
|
||||
(
|
||||
mesh,
|
||||
dbPtr_().timeName(),
|
||||
"lagrangian"/cloudName
|
||||
cloud::subInstance/cloudName
|
||||
);
|
||||
pruneObjectList(objects, selectedFields);
|
||||
|
||||
|
@ -30,6 +30,8 @@ InClass
|
||||
#ifndef vtkPV3FoamLagrangianFields_H
|
||||
#define vtkPV3FoamLagrangianFields_H
|
||||
|
||||
#include "Cloud.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
|
@ -53,7 +53,7 @@ vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh
|
||||
if (debug)
|
||||
{
|
||||
Info<< "<beg> 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");
|
||||
|
@ -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<< "<beg> 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
|
||||
|
@ -35,7 +35,7 @@ int USERD_get_gold_part_build_info
|
||||
for(label i=0; i<nPatches; i++)
|
||||
{
|
||||
word patchName(meshPtr->boundary()[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; i++)
|
||||
@ -137,7 +137,12 @@ int USERD_get_gold_part_build_info
|
||||
|
||||
if (Numparts_available > 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();
|
||||
}
|
||||
|
@ -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<passiveParticle>(*meshPtr);
|
||||
|
||||
IOobjectList objects(*meshPtr, runTime.timeName(), "lagrangian");
|
||||
IOobjectList objects(*meshPtr, runTime.timeName(), cloud::subInstance);
|
||||
|
||||
lagrangianScalarNames =
|
||||
(const wordList&)objects.names(sprayScalarFieldName);
|
||||
|
@ -12,7 +12,7 @@ if (nVar >= 0)
|
||||
(
|
||||
name,
|
||||
runTime.timeName(),
|
||||
"lagrangian",
|
||||
cloud::subInstance,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
|
@ -14,7 +14,7 @@ if (nVar >= 0)
|
||||
(
|
||||
name,
|
||||
runTime.timeName(),
|
||||
"lagrangian",
|
||||
cloud::subInstance,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
|
@ -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";
|
||||
|
@ -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<Type> 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,
|
||||
|
@ -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");
|
||||
|
@ -45,7 +45,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
//- Read a hex label from an input stream
|
||||
label readHexLabel(ISstream& is);
|
||||
label readHexLabel(ISstream&);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -154,6 +154,9 @@ public:
|
||||
|
||||
// Edit
|
||||
|
||||
//- Rename
|
||||
virtual void rename(const word& newName);
|
||||
|
||||
//- Add an regIOobject to registry
|
||||
bool checkIn(regIOobject&) const;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -144,6 +144,9 @@ public:
|
||||
template<class String>
|
||||
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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user