Commit e4240592 authored by mattijs's avatar mattijs
Browse files

ENH: glboal file handling: initial commit

Moved file path handling to regIOobject and made it type specific so
now every object can have its own rules. Examples:
- faceZones are now processor local (and don't search up anymore)
- timeStampMaster is now no longer hardcoded inside IOdictionary
  (e.g. uniformDimensionedFields support it as well)
- the distributedTriSurfaceMesh is properly processor-local; no need
  for fileModificationChecking manipulation.
parent 9fd840c1
......@@ -9,7 +9,7 @@
surfaceScalarField* phiBPtr;
if (phiBHeader.headerOk())
if (phiBHeader.typeHeaderOk<surfaceScalarField>(true))
{
Info<< "Reading field phiB\n" << endl;
......
......@@ -76,7 +76,7 @@
IOobject::AUTO_WRITE
);
if (betavSolidIO.headerOk())
if (betavSolidIO.typeHeaderOk<volScalarField>(true))
{
betavSolid.set
(
......
......@@ -25,7 +25,7 @@
IOobject::MUST_READ
);
if (turbulenceHeader.headerOk())
if (turbulenceHeader.typeHeaderOk<IOdictionary>(true))
{
autoPtr<compressible::turbulenceModel> turbulence
(
......@@ -40,7 +40,7 @@
talphaEff = turbulence->alphaEff();
}
else if (RASHeader.headerOk())
else if (RASHeader.typeHeaderOk<IOdictionary>(true))
{
autoPtr<compressible::RASModel> turbulence
(
......@@ -55,7 +55,7 @@
talphaEff = turbulence->alphaEff();
}
else if (LESHeader.headerOk())
else if (LESHeader.typeHeaderOk<IOdictionary>(true))
{
autoPtr<compressible::LESModel> turbulence
(
......
......@@ -79,7 +79,7 @@
autoPtr<volVectorField> HPtr;
if (Hheader.headerOk())
if (Hheader.typeHeaderOk<volVectorField>(true))
{
Info<< "\nReading field H\n" << endl;
......@@ -97,7 +97,7 @@
autoPtr<volVectorField> HdotGradHPtr;
if (HdotGradHheader.headerOk())
if (HdotGradHheader.typeHeaderOk<volVectorField>(true))
{
Info<< "Reading field HdotGradH" << endl;
......
......@@ -11,7 +11,13 @@
autoPtr<uniformDimensionedVectorField> linearAccelerationPtr;
if (linearAccelerationHeader.headerOk())
if
(
linearAccelerationHeader.typeHeaderOk<uniformDimensionedVectorField>
(
true
)
)
{
Info<< " Reading " << linearAccelerationHeader.name() << endl;
......@@ -33,7 +39,7 @@
autoPtr<uniformDimensionedVectorField> angularVelocityPtr;
if (angularVelocityHeader.headerOk())
if (angularVelocityHeader.typeHeaderOk<uniformDimensionedVectorField>(true))
{
Info<< " Reading " << angularVelocityHeader.name() << endl;
......@@ -55,7 +61,13 @@
autoPtr<uniformDimensionedVectorField> angularAccelerationPtr;
if (angularAccelerationHeader.headerOk())
if
(
angularAccelerationHeader.typeHeaderOk<uniformDimensionedVectorField>
(
true
)
)
{
Info<< " Reading " << angularAccelerationHeader.name() << endl;
......@@ -77,7 +89,13 @@
autoPtr<uniformDimensionedVectorField> centreOfRotationPtr;
if (centreOfRotationHeader.headerOk())
if
(
centreOfRotationHeader.typeHeaderOk<uniformDimensionedVectorField>
(
true
)
)
{
Info<< " Reading " << centreOfRotationHeader.name() << endl;
......
......@@ -122,7 +122,7 @@ Foam::phaseModel::phaseModel
IOobject::NO_READ
);
if (phiHeader.headerOk())
if (phiHeader.typeHeaderOk<surfaceScalarField>(true))
{
Info<< "Reading face flux field " << phiName << endl;
......
......@@ -54,7 +54,7 @@ Foam::MovingPhaseModel<BasePhaseModel>::phi(const volVectorField& U) const
IOobject::NO_READ
);
if (phiHeader.headerOk())
if (phiHeader.typeHeaderOk<surfaceScalarField>(true))
{
Info<< "Reading face flux field " << phiName << endl;
......
......@@ -120,7 +120,7 @@ Foam::phaseModel::phaseModel
IOobject::NO_READ
);
if (phiHeader.headerOk())
if (phiHeader.typeHeaderOk<surfaceScalarField>(true))
{
Info<< "Reading face flux field " << phiName << endl;
......
......@@ -34,7 +34,8 @@ Description
NOTE: To avoid exposing wrong fields values faceSets should include
faces contained in the blockedCells cellset.
- coupledFaces reads coupledFacesSet to introduces mixe-coupled baffles
- coupledFaces reads coupledFacesSet to introduces mixed-coupled
duplicate baffles
Subsets out the blocked cells and splits the blockedFaces and updates
fields.
......@@ -1173,7 +1174,7 @@ int main(int argc, char *argv[])
}
}
Info << nl << "End" << endl;
Info<< "\nEnd\n" << endl;
return 0;
}
......
......@@ -17,7 +17,8 @@ FoamFile
//- Per faceSet the patch the faces should go into blocked baffles
blockedFaces ((blockedFacesSet blockedFaces));
//- Per faceSet the patch the faces should go into coupled baffles
//- Per faceSet the duplicate baffles to generate (one 'normal', wall baffle,
// one cyclic baffle). For use with active baffle boundary conditions.
coupledFaces
{
coupledFacesSet
......
......@@ -650,7 +650,7 @@ int main(int argc, char *argv[])
// corrector for mesh motion
twoDPointCorrector* correct2DPtr = NULL;
if (motionObj.headerOk())
if (motionObj.typeHeaderOk<IOdictionary>(true))
{
Info<< "Reading " << runTime.constant() / "motionProperties"
<< endl << endl;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -238,7 +238,7 @@ int main(int argc, char *argv[])
runTime
);
if (!readLevel && refHeader.headerOk())
if (!readLevel && refHeader.typeHeaderOk<labelIOList>(true))
{
WarningIn(args.executable())
<< "Detected " << refHeader.name() << " file in "
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -82,7 +82,7 @@ Foam::edgeStats::edgeStats(const polyMesh& mesh)
IOobject::NO_WRITE
);
if (motionObj.headerOk())
if (motionObj.typeHeaderOk<IOdictionary>(true))
{
Info<< "Reading " << mesh.time().constant() / "motionProperties"
<< endl << endl;
......
......@@ -19,7 +19,7 @@
false
);
if (io.headerOk())
if (io.typeHeaderOk<IOdictionary>(true))
{
IOdictionary timeObject
(
......
......@@ -19,7 +19,7 @@
false
);
if (io.headerOk())
if (io.typeHeaderOk<IOdictionary>(true))
{
IOdictionary timeObject
(
......
......@@ -37,6 +37,11 @@ Foam::label Foam::starMesh::readVtxLabel(IFstream& is)
for (int i=0; i<15; i++)
{
if (!is.good())
{
return -1;
}
is.get(lcs[i]);
}
......@@ -85,12 +90,10 @@ void Foam::starMesh::readPoints(const scalar scaleFactor)
if (pointsFile.good())
{
label pointLabel;
maxLabel = -1;
while (pointsFile)
{
pointLabel = readVtxLabel(pointsFile);
label pointLabel = readVtxLabel(pointsFile);
if (!pointsFile) break;
......
......@@ -144,7 +144,7 @@ int main(int argc, char *argv[])
false
);
if (!meshDictIO.headerOk())
if (!meshDictIO.typeHeaderOk<IOdictionary>(true))
{
FatalErrorIn(args.executable())
<< "Cannot open mesh description file\n "
......
......@@ -96,7 +96,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
Info<< "Testing:" << io.objectPath() << endl;
if (!io.headerOk())
if (!io.typeHeaderOk<IOdictionary>(false))
{
Info<< "Writing dummy " << regionName/io.name() << endl;
dictionary dummyDict;
......@@ -122,7 +122,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
false
);
if (!io.headerOk())
if (!io.typeHeaderOk<IOdictionary>(false))
{
Info<< "Writing dummy " << regionName/io.name() << endl;
dictionary dummyDict;
......
......@@ -372,7 +372,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
Info<< "Testing:" << io.objectPath() << endl;
if (!io.headerOk())
if (!io.typeHeaderOk<IOdictionary>(true))
{
Info<< "Writing dummy " << regionName/io.name() << endl;
dictionary dummyDict;
......@@ -398,7 +398,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
false
);
if (!io.headerOk())
if (!io.typeHeaderOk<IOdictionary>(true))
{
Info<< "Writing dummy " << regionName/io.name() << endl;
dictionary dummyDict;
......@@ -2673,7 +2673,7 @@ int main(int argc, char *argv[])
mesh,
IOobject::MUST_READ
);
if (io.headerOk())
if (io.typeHeaderOk<pointIOField>(true))
{
// Read patchFaceCentres and patchEdgeCentres
Info<< "Reading patch face,edge centres : "
......
......@@ -70,7 +70,7 @@ Foam::DelaunayMesh<Triangulation>::DelaunayMesh
)
);
if (pts.headerOk())
if (pts.typeHeaderOk<pointIOField>(true))
{
labelIOField types
(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment