Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop

This commit is contained in:
Andrew Heather
2016-04-25 11:25:04 +01:00
218 changed files with 3687 additions and 1453 deletions

View File

@ -15,8 +15,8 @@ OpenCFD Limited, owner of the OpenFOAM Trademark, has granted the use of the Tra
# Useful Links # Useful Links
- [Download and installation instructions](http://www.openfoam.com/releases) - [Download and installation instructions](http://www.openfoam.com/releases)
- [Documentation](http://www.openfoam.com/documentation) - [Documentation](http://www.openfoam.com/documentation)
- [Reporting bugs/issues (including bugs/suggestions/feature requests) in OpenFOAM+](http://www.openfoam.com/???) - [Reporting bugs/issues (including bugs/suggestions/feature requests) in OpenFOAM+](http://www.openfoam.com/code/bug-reporting.php)
- [Collaborative and Community-based Developments](http://www.openfoam.com/development/community-projects.php) - [Collaborative and Community-based Developments](http://www.openfoam.com/services/community-projects.php)
- [Contacting OpenCFD](http://www.openfoam.com/contact) - [Contacting OpenCFD](http://www.openfoam.com/contact)
Copyright 2016 OpenCFD Ltd Copyright 2016 OpenCFD Ltd

View File

@ -9,7 +9,7 @@
surfaceScalarField* phiBPtr; surfaceScalarField* phiBPtr;
if (phiBHeader.headerOk()) if (phiBHeader.typeHeaderOk<surfaceScalarField>(true))
{ {
Info<< "Reading field phiB\n" << endl; Info<< "Reading field phiB\n" << endl;

View File

@ -76,7 +76,7 @@
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
); );
if (betavSolidIO.headerOk()) if (betavSolidIO.typeHeaderOk<volScalarField>(true))
{ {
betavSolid.set betavSolid.set
( (

View File

@ -25,7 +25,7 @@
IOobject::MUST_READ IOobject::MUST_READ
); );
if (turbulenceHeader.headerOk()) if (turbulenceHeader.typeHeaderOk<IOdictionary>(true))
{ {
autoPtr<compressible::turbulenceModel> turbulence autoPtr<compressible::turbulenceModel> turbulence
( (
@ -40,7 +40,7 @@
talphaEff = turbulence->alphaEff(); talphaEff = turbulence->alphaEff();
} }
else if (RASHeader.headerOk()) else if (RASHeader.typeHeaderOk<IOdictionary>(true))
{ {
autoPtr<compressible::RASModel> turbulence autoPtr<compressible::RASModel> turbulence
( (
@ -55,7 +55,7 @@
talphaEff = turbulence->alphaEff(); talphaEff = turbulence->alphaEff();
} }
else if (LESHeader.headerOk()) else if (LESHeader.typeHeaderOk<IOdictionary>(true))
{ {
autoPtr<compressible::LESModel> turbulence autoPtr<compressible::LESModel> turbulence
( (

View File

@ -79,7 +79,7 @@
autoPtr<volVectorField> HPtr; autoPtr<volVectorField> HPtr;
if (Hheader.headerOk()) if (Hheader.typeHeaderOk<volVectorField>(true))
{ {
Info<< "\nReading field H\n" << endl; Info<< "\nReading field H\n" << endl;
@ -97,7 +97,7 @@
autoPtr<volVectorField> HdotGradHPtr; autoPtr<volVectorField> HdotGradHPtr;
if (HdotGradHheader.headerOk()) if (HdotGradHheader.typeHeaderOk<volVectorField>(true))
{ {
Info<< "Reading field HdotGradH" << endl; Info<< "Reading field HdotGradH" << endl;

View File

@ -11,7 +11,13 @@
autoPtr<uniformDimensionedVectorField> linearAccelerationPtr; autoPtr<uniformDimensionedVectorField> linearAccelerationPtr;
if (linearAccelerationHeader.headerOk()) if
(
linearAccelerationHeader.typeHeaderOk<uniformDimensionedVectorField>
(
true
)
)
{ {
Info<< " Reading " << linearAccelerationHeader.name() << endl; Info<< " Reading " << linearAccelerationHeader.name() << endl;
@ -33,7 +39,7 @@
autoPtr<uniformDimensionedVectorField> angularVelocityPtr; autoPtr<uniformDimensionedVectorField> angularVelocityPtr;
if (angularVelocityHeader.headerOk()) if (angularVelocityHeader.typeHeaderOk<uniformDimensionedVectorField>(true))
{ {
Info<< " Reading " << angularVelocityHeader.name() << endl; Info<< " Reading " << angularVelocityHeader.name() << endl;
@ -55,7 +61,13 @@
autoPtr<uniformDimensionedVectorField> angularAccelerationPtr; autoPtr<uniformDimensionedVectorField> angularAccelerationPtr;
if (angularAccelerationHeader.headerOk()) if
(
angularAccelerationHeader.typeHeaderOk<uniformDimensionedVectorField>
(
true
)
)
{ {
Info<< " Reading " << angularAccelerationHeader.name() << endl; Info<< " Reading " << angularAccelerationHeader.name() << endl;
@ -77,7 +89,13 @@
autoPtr<uniformDimensionedVectorField> centreOfRotationPtr; autoPtr<uniformDimensionedVectorField> centreOfRotationPtr;
if (centreOfRotationHeader.headerOk()) if
(
centreOfRotationHeader.typeHeaderOk<uniformDimensionedVectorField>
(
true
)
)
{ {
Info<< " Reading " << centreOfRotationHeader.name() << endl; Info<< " Reading " << centreOfRotationHeader.name() << endl;

View File

@ -122,7 +122,7 @@ Foam::phaseModel::phaseModel
IOobject::NO_READ IOobject::NO_READ
); );
if (phiHeader.headerOk()) if (phiHeader.typeHeaderOk<surfaceScalarField>(true))
{ {
Info<< "Reading face flux field " << phiName << endl; Info<< "Reading face flux field " << phiName << endl;

View File

@ -54,7 +54,7 @@ Foam::MovingPhaseModel<BasePhaseModel>::phi(const volVectorField& U) const
IOobject::NO_READ IOobject::NO_READ
); );
if (phiHeader.headerOk()) if (phiHeader.typeHeaderOk<surfaceScalarField>(true))
{ {
Info<< "Reading face flux field " << phiName << endl; Info<< "Reading face flux field " << phiName << endl;

View File

@ -10,3 +10,6 @@ EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude -I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = \
-lcompressibleTurbulenceModels

View File

@ -11,3 +11,9 @@ EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude -I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = \
-lcompressibleTurbulenceModels \
-lreactingTwoPhaseSystem \
-lreactingEulerianInterfacialModels \
-lreactingEulerianInterfacialCompositionModels

View File

@ -120,7 +120,7 @@ Foam::phaseModel::phaseModel
IOobject::NO_READ IOobject::NO_READ
); );
if (phiHeader.headerOk()) if (phiHeader.typeHeaderOk<surfaceScalarField>(true))
{ {
Info<< "Reading face flux field " << phiName << endl; Info<< "Reading face flux field " << phiName << endl;

View File

@ -1174,7 +1174,7 @@ int main(int argc, char *argv[])
} }
} }
Info << nl << "End" << endl; Info<< "\nEnd\n" << endl;
return 0; return 0;
} }

View File

@ -650,7 +650,7 @@ int main(int argc, char *argv[])
// corrector for mesh motion // corrector for mesh motion
twoDPointCorrector* correct2DPtr = NULL; twoDPointCorrector* correct2DPtr = NULL;
if (motionObj.headerOk()) if (motionObj.typeHeaderOk<IOdictionary>(true))
{ {
Info<< "Reading " << runTime.constant() / "motionProperties" Info<< "Reading " << runTime.constant() / "motionProperties"
<< endl << endl; << endl << endl;

View File

@ -238,7 +238,7 @@ int main(int argc, char *argv[])
runTime runTime
); );
if (!readLevel && refHeader.headerOk()) if (!readLevel && refHeader.typeHeaderOk<labelIOList>(true))
{ {
WarningInFunction WarningInFunction
<< "Detected " << refHeader.name() << " file in " << "Detected " << refHeader.name() << " file in "

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -82,7 +82,7 @@ Foam::edgeStats::edgeStats(const polyMesh& mesh)
IOobject::NO_WRITE IOobject::NO_WRITE
); );
if (motionObj.headerOk()) if (motionObj.typeHeaderOk<IOdictionary>(true))
{ {
Info<< "Reading " << mesh.time().constant() / "motionProperties" Info<< "Reading " << mesh.time().constant() / "motionProperties"
<< endl << endl; << endl << endl;

View File

@ -19,7 +19,7 @@
false false
); );
if (io.headerOk()) if (io.typeHeaderOk<IOdictionary>(true))
{ {
IOdictionary timeObject IOdictionary timeObject
( (

View File

@ -19,7 +19,7 @@
false false
); );
if (io.headerOk()) if (io.typeHeaderOk<IOdictionary>(true))
{ {
IOdictionary timeObject IOdictionary timeObject
( (

View File

@ -144,7 +144,7 @@ int main(int argc, char *argv[])
false false
); );
if (!meshDictIO.headerOk()) if (!meshDictIO.typeHeaderOk<IOdictionary>(true))
{ {
FatalErrorInFunction FatalErrorInFunction
<< meshDictIO.objectPath() << meshDictIO.objectPath()

View File

@ -96,7 +96,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
Info<< "Testing:" << io.objectPath() << endl; Info<< "Testing:" << io.objectPath() << endl;
if (!io.headerOk()) if (!io.typeHeaderOk<IOdictionary>(false))
{ {
Info<< "Writing dummy " << regionName/io.name() << endl; Info<< "Writing dummy " << regionName/io.name() << endl;
dictionary dummyDict; dictionary dummyDict;
@ -122,7 +122,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
false false
); );
if (!io.headerOk()) if (!io.typeHeaderOk<IOdictionary>(false))
{ {
Info<< "Writing dummy " << regionName/io.name() << endl; Info<< "Writing dummy " << regionName/io.name() << endl;
dictionary dummyDict; dictionary dummyDict;

View File

@ -366,7 +366,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
Info<< "Testing:" << io.objectPath() << endl; Info<< "Testing:" << io.objectPath() << endl;
if (!io.headerOk()) if (!io.typeHeaderOk<IOdictionary>(true))
{ {
Info<< "Writing dummy " << regionName/io.name() << endl; Info<< "Writing dummy " << regionName/io.name() << endl;
dictionary dummyDict; dictionary dummyDict;
@ -392,7 +392,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
false false
); );
if (!io.headerOk()) if (!io.typeHeaderOk<IOdictionary>(true))
{ {
Info<< "Writing dummy " << regionName/io.name() << endl; Info<< "Writing dummy " << regionName/io.name() << endl;
dictionary dummyDict; dictionary dummyDict;
@ -2655,7 +2655,7 @@ int main(int argc, char *argv[])
mesh, mesh,
IOobject::MUST_READ IOobject::MUST_READ
); );
if (io.headerOk()) if (io.typeHeaderOk<pointIOField>(true))
{ {
// Read patchFaceCentres and patchEdgeCentres // Read patchFaceCentres and patchEdgeCentres
Info<< "Reading patch face,edge centres : " Info<< "Reading patch face,edge centres : "

View File

@ -70,7 +70,7 @@ Foam::DelaunayMesh<Triangulation>::DelaunayMesh
) )
); );
if (pts.headerOk()) if (pts.typeHeaderOk<pointIOField>(true))
{ {
labelIOField types labelIOField types
( (

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -394,7 +394,7 @@ Foam::cellShapeControlMesh::cellShapeControlMesh(const Time& runTime)
false false
); );
if (io.headerOk()) if (io.typeHeaderOk<pointScalarField>(true))
{ {
pointScalarField sizes(io, pointMesh::New(mesh)); pointScalarField sizes(io, pointMesh::New(mesh));

View File

@ -75,43 +75,65 @@ pointFile::pointFile
List<Vb::Point> pointFile::initialPoints() const List<Vb::Point> pointFile::initialPoints() const
{ {
pointIOField points pointField points;
( {
IOobject // Look for points
IOobject pointsIO
( (
pointFileName_.name(), pointFileName_.name(),
time().timeName(), time().timeName(),
time(), time(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
) );
);
Info<< " Inserting points from file " << pointFileName_ << endl; Info<< " Inserting points from file " << pointFileName_ << endl;
if (points.empty()) // See if processor local file
{ if (pointsIO.typeHeaderOk<pointIOField>(true))
FatalErrorInFunction
<< "Point file contain no points"
<< exit(FatalError) << endl;
}
if (Pstream::parRun())
{
// Testing filePath to see if the file originated in a processor
// directory, if so, assume that the points in each processor file
// are unique. They are unlikely to belong on the current
// processor as the background mesh is unlikely to be the same.
const bool isParentFile = (points.objectPath() != points.filePath());
if (!isParentFile)
{ {
decomposition().distributePoints(points); // Found it (processor local)
points = pointIOField(pointsIO);
if (points.empty())
{
FatalErrorIn("List<Vb::Point> pointFile::initialPoints() const")
<< "Point file contain no points"
<< exit(FatalError) << endl;
}
if (Pstream::parRun())
{
// assume that the points in each processor file
// are unique. They are unlikely to belong on the current
// processor as the background mesh is unlikely to be the same.
decomposition().distributePoints(points);
}
} }
else else if (Pstream::parRun())
{ {
// Otherwise, this is assumed to be points covering the whole // See if points can be found in parent directory
// (only if timeName = constant)
points = pointIOField
(
IOobject
(
pointFileName_.name(),
time().caseConstant(),
time(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
if (points.empty())
{
FatalErrorIn("List<Vb::Point> pointFile::initialPoints() const")
<< "Point file contain no points"
<< exit(FatalError) << endl;
}
// Points are assumed to be covering the whole
// domain, so filter the points to be only those on this processor // domain, so filter the points to be only those on this processor
boolList procPt(decomposition().positionOnThisProcessor(points)); boolList procPt(decomposition().positionOnThisProcessor(points));
@ -146,6 +168,12 @@ List<Vb::Point> pointFile::initialPoints() const
inplaceSubset(procPt, points); inplaceSubset(procPt, points);
} }
else
{
FatalErrorIn("List<Vb::Point> pointFile::initialPoints() const")
<< "Cannot find points file " << pointsIO.objectPath()
<< exit(FatalError) << endl;
}
} }
Field<bool> insidePoints(points.size(), true); Field<bool> insidePoints(points.size(), true);

View File

@ -25,6 +25,14 @@ addLayers false;
// surface "_ "region. Default is true // surface "_ "region. Default is true
//singleRegionName false; //singleRegionName false;
// Optional: avoid patch-face merging. Allows mesh to be used for
// refinement/unrefinement
//mergePatchFaces false; // default true
// Optional: keep zero-sized patches. By default snappyHexMesh filters
// these out.
//keepPatches true; // default false
// Geometry. Definition of all surfaces. All surfaces are of class // Geometry. Definition of all surfaces. All surfaces are of class
// searchableSurface. // searchableSurface.
@ -72,10 +80,6 @@ geometry
}; };
// Optional: avoid patch-face merging. Allows mesh to be used for
// refinement/unrefinement
//mergePatchFaces off; // default on
// Settings for the castellatedMesh generation. // Settings for the castellatedMesh generation.
castellatedMeshControls castellatedMeshControls
{ {

View File

@ -74,7 +74,7 @@ int main(int argc, char *argv[])
); );
// Check U exists // Check U exists
if (Uheader.headerOk()) if (Uheader.typeHeaderOk<volVectorField>(true))
{ {
Info<< " Reading U" << endl; Info<< " Reading U" << endl;
volVectorField U(Uheader, mesh); volVectorField U(Uheader, mesh);

View File

@ -187,7 +187,7 @@ int main(int argc, char *argv[])
IOobject::MUST_READ IOobject::MUST_READ
); );
if (!dictIO.headerOk()) if (!dictIO.typeHeaderOk<IOdictionary>(true))
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Cannot open specified refinement dictionary " << "Cannot open specified refinement dictionary "
@ -209,7 +209,7 @@ int main(int argc, char *argv[])
IOobject::MUST_READ IOobject::MUST_READ
); );
if (dictIO.headerOk()) if (dictIO.typeHeaderOk<IOdictionary>(true))
{ {
Info<< "Refining according to " << dictName << nl << endl; Info<< "Refining according to " << dictName << nl << endl;

View File

@ -599,7 +599,7 @@ autoPtr<mapPolyMesh> createRegionMesh
Info<< "Testing:" << io.objectPath() << endl; Info<< "Testing:" << io.objectPath() << endl;
if (!io.headerOk()) if (!io.typeHeaderOk<IOdictionary>(true))
// if (!exists(io.objectPath())) // if (!exists(io.objectPath()))
{ {
Info<< "Writing dummy " << regionName/io.name() << endl; Info<< "Writing dummy " << regionName/io.name() << endl;
@ -626,7 +626,7 @@ autoPtr<mapPolyMesh> createRegionMesh
false false
); );
if (!io.headerOk()) if (!io.typeHeaderOk<IOdictionary>(true))
//if (!exists(io.objectPath())) //if (!exists(io.objectPath()))
{ {
Info<< "Writing dummy " << regionName/io.name() << endl; Info<< "Writing dummy " << regionName/io.name() << endl;

View File

@ -89,7 +89,7 @@ bool writeZones(const word& name, const fileName& meshDir, Time& runTime)
bool writeOk = false; bool writeOk = false;
if (io.headerOk()) if (io.typeHeaderOk<cellZoneMesh>(false))
{ {
Info<< " Reading " << io.headerClassName() Info<< " Reading " << io.headerClassName()
<< " : " << name << endl; << " : " << name << endl;

View File

@ -61,7 +61,7 @@ inline bool writeMeshObject
bool writeOk = false; bool writeOk = false;
if (io.headerOk()) if (io.typeHeaderOk<T>(false))
{ {
Info<< " Reading " << io.headerClassName() Info<< " Reading " << io.headerClassName()
<< " : " << name << endl; << " : " << name << endl;

View File

@ -122,7 +122,7 @@ void Foam::helpTypes::helpBoundary::execute
); );
// Check for any type of volField // Check for any type of volField
if (fieldHeader.headerOk()) if (fieldHeader.typeHeaderOk<volScalarField>(false))
{ {
if (args.optionFound("fixedValue")) if (args.optionFound("fixedValue"))
{ {

View File

@ -106,7 +106,7 @@ int main(int argc, char *argv[])
IOobject::MUST_READ IOobject::MUST_READ
); );
if (obj.headerOk()) if (obj.typeHeaderOk<volScalarField>(false))
{ {
addToFieldList(vsf, obj, objI, mesh); addToFieldList(vsf, obj, objI, mesh);
addToFieldList(vvf, obj, objI, mesh); addToFieldList(vvf, obj, objI, mesh);

View File

@ -293,27 +293,9 @@ Foam::parLagrangianRedistributor::redistributeLagrangianPositions
const word& cloudName const word& cloudName
) const ) const
{ {
(void)srcMesh_.tetBasePtIs();
(void)tgtMesh_.tetBasePtIs();
// Temporarily: override master-only checking
regIOobject::fileCheckTypes oldCheckType =
regIOobject::fileModificationChecking;
if (oldCheckType == regIOobject::timeStampMaster)
{
regIOobject::fileModificationChecking = regIOobject::timeStamp;
}
else if (oldCheckType == regIOobject::inotifyMaster)
{
regIOobject::fileModificationChecking = regIOobject::inotify;
}
// Load cloud and send particle // Load cloud and send particle
passiveParticleCloud lpi(srcMesh_, cloudName, false); passiveParticleCloud lpi(srcMesh_, cloudName, false);
regIOobject::fileModificationChecking = oldCheckType;
return redistributeLagrangianPositions(lpi); return redistributeLagrangianPositions(lpi);
} }

View File

@ -1436,7 +1436,7 @@ void readProcAddressing
// mesh, // mesh,
// IOobject::MUST_READ // IOobject::MUST_READ
//); //);
//if (io.headerOk()) //if (io.typeHeaderOk<labelIOList>(true))
//{ //{
// Pout<< "Reading addressing from " << io.name() << " at " // Pout<< "Reading addressing from " << io.name() << " at "
// << mesh.facesInstance() << nl << endl; // << mesh.facesInstance() << nl << endl;
@ -1786,28 +1786,12 @@ void readLagrangian
forAll(cloudNames, i) forAll(cloudNames, i)
{ {
{ //Pout<< "Loading cloud " << cloudNames[i] << endl;
// Note: disable master-only reading of uniform/cloudProperties clouds.set
regIOobject::fileCheckTypes oldCheckType = (
regIOobject::fileModificationChecking; i,
new unmappedPassiveParticleCloud(mesh, cloudNames[i], false)
if (oldCheckType == regIOobject::timeStampMaster) );
{
regIOobject::fileModificationChecking = regIOobject::timeStamp;
}
else if (oldCheckType == regIOobject::inotifyMaster)
{
regIOobject::fileModificationChecking = regIOobject::inotify;
}
clouds.set
(
i,
new unmappedPassiveParticleCloud(mesh, cloudNames[i], false)
);
regIOobject::fileModificationChecking = oldCheckType;
}
//forAllConstIter //forAllConstIter
@ -2434,7 +2418,7 @@ int main(int argc, char *argv[])
meshSubDir, meshSubDir,
runTime, runTime,
IOobject::READ_IF_PRESENT IOobject::READ_IF_PRESENT
).headerOk(); ).typeHeaderOk<labelIOList>(true);
} }
else else
{ {

View File

@ -16,6 +16,6 @@ for (label n1=0; n1<Times.size() && variableGood; ++n1)
Times[n1].name(), Times[n1].name(),
mesh, mesh,
IOobject::NO_READ IOobject::NO_READ
).headerOk(); ).typeHeaderOk<volScalarField>(false);
} }
} }

View File

@ -17,7 +17,7 @@ if (Times.size() > 1)
mesh, mesh,
IOobject::NO_READ IOobject::NO_READ
); );
if (io.headerOk()) if (io.typeHeaderOk<pointIOField>(true))
{ {
meshMoving = true; meshMoving = true;
break; break;

View File

@ -706,7 +706,10 @@ int main(int argc, char *argv[])
IOobject::MUST_READ IOobject::MUST_READ
); );
bool fieldExists = fieldObject.headerOk(); bool fieldExists = fieldObject.typeHeaderOk<IOField<scalar> >
(
false
);
if (fieldType == scalarIOField::typeName) if (fieldType == scalarIOField::typeName)
{ {
ensightCloudField<scalar> ensightCloudField<scalar>

View File

@ -13,6 +13,6 @@ if (timeDirs.size() > 1)
polyMesh::meshSubDir, polyMesh::meshSubDir,
mesh, mesh,
IOobject::NO_READ IOobject::NO_READ
).headerOk(); ).typeHeaderOk<pointIOField>(true);
} }
} }

View File

@ -24,7 +24,7 @@
false false
); );
if (io.headerOk()) if (io.typeHeaderOk<IOdictionary>(true))
{ {
io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
IOdictionary timeObject(io); IOdictionary timeObject(io);

View File

@ -7,7 +7,7 @@
mesh mesh
); );
if (io.headerOk()) if (io.typeHeaderOk<pointIOField>(true))
{ {
// Read new points // Read new points
io.readOpt() = IOobject::MUST_READ; io.readOpt() = IOobject::MUST_READ;

View File

@ -71,7 +71,13 @@ for (label i=0; i < nTypes; i++)
IOobject::NO_READ IOobject::NO_READ
); );
if (lagrangianHeader.headerOk()) if
(
lagrangianHeader.typeHeaderOk<IOPosition<Cloud<passiveParticle> > >
(
false
)
)
{ {
Cloud<passiveParticle> particles(mesh); Cloud<passiveParticle> particles(mesh);

View File

@ -6,7 +6,7 @@ IOobject ioPoints
mesh mesh
); );
if (ioPoints.headerOk()) if (ioPoints.typeHeaderOk<pointIOField>(true))
{ {
Info<< "new points available" << endl; Info<< "new points available" << endl;
// Reading new points // Reading new points

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -567,7 +567,13 @@ double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps)
if if
( (
isFile(runTime.path()/timeName/meshDir_/"points") isFile(runTime.path()/timeName/meshDir_/"points")
&& IOobject("points", timeName, meshDir_, runTime).headerOk() && IOobject
(
"points",
timeName,
meshDir_,
runTime
).typeHeaderOk<pointIOField>(true)
) )
{ {
break; break;

View File

@ -124,7 +124,7 @@ Foam::wordList Foam::vtkPV3Foam::getZoneNames(const word& zoneType) const
false false
); );
if (ioObj.headerOk()) if (ioObj.typeHeaderOk<cellZoneMesh>(false))
{ {
zonesEntries zones(ioObj); zonesEntries zones(ioObj);
@ -333,7 +333,7 @@ void Foam::vtkPV3Foam::updateInfoPatches
); );
// this should only ever fail if the mesh region doesn't exist // this should only ever fail if the mesh region doesn't exist
if (ioObj.headerOk()) if (ioObj.typeHeaderOk<polyBoundaryMesh>(true))
{ {
polyBoundaryMeshEntries patchEntries(ioObj); polyBoundaryMeshEntries patchEntries(ioObj);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -567,7 +567,13 @@ double* Foam::vtkPV4Foam::findTimes(int& nTimeSteps)
if if
( (
isFile(runTime.path()/timeName/meshDir_/"points") isFile(runTime.path()/timeName/meshDir_/"points")
&& IOobject("points", timeName, meshDir_, runTime).headerOk() && IOobject
(
"points",
timeName,
meshDir_,
runTime
).typeHeaderOk<pointIOField>(true)
) )
{ {
break; break;

View File

@ -124,7 +124,7 @@ Foam::wordList Foam::vtkPV4Foam::getZoneNames(const word& zoneType) const
false false
); );
if (ioObj.headerOk()) if (ioObj.typeHeaderOk<cellZoneMesh>(false))
{ {
zonesEntries zones(ioObj); zonesEntries zones(ioObj);
@ -333,7 +333,7 @@ void Foam::vtkPV4Foam::updateInfoPatches
); );
// this should only ever fail if the mesh region doesn't exist // this should only ever fail if the mesh region doesn't exist
if (ioObj.headerOk()) if (ioObj.typeHeaderOk<polyBoundaryMesh>(true))
{ {
polyBoundaryMeshEntries patchEntries(ioObj); polyBoundaryMeshEntries patchEntries(ioObj);

View File

@ -171,7 +171,7 @@ int USERD_set_filenames
false false
); );
if (sprayHeader.headerOk()) if (sprayHeader.typeHeaderOk<Cloud<passiveParticle> >(false))
{ {
Info<< "[Found lagrangian]" << endl; Info<< "[Found lagrangian]" << endl;

View File

@ -12,7 +12,7 @@ IOobject fieldObjectPtr
IOobject::NO_READ IOobject::NO_READ
); );
if (!fieldObjectPtr.headerOk()) if (!fieldObjectPtr.typeHeaderOk<volScalarField>(true))
{ {
return Z_UNDEF; return Z_UNDEF;
} }

View File

@ -12,7 +12,7 @@ IOobject fieldObjectPtr
IOobject::NO_READ IOobject::NO_READ
); );
if (!fieldObjectPtr.headerOk()) if (!fieldObjectPtr.typeHeaderOk<volTensorField>(true))
{ {
return Z_UNDEF; return Z_UNDEF;
} }

View File

@ -12,7 +12,7 @@ IOobject fieldObjectPtr
IOobject::NO_READ IOobject::NO_READ
); );
if (!fieldObjectPtr.headerOk()) if (!fieldObjectPtr.typeHeaderOk<volVectorField>(true))
{ {
return Z_UNDEF; return Z_UNDEF;
} }

View File

@ -13,7 +13,7 @@ IOobject fieldObjectPtr
IOobject::NO_READ IOobject::NO_READ
); );
if (!fieldObjectPtr.headerOk()) if (!fieldObjectPtr.typeHeaderOk<volScalarField>(true))
{ {
return Z_UNDEF; return Z_UNDEF;
} }

View File

@ -13,7 +13,7 @@ IOobject fieldObjectPtr
IOobject::NO_READ IOobject::NO_READ
); );
if (!fieldObjectPtr.headerOk()) if (!fieldObjectPtr.typeHeaderOk<volTensorField>(true))
{ {
return Z_UNDEF; return Z_UNDEF;
} }

View File

@ -13,7 +13,7 @@ IOobject fieldObjectPtr
IOobject::NO_READ IOobject::NO_READ
); );
if (!fieldObjectPtr.headerOk()) if (!fieldObjectPtr.typeHeaderOk<volVectorField>(true))
{ {
return Z_UNDEF; return Z_UNDEF;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -62,7 +62,11 @@ namespace Foam
IOobject::MUST_READ IOobject::MUST_READ
); );
if (obj.headerOk() && obj.headerClassName() == fieldType::typeName) if
(
obj.typeHeaderOk<fieldType>(false)
&& obj.headerClassName() == fieldType::typeName
)
{ {
list.set(index++, new fieldType(obj, mesh)); list.set(index++, new fieldType(obj, mesh));
} }

View File

@ -306,7 +306,7 @@ void calc
false false
); );
if (turbulencePropertiesHeader.headerOk()) if (turbulencePropertiesHeader.typeHeaderOk<IOdictionary>(true))
{ {
singlePhaseTransportModel laminarTransport(U, phi); singlePhaseTransportModel laminarTransport(U, phi);
@ -364,7 +364,7 @@ void calc
false false
); );
if (turbulencePropertiesHeader.headerOk()) if (turbulencePropertiesHeader.typeHeaderOk<IOdictionary>(true))
{ {
autoPtr<compressible::turbulenceModel> turbulenceModel autoPtr<compressible::turbulenceModel> turbulenceModel
( (

View File

@ -6,7 +6,7 @@
IOobject::MUST_READ IOobject::MUST_READ
); );
if (!UMeanHeader.headerOk()) if (!UMeanHeader.typeHeaderOk<volVectorField>(true))
{ {
Info<< " No UMean field" << endl; Info<< " No UMean field" << endl;
continue; continue;

View File

@ -69,7 +69,11 @@ int main(int argc, char *argv[])
// Check p and U exist // Check p and U exist
if (pheader.headerOk() && Uheader.headerOk()) if
(
pheader.typeHeaderOk<volScalarField>(true)
&& Uheader.typeHeaderOk<volVectorField>(true)
)
{ {
mesh.readUpdate(); mesh.readUpdate();
@ -106,7 +110,7 @@ int main(int argc, char *argv[])
); );
// Check rho exists // Check rho exists
if (rhoheader.headerOk()) if (rhoheader.typeHeaderOk<volScalarField>(true))
{ {
Info<< " Reading rho" << endl; Info<< " Reading rho" << endl;
volScalarField rho(rhoheader, mesh); volScalarField rho(rhoheader, mesh);

View File

@ -102,7 +102,7 @@ int main(int argc, char *argv[])
); );
// Check field exists // Check field exists
if (io.headerOk()) if (io.typeHeaderOk<volScalarField>(false))
{ {
mesh.readUpdate(); mesh.readUpdate();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -132,7 +132,7 @@ int main(int argc, char *argv[])
); );
// Check field exists // Check field exists
if (fieldHeader.headerOk()) if (fieldHeader.typeHeaderOk<volScalarField>(false))
{ {
mesh.readUpdate(); mesh.readUpdate();

View File

@ -76,7 +76,7 @@ int main(int argc, char *argv[])
); );
// Check p exists // Check p exists
if (pheader.headerOk()) if (pheader.typeHeaderOk<volScalarField>(true))
{ {
mesh.readUpdate(); mesh.readUpdate();

View File

@ -62,7 +62,7 @@ int main(int argc, char *argv[])
); );
// Check U exists // Check U exists
if (Uheader.headerOk()) if (Uheader.typeHeaderOk<volVectorField>(true))
{ {
mesh.readUpdate(); mesh.readUpdate();

View File

@ -78,7 +78,7 @@ void calcCompressibleR
IOobject::NO_WRITE IOobject::NO_WRITE
); );
if (!rhoHeader.headerOk()) if (!rhoHeader.typeHeaderOk<volScalarField>(true))
{ {
Info<< " no " << rhoHeader.name() <<" field" << endl; Info<< " no " << rhoHeader.name() <<" field" << endl;
return; return;
@ -132,7 +132,7 @@ int main(int argc, char *argv[])
IOobject::NO_WRITE IOobject::NO_WRITE
); );
if (UHeader.headerOk()) if (UHeader.typeHeaderOk<volVectorField>(true))
{ {
Info<< "Reading field " << UHeader.name() << nl << endl; Info<< "Reading field " << UHeader.name() << nl << endl;
volVectorField U(UHeader, mesh); volVectorField U(UHeader, mesh);
@ -144,7 +144,7 @@ int main(int argc, char *argv[])
basicThermo::dictName, basicThermo::dictName,
runTime.constant(), runTime.constant(),
mesh mesh
).headerOk() ).typeHeaderOk<IOdictionary>(true)
) )
{ {
calcCompressibleR(mesh, runTime, U); calcCompressibleR(mesh, runTime, U);

View File

@ -76,7 +76,11 @@ int main(int argc, char *argv[])
if (findStrings(fieldPatterns, "k")) if (findStrings(fieldPatterns, "k"))
{ {
if (!IOobject("k", runTime.timeName(), mesh).headerOk()) if
(
!IOobject("k", runTime.timeName(), mesh).
typeHeaderOk<volScalarField>(true)
)
{ {
Info<< " Writing turbulence field k" << endl; Info<< " Writing turbulence field k" << endl;
const volScalarField k(RASModel->k()); const volScalarField k(RASModel->k());
@ -90,7 +94,11 @@ int main(int argc, char *argv[])
if (findStrings(fieldPatterns, "epsilon")) if (findStrings(fieldPatterns, "epsilon"))
{ {
if (!IOobject("epsilon", runTime.timeName(), mesh).headerOk()) if
(
!IOobject("epsilon", runTime.timeName(), mesh).
typeHeaderOk<volScalarField>(true)
)
{ {
Info<< " Writing turbulence field epsilon" << endl; Info<< " Writing turbulence field epsilon" << endl;
const volScalarField epsilon(RASModel->epsilon()); const volScalarField epsilon(RASModel->epsilon());
@ -104,7 +112,11 @@ int main(int argc, char *argv[])
if (findStrings(fieldPatterns, "R")) if (findStrings(fieldPatterns, "R"))
{ {
if (!IOobject("R", runTime.timeName(), mesh).headerOk()) if
(
!IOobject("R", runTime.timeName(), mesh).
typeHeaderOk<volSymmTensorField>(true)
)
{ {
Info<< " Writing turbulence field R" << endl; Info<< " Writing turbulence field R" << endl;
const volSymmTensorField R(RASModel->R()); const volSymmTensorField R(RASModel->R());
@ -118,7 +130,11 @@ int main(int argc, char *argv[])
if (findStrings(fieldPatterns, "omega")) if (findStrings(fieldPatterns, "omega"))
{ {
if (!IOobject("omega", runTime.timeName(), mesh).headerOk()) if
(
!IOobject("omega", runTime.timeName(), mesh).
typeHeaderOk<volScalarField>(true)
)
{ {
const scalar Cmu = 0.09; const scalar Cmu = 0.09;

View File

@ -50,7 +50,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
IOobject::MUST_READ IOobject::MUST_READ
); );
if (phiHeader.headerOk()) if (phiHeader.typeHeaderOk<surfaceScalarField>(true))
{ {
volScalarField Co volScalarField Co
( (

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -48,7 +48,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
IOobject::MUST_READ IOobject::MUST_READ
); );
if (Uheader.headerOk()) if (Uheader.typeHeaderOk<volVectorField>(true))
{ {
Info<< " Reading U" << endl; Info<< " Reading U" << endl;
volVectorField U(Uheader, mesh); volVectorField U(Uheader, mesh);

View File

@ -58,7 +58,11 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
); );
// Check U and T exists // Check U and T exists
if (Uheader.headerOk() && Theader.headerOk()) if
(
Uheader.typeHeaderOk<volVectorField>(true)
&& Theader.typeHeaderOk<volScalarField>(true)
)
{ {
autoPtr<volScalarField> MachPtr; autoPtr<volScalarField> MachPtr;
@ -71,7 +75,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
basicThermo::dictName, basicThermo::dictName,
runTime.constant(), runTime.constant(),
mesh mesh
).headerOk() ).typeHeaderOk<IOdictionary>(false)
) )
{ {
// thermophysical Mach // thermophysical Mach

View File

@ -24,7 +24,11 @@
// Check U exists // Check U exists
if (Uheader.headerOk() && Theader.headerOk()) if
(
Uheader.typeHeaderOk<volVectorField>(true)
&& Theader.typeHeaderOk<volScalarField>(true)
)
{ {
mesh.readUpdate(); mesh.readUpdate();

View File

@ -14,7 +14,7 @@
IOobject::MUST_READ IOobject::MUST_READ
); );
if (Uheader.headerOk()) if (Uheader.typeHeaderOk<volVectorField>(true))
{ {
volVectorField U(Uheader, mesh); volVectorField U(Uheader, mesh);

View File

@ -55,7 +55,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
IOobject::MUST_READ IOobject::MUST_READ
); );
if (phiHeader.headerOk()) if (phiHeader.typeHeaderOk<surfaceScalarField>(true))
{ {
autoPtr<surfaceScalarField> PePtr; autoPtr<surfaceScalarField> PePtr;
@ -87,7 +87,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0)) if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0))
{ {
if (turbulencePropertiesHeader.headerOk()) if (turbulencePropertiesHeader.typeHeaderOk<IOdictionary>(true))
{ {
singlePhaseTransportModel laminarTransport(U, phi); singlePhaseTransportModel laminarTransport(U, phi);
@ -144,7 +144,8 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
( (
"Pef", "Pef",
runTime.timeName(), runTime.timeName(),
mesh mesh,
IOobject::NO_READ
), ),
mag(phi) mag(phi)
/( /(
@ -158,7 +159,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
} }
else if (phi.dimensions() == dimensionSet(1, 0, -1, 0, 0)) else if (phi.dimensions() == dimensionSet(1, 0, -1, 0, 0))
{ {
if (turbulencePropertiesHeader.headerOk()) if (turbulencePropertiesHeader.typeHeaderOk<IOdictionary>(true))
{ {
autoPtr<fluidThermo> thermo(fluidThermo::New(mesh)); autoPtr<fluidThermo> thermo(fluidThermo::New(mesh));

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -51,7 +51,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
IOobject::MUST_READ IOobject::MUST_READ
); );
if (Uheader.headerOk()) if (Uheader.typeHeaderOk<volVectorField>(true))
{ {
Info<< " Reading U" << endl; Info<< " Reading U" << endl;
volVectorField U(Uheader, mesh); volVectorField U(Uheader, mesh);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,7 +49,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
IOobject::MUST_READ IOobject::MUST_READ
); );
if (Uheader.headerOk()) if (Uheader.typeHeaderOk<volVectorField>(true))
{ {
Info<< " Reading U" << endl; Info<< " Reading U" << endl;
volVectorField U(Uheader, mesh); volVectorField U(Uheader, mesh);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -57,7 +57,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
IOobject::MUST_READ IOobject::MUST_READ
); );
if (Uheader.headerOk()) if (Uheader.typeHeaderOk<volVectorField>(true))
{ {
Info<< " Reading U" << endl; Info<< " Reading U" << endl;
volVectorField U(Uheader, mesh); volVectorField U(Uheader, mesh);

View File

@ -86,7 +86,7 @@ int main(int argc, char *argv[])
IOobject::NO_READ IOobject::NO_READ
); );
if (phiHeader.headerOk()) if (phiHeader.typeHeaderOk<surfaceScalarField>(true))
{ {
mesh.readUpdate(); mesh.readUpdate();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,7 +49,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
IOobject::MUST_READ IOobject::MUST_READ
); );
if (kheader.headerOk()) if (kheader.typeHeaderOk<volScalarField>(true))
{ {
Info<< " Reading k" << endl; Info<< " Reading k" << endl;
volScalarField k(kheader, mesh); volScalarField k(kheader, mesh);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,7 +49,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
IOobject::MUST_READ IOobject::MUST_READ
); );
if (Uheader.headerOk()) if (Uheader.typeHeaderOk<volVectorField>(true))
{ {
Info<< " Reading U" << endl; Info<< " Reading U" << endl;
volVectorField U(Uheader, mesh); volVectorField U(Uheader, mesh);

View File

@ -60,7 +60,7 @@ int main(int argc, char *argv[])
); );
// Check U exists // Check U exists
if (Uheader.headerOk()) if (Uheader.typeHeaderOk<volVectorField>(true))
{ {
mesh.readUpdate(); mesh.readUpdate();
@ -109,7 +109,7 @@ int main(int argc, char *argv[])
} }
} }
Info<< "End" << endl; Info<< "End\n" << endl;
return 0; return 0;
} }

View File

@ -88,7 +88,7 @@ void calcCompressible
IOobject::NO_WRITE IOobject::NO_WRITE
); );
if (!rhoHeader.headerOk()) if (!rhoHeader.typeHeaderOk<volScalarField>(true))
{ {
Info<< " no rho field" << endl; Info<< " no rho field" << endl;
return; return;
@ -169,7 +169,7 @@ int main(int argc, char *argv[])
IOobject::NO_WRITE IOobject::NO_WRITE
); );
if (UHeader.headerOk()) if (UHeader.typeHeaderOk<volVectorField>(true))
{ {
Info<< "Reading field U\n" << endl; Info<< "Reading field U\n" << endl;
volVectorField U(UHeader, mesh); volVectorField U(UHeader, mesh);
@ -181,7 +181,7 @@ int main(int argc, char *argv[])
basicThermo::dictName, basicThermo::dictName,
runTime.constant(), runTime.constant(),
mesh mesh
).headerOk() ).typeHeaderOk<IOdictionary>(true)
) )
{ {
calcCompressible(mesh, runTime, U, wallShearStress); calcCompressible(mesh, runTime, U, wallShearStress);

View File

@ -149,7 +149,7 @@ void calcCompressibleYPlus
IOobject::NO_WRITE IOobject::NO_WRITE
); );
if (!rhoHeader.headerOk()) if (!rhoHeader.typeHeaderOk<volScalarField>(true))
{ {
Info<< " no rho field" << endl; Info<< " no rho field" << endl;
return; return;
@ -216,7 +216,7 @@ int main(int argc, char *argv[])
IOobject::NO_WRITE IOobject::NO_WRITE
); );
if (UHeader.headerOk()) if (UHeader.typeHeaderOk<volVectorField>(true))
{ {
Info<< "Reading field U\n" << endl; Info<< "Reading field U\n" << endl;
volVectorField U(UHeader, mesh); volVectorField U(UHeader, mesh);
@ -228,7 +228,7 @@ int main(int argc, char *argv[])
basicThermo::dictName, basicThermo::dictName,
runTime.constant(), runTime.constant(),
mesh mesh
).headerOk() ).typeHeaderOk<IOdictionary>(true)
) )
{ {
calcCompressibleYPlus(mesh, runTime, U, yPlus); calcCompressibleYPlus(mesh, runTime, U, yPlus);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -163,7 +163,7 @@ void calcOmega
false false
); );
if (omegaHeader.headerOk()) if (omegaHeader.typeHeaderOk<volScalarField>(true))
{ {
volScalarField omega(omegaHeader, mesh); volScalarField omega(omegaHeader, mesh);
dimensionedScalar k0("SMALL", k.dimensions(), SMALL); dimensionedScalar k0("SMALL", k.dimensions(), SMALL);
@ -200,7 +200,7 @@ void setField
false false
); );
if (fldHeader.headerOk()) if (fldHeader.typeHeaderOk<volScalarField>(true))
{ {
volScalarField fld(fldHeader, mesh); volScalarField fld(fldHeader, mesh);
fld = value; fld = value;
@ -388,7 +388,7 @@ int main(int argc, char *argv[])
basicThermo::dictName, basicThermo::dictName,
runTime.constant(), runTime.constant(),
mesh mesh
).headerOk() ).typeHeaderOk<IOdictionary>(true)
) )
{ {
calcCompressible(mesh, mask, U, y, ybl); calcCompressible(mesh, mask, U, y, ybl);

View File

@ -2,8 +2,8 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -125,6 +125,7 @@ HashTable<wordList, word> extractPatchGroups(const dictionary& boundaryDict)
bool merge bool merge
( (
const bool addNonExisting,
dictionary&, dictionary&,
const dictionary&, const dictionary&,
const bool, const bool,
@ -152,6 +153,7 @@ bool addEntry
( (
merge merge
( (
true,
const_cast<dictionary&>(thisEntry.dict()), const_cast<dictionary&>(thisEntry.dict()),
mergeEntry.dict(), mergeEntry.dict(),
literalRE, literalRE,
@ -220,6 +222,7 @@ labelList findMatches
// - false : interpret wildcard as a rule for items to be matched. // - false : interpret wildcard as a rule for items to be matched.
bool merge bool merge
( (
const bool addNonExisting,
dictionary& thisDict, dictionary& thisDict,
const dictionary& mergeDict, const dictionary& mergeDict,
const bool literalRE, const bool literalRE,
@ -290,9 +293,18 @@ bool merge
} }
else else
{ {
// not found - just add if (addNonExisting)
thisDict.add(mergeIter().clone(thisDict).ptr()); {
changed = true; // not found - just add
thisDict.add(mergeIter().clone(thisDict).ptr());
changed = true;
}
else
{
IOWarningInFunction(mergeDict)
<< "Ignoring non-existing entry " << key
<< endl;
}
} }
} }
} }
@ -568,8 +580,8 @@ int main(int argc, char *argv[])
const dictionary& replaceDict = fieldIter().dict(); const dictionary& replaceDict = fieldIter().dict();
Info<< "Merging entries from " << replaceDict.toc() << endl; Info<< "Merging entries from " << replaceDict.toc() << endl;
// Merge the replacements in // Merge the replacements in. Do not add non-existing entries.
merge(fieldDict, replaceDict, literalRE, patchGroups); merge(false, fieldDict, replaceDict, literalRE, patchGroups);
Info<< "fieldDict:" << fieldDict << endl; Info<< "fieldDict:" << fieldDict << endl;
@ -628,7 +640,7 @@ int main(int argc, char *argv[])
false false
); );
if (fieldHeader.headerOk()) if (fieldHeader.typeHeaderOk<IOdictionary>(false))
{ {
IOdictionary fieldDict(fieldHeader); IOdictionary fieldDict(fieldHeader);
@ -645,8 +657,8 @@ int main(int argc, char *argv[])
const dictionary& replaceDict = fieldIter().dict(); const dictionary& replaceDict = fieldIter().dict();
Info<< "Merging entries from " << replaceDict.toc() << endl; Info<< "Merging entries from " << replaceDict.toc() << endl;
// Merge the replacements in // Merge the replacements in (allow adding)
merge(fieldDict, replaceDict, literalRE, patchGroups); merge(true, fieldDict, replaceDict, literalRE, patchGroups);
Info<< "Writing modified fieldDict " << fieldName << endl; Info<< "Writing modified fieldDict " << fieldName << endl;
fieldDict.regIOobject::write(); fieldDict.regIOobject::write();

View File

@ -90,7 +90,7 @@ Foam::boundaryTemplates::boundaryTemplates
IOobject::MUST_READ IOobject::MUST_READ
); );
if (io.headerOk()) if (io.typeHeaderOk<IOdictionary>(true))
{ {
IOdictionary dict(io); IOdictionary dict(io);
regionTemplate.subDict(patchTypes[i]).merge(dict); regionTemplate.subDict(patchTypes[i]).merge(dict);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -57,7 +57,7 @@ Foam::word Foam::solverTemplate::readFromDict
const word& entryName const word& entryName
) const ) const
{ {
if (!dictHeader.headerOk()) if (!dictHeader.typeHeaderOk<IOdictionary>(true))
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unable to open file " << "Unable to open file "

View File

@ -74,7 +74,8 @@ void rewriteBoundary
HashTable<word>& nbrNames HashTable<word>& nbrNames
) )
{ {
Info<< "Reading boundary from " << io.filePath() << endl; Info<< "Reading boundary from " << typeFilePath<IOPtrList<entry> >(io)
<< endl;
// Read PtrList of dictionary. // Read PtrList of dictionary.
const word oldTypeName = IOPtrList<entry>::typeName; const word oldTypeName = IOPtrList<entry>::typeName;
@ -446,7 +447,7 @@ int main(int argc, char *argv[])
false false
); );
if (io.headerOk()) if (io.typeHeaderOk<IOPtrList<entry> >(false))
{ {
rewriteBoundary rewriteBoundary
( (
@ -480,7 +481,7 @@ int main(int argc, char *argv[])
false false
); );
if (io.headerOk()) if (io.typeHeaderOk<IOPtrList<entry> >(false))
{ {
rewriteBoundary rewriteBoundary
( (

View File

@ -44,13 +44,12 @@ void MapConsistentVolFields
const CombineOp& cop const CombineOp& cop
) )
{ {
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const fvMesh& meshSource = meshToMesh0Interp.fromMesh(); const fvMesh& meshSource = meshToMesh0Interp.fromMesh();
const fvMesh& meshTarget = meshToMesh0Interp.toMesh(); const fvMesh& meshTarget = meshToMesh0Interp.toMesh();
word fieldClassName word fieldClassName(fieldType::typeName);
(
GeometricField<Type, fvPatchField, volMesh>::typeName
);
IOobjectList fields = objects.lookupClass(fieldClassName); IOobjectList fields = objects.lookupClass(fieldClassName);
@ -60,11 +59,7 @@ void MapConsistentVolFields
<< endl; << endl;
// Read field // Read field
GeometricField<Type, fvPatchField, volMesh> fieldSource fieldType fieldSource(*fieldIter(), meshSource);
(
*fieldIter(),
meshSource
);
IOobject fieldTargetIOobject IOobject fieldTargetIOobject
( (
@ -75,14 +70,10 @@ void MapConsistentVolFields
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
); );
if (fieldTargetIOobject.headerOk()) if (fieldTargetIOobject.typeHeaderOk<fieldType>(true))
{ {
// Read fieldTarget // Read fieldTarget
GeometricField<Type, fvPatchField, volMesh> fieldTarget fieldType fieldTarget(fieldTargetIOobject, meshTarget);
(
fieldTargetIOobject,
meshTarget
);
// Interpolate field // Interpolate field
meshToMesh0Interp.interpolate meshToMesh0Interp.interpolate
@ -101,7 +92,7 @@ void MapConsistentVolFields
fieldTargetIOobject.readOpt() = IOobject::NO_READ; fieldTargetIOobject.readOpt() = IOobject::NO_READ;
// Interpolate field // Interpolate field
GeometricField<Type, fvPatchField, volMesh> fieldTarget fieldType fieldTarget
( (
fieldTargetIOobject, fieldTargetIOobject,
meshToMesh0Interp.interpolate meshToMesh0Interp.interpolate

View File

@ -44,13 +44,12 @@ void MapVolFields
const CombineOp& cop const CombineOp& cop
) )
{ {
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const fvMesh& meshSource = meshToMesh0Interp.fromMesh(); const fvMesh& meshSource = meshToMesh0Interp.fromMesh();
const fvMesh& meshTarget = meshToMesh0Interp.toMesh(); const fvMesh& meshTarget = meshToMesh0Interp.toMesh();
word fieldClassName word fieldClassName(fieldType::typeName);
(
GeometricField<Type, fvPatchField, volMesh>::typeName
);
IOobjectList fields = objects.lookupClass(fieldClassName); IOobjectList fields = objects.lookupClass(fieldClassName);
@ -65,20 +64,20 @@ void MapVolFields
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
); );
if (fieldTargetIOobject.headerOk()) if (fieldTargetIOobject.typeHeaderOk<fieldType>(true))
{ {
Info<< " interpolating " << fieldIter()->name() Info<< " interpolating " << fieldIter()->name()
<< endl; << endl;
// Read field fieldSource // Read field fieldSource
GeometricField<Type, fvPatchField, volMesh> fieldSource fieldType fieldSource
( (
*fieldIter(), *fieldIter(),
meshSource meshSource
); );
// Read fieldTarget // Read fieldTarget
GeometricField<Type, fvPatchField, volMesh> fieldTarget fieldType fieldTarget
( (
fieldTargetIOobject, fieldTargetIOobject,
meshTarget meshTarget

View File

@ -69,7 +69,7 @@ void MapVolFields
IOobject::MUST_READ IOobject::MUST_READ
); );
if (targetIO.headerOk()) if (targetIO.typeHeaderOk<fieldType>(true))
{ {
fieldType fieldTarget(targetIO, meshTarget); fieldType fieldTarget(targetIO, meshTarget);

View File

@ -64,7 +64,7 @@ bool setCellFieldType
); );
// Check the "constant" directory // Check the "constant" directory
if (!fieldHeader.headerOk()) if (!fieldHeader.typeHeaderOk<fieldType>(true))
{ {
fieldHeader = IOobject fieldHeader = IOobject
( (
@ -76,7 +76,7 @@ bool setCellFieldType
} }
// Check field exists // Check field exists
if (fieldHeader.headerOk()) if (fieldHeader.typeHeaderOk<fieldType>(true))
{ {
Info<< " Setting internal values of " Info<< " Setting internal values of "
<< fieldHeader.headerClassName() << fieldHeader.headerClassName()
@ -208,7 +208,7 @@ bool setFaceFieldType
); );
// Check the "constant" directory // Check the "constant" directory
if (!fieldHeader.headerOk()) if (!fieldHeader.typeHeaderOk<fieldType>(true))
{ {
fieldHeader = IOobject fieldHeader = IOobject
( (
@ -220,7 +220,7 @@ bool setFaceFieldType
} }
// Check field exists // Check field exists
if (fieldHeader.headerOk()) if (fieldHeader.typeHeaderOk<fieldType>(true))
{ {
Info<< " Setting patchField values of " Info<< " Setting patchField values of "
<< fieldHeader.headerClassName() << fieldHeader.headerClassName()

View File

@ -194,7 +194,7 @@ int main(int argc, char *argv[])
} }
if (!csDictIoPtr->headerOk()) if (!csDictIoPtr->typeHeaderOk<coordinateSystems>(false))
{ {
FatalErrorInFunction FatalErrorInFunction
<< csDictIoPtr->objectPath() << nl << csDictIoPtr->objectPath() << nl

View File

@ -174,7 +174,7 @@ int main(int argc, char *argv[])
} }
if (!ioPtr->headerOk()) if (!ioPtr->typeHeaderOk<coordinateSystems>(false))
{ {
FatalErrorInFunction FatalErrorInFunction
<< ioPtr->objectPath() << nl << ioPtr->objectPath() << nl

View File

@ -187,7 +187,7 @@ int main(int argc, char *argv[])
} }
if (!ioPtr->headerOk()) if (!ioPtr->typeHeaderOk<coordinateSystems>(false))
{ {
FatalErrorInFunction FatalErrorInFunction
<< ioPtr->objectPath() << nl << ioPtr->objectPath() << nl

View File

@ -42,6 +42,7 @@ Note
#include "polyMesh.H" #include "polyMesh.H"
#include "distributedTriSurfaceMesh.H" #include "distributedTriSurfaceMesh.H"
#include "mapDistribute.H" #include "mapDistribute.H"
#include "localIOdictionary.H"
using namespace Foam; using namespace Foam;
@ -165,23 +166,6 @@ int main(int argc, char *argv[])
Pstream::scatterList(meshBb); Pstream::scatterList(meshBb);
} }
// Temporarily: override master-only checking
regIOobject::fileCheckTypes oldCheckType =
regIOobject::fileModificationChecking;
if (oldCheckType == regIOobject::timeStampMaster)
{
regIOobject::fileModificationChecking = regIOobject::timeStamp;
}
else if (oldCheckType == regIOobject::inotifyMaster)
{
regIOobject::fileModificationChecking = regIOobject::inotify;
}
IOobject io IOobject io
( (
surfFileName, // name surfFileName, // name
@ -193,7 +177,8 @@ int main(int argc, char *argv[])
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
); );
const fileName actualPath(io.filePath()); // Look for file (using searchableSurface rules)
const fileName actualPath(typeFilePath<searchableSurface>(io));
fileName localPath(actualPath); fileName localPath(actualPath);
localPath.replace(runTime.rootPath() + '/', ""); localPath.replace(runTime.rootPath() + '/', "");
@ -271,10 +256,6 @@ int main(int argc, char *argv[])
Info<< "Writing surface." << nl << endl; Info<< "Writing surface." << nl << endl;
surfMesh.objectRegistry::write(); surfMesh.objectRegistry::write();
regIOobject::fileModificationChecking = oldCheckType;
Info<< "End\n" << endl; Info<< "End\n" << endl;
return 0; return 0;

View File

@ -45,7 +45,8 @@ minTetQuality 1e-15;
minArea -1; minArea -1;
//- Minimum face twist. Set to <-1 to disable. dot product of face normal //- Minimum face twist. Set to <-1 to disable. dot product of face normal
// and face centre triangles normal // (itself the average of the triangle normals)
// and face centre triangles normal
minTwist 0.02; minTwist 0.02;
//- Minimum normalised cell determinant. This is the determinant of all //- Minimum normalised cell determinant. This is the determinant of all
@ -63,9 +64,8 @@ minFaceWeight 0.05;
//- Volume ratio of neighbouring cells (0 -> 1) //- Volume ratio of neighbouring cells (0 -> 1)
minVolRatio 0.01; minVolRatio 0.01;
//- Per triangle normal compared to average normal. Like face twist //- Per triangle normal compared to that of preceding triangle. Must be >0
// but now per (face-centre decomposition) triangle. Must be >0 for Fluent // for Fluent compatibility
// compatibility
minTriangleTwist -1; minTriangleTwist -1;

View File

@ -183,11 +183,17 @@ $(functionEntries)/inputModeEntry/inputModeEntry.C
$(functionEntries)/removeEntry/removeEntry.C $(functionEntries)/removeEntry/removeEntry.C
IOdictionary = db/IOobjects/IOdictionary IOdictionary = db/IOobjects/IOdictionary
$(IOdictionary)/baseIOdictionary.C
$(IOdictionary)/baseIOdictionaryIO.C
$(IOdictionary)/IOdictionary.C $(IOdictionary)/IOdictionary.C
$(IOdictionary)/IOdictionaryIO.C $(IOdictionary)/localIOdictionary.C
$(IOdictionary)/unwatchedIOdictionary.C
db/IOobjects/IOMap/IOMapName.C db/IOobjects/IOMap/IOMapName.C
db/IOobjects/GlobalIOList/globalIOLists.C
IOobject = db/IOobject IOobject = db/IOobject
$(IOobject)/IOobject.C $(IOobject)/IOobject.C
$(IOobject)/IOobjectIO.C $(IOobject)/IOobjectIO.C
@ -592,6 +598,9 @@ $(Fields)/quaternionField/quaternionIOField.C
$(Fields)/triadField/triadIOField.C $(Fields)/triadField/triadIOField.C
$(Fields)/transformField/transformField.C $(Fields)/transformField/transformField.C
$(Fields)/globalFields/globalIOFields.C
pointPatchFields = fields/pointPatchFields pointPatchFields = fields/pointPatchFields
$(pointPatchFields)/pointPatchField/pointPatchFields.C $(pointPatchFields)/pointPatchField/pointPatchFields.C

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -32,11 +32,87 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(IOobject, 0); defineTypeNameAndDebug(IOobject, 0);
template<>
const char* NamedEnum
<
IOobject::fileCheckTypes,
4
>::names[] =
{
"timeStamp",
"timeStampMaster",
"inotify",
"inotifyMaster"
};
}
const Foam::NamedEnum<Foam::IOobject::fileCheckTypes, 4>
Foam::IOobject::fileCheckTypesNames;
// Default fileCheck type
Foam::IOobject::fileCheckTypes Foam::IOobject::fileModificationChecking
(
fileCheckTypesNames.read
(
debug::optimisationSwitches().lookup
(
"fileModificationChecking"
)
)
);
namespace Foam
{
// Register re-reader
class addfileModificationCheckingToOpt
:
public ::Foam::simpleRegIOobject
{
public:
addfileModificationCheckingToOpt(const char* name)
:
::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject, name)
{}
virtual ~addfileModificationCheckingToOpt()
{}
virtual void readData(Foam::Istream& is)
{
IOobject::fileModificationChecking =
IOobject::fileCheckTypesNames.read(is);
}
virtual void writeData(Foam::Ostream& os) const
{
os << IOobject::fileCheckTypesNames
[IOobject::fileModificationChecking];
}
};
addfileModificationCheckingToOpt addfileModificationCheckingToOpt_
(
"fileModificationChecking"
);
} }
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
// Return components following the IOobject requirements
//
// behaviour
// input IOobject(instance, local, name)
// ----- ------
// "foo" ("", "", "foo")
// "foo/bar" ("foo", "", "bar")
// "/XXX/bar" ("/XXX", "", "bar")
// "foo/bar/" ERROR - no name
// "foo/xxx/bar" ("foo", "xxx", "bar")
// "foo/xxx/yyy/bar" ("foo", "xxx/yyy", "bar")
bool Foam::IOobject::fileNameComponents bool Foam::IOobject::fileNameComponents
( (
const fileName& path, const fileName& path,
@ -129,6 +205,7 @@ Foam::IOobject::IOobject
rOpt_(ro), rOpt_(ro),
wOpt_(wo), wOpt_(wo),
registerObject_(registerObject), registerObject_(registerObject),
globalObject_(false),
objState_(GOOD) objState_(GOOD)
{ {
if (objectRegistry::debug) if (objectRegistry::debug)
@ -148,7 +225,8 @@ Foam::IOobject::IOobject
const objectRegistry& registry, const objectRegistry& registry,
readOption ro, readOption ro,
writeOption wo, writeOption wo,
bool registerObject bool registerObject,
bool globalObject
) )
: :
name_(name), name_(name),
@ -160,6 +238,7 @@ Foam::IOobject::IOobject
rOpt_(ro), rOpt_(ro),
wOpt_(wo), wOpt_(wo),
registerObject_(registerObject), registerObject_(registerObject),
globalObject_(globalObject),
objState_(GOOD) objState_(GOOD)
{ {
if (objectRegistry::debug) if (objectRegistry::debug)
@ -177,7 +256,8 @@ Foam::IOobject::IOobject
const objectRegistry& registry, const objectRegistry& registry,
readOption ro, readOption ro,
writeOption wo, writeOption wo,
bool registerObject bool registerObject,
bool globalObject
) )
: :
name_(), name_(),
@ -189,6 +269,7 @@ Foam::IOobject::IOobject
rOpt_(ro), rOpt_(ro),
wOpt_(wo), wOpt_(wo),
registerObject_(registerObject), registerObject_(registerObject),
globalObject_(globalObject),
objState_(GOOD) objState_(GOOD)
{ {
if (!fileNameComponents(path, instance_, local_, name_)) if (!fileNameComponents(path, instance_, local_, name_))
@ -207,6 +288,26 @@ Foam::IOobject::IOobject
} }
Foam::IOobject::IOobject
(
const IOobject& io,
const objectRegistry& registry
)
:
name_(io.name_),
headerClassName_(io.headerClassName_),
note_(io.note_),
instance_(io.instance_),
local_(io.local_),
db_(registry),
rOpt_(io.rOpt_),
wOpt_(io.wOpt_),
registerObject_(io.registerObject_),
globalObject_(io.globalObject_),
objState_(io.objState_)
{}
Foam::IOobject::IOobject Foam::IOobject::IOobject
( (
const IOobject& io, const IOobject& io,
@ -222,6 +323,7 @@ Foam::IOobject::IOobject
rOpt_(io.rOpt_), rOpt_(io.rOpt_),
wOpt_(io.wOpt_), wOpt_(io.wOpt_),
registerObject_(io.registerObject_), registerObject_(io.registerObject_),
globalObject_(io.globalObject_),
objState_(io.objState_) objState_(io.objState_)
{} {}
@ -312,11 +414,12 @@ Foam::fileName Foam::IOobject::path
} }
Foam::fileName Foam::IOobject::filePath() const Foam::fileName Foam::IOobject::localFilePath() const
{ {
if (instance().isAbsolute()) if (instance().isAbsolute())
{ {
fileName objectPath = instance()/name(); fileName objectPath = instance()/name();
if (isFile(objectPath)) if (isFile(objectPath))
{ {
return objectPath; return objectPath;
@ -337,25 +440,6 @@ Foam::fileName Foam::IOobject::filePath() const
} }
else else
{ {
if
(
time().processorCase()
&& (
instance() == time().system()
|| instance() == time().constant()
)
)
{
fileName parentObjectPath =
rootPath()/time().globalCaseName()
/instance()/db_.dbDir()/local()/name();
if (isFile(parentObjectPath))
{
return parentObjectPath;
}
}
if (!isDir(path)) if (!isDir(path))
{ {
word newInstancePath = time().findInstancePath word newInstancePath = time().findInstancePath
@ -384,9 +468,107 @@ Foam::fileName Foam::IOobject::filePath() const
} }
Foam::Istream* Foam::IOobject::objectStream() Foam::fileName Foam::IOobject::globalFilePath() const
{ {
return objectStream(filePath()); if (instance().isAbsolute())
{
fileName objectPath = instance()/name();
if (isFile(objectPath))
{
if (objectRegistry::debug)
{
Pout<< "globalFilePath : returning absolute:" << objectPath
<< endl;
}
return objectPath;
}
else
{
if (objectRegistry::debug)
{
Pout<< "globalFilePath : absolute not found:" << objectPath
<< endl;
}
return fileName::null;
}
}
else
{
fileName path = this->path();
fileName objectPath = path/name();
if (isFile(objectPath))
{
if (objectRegistry::debug)
{
Pout<< "globalFilePath : returning time:" << objectPath << endl;
}
return objectPath;
}
else
{
if
(
time().processorCase()
&& (
instance() == time().system()
|| instance() == time().constant()
)
)
{
// Constant & system can come from global case
fileName parentObjectPath =
rootPath()/time().globalCaseName()
/instance()/db().dbDir()/local()/name();
if (isFile(parentObjectPath))
{
if (objectRegistry::debug)
{
Pout<< "globalFilePath : returning parent:"
<< parentObjectPath << endl;
}
return parentObjectPath;
}
}
// Check for approximately same time
if (!isDir(path))
{
word newInstancePath = time().findInstancePath
(
instant(instance())
);
if (newInstancePath.size())
{
fileName fName
(
rootPath()/caseName()
/newInstancePath/db().dbDir()/local()/name()
);
if (isFile(fName))
{
if (objectRegistry::debug)
{
Pout<< "globalFilePath : returning similar time:"
<< fName << endl;
}
return fName;
}
}
}
}
if (objectRegistry::debug)
{
Pout<< "globalFilePath : time not found:" << objectPath << endl;
}
return fileName::null;
}
} }
@ -413,47 +595,6 @@ Foam::Istream* Foam::IOobject::objectStream(const fileName& fName)
} }
bool Foam::IOobject::headerOk()
{
bool ok = true;
Istream* isPtr = objectStream();
// If the stream has failed return
if (!isPtr)
{
if (objectRegistry::debug)
{
Info
<< "IOobject::headerOk() : "
<< "file " << objectPath() << " could not be opened"
<< endl;
}
ok = false;
}
else
{
// Try reading header
if (!readHeader(*isPtr))
{
if (objectRegistry::debug)
{
IOWarningInFunction((*isPtr))
<< "failed to read header of file " << objectPath()
<< endl;
}
ok = false;
}
}
delete isPtr;
return ok;
}
void Foam::IOobject::setBad(const string& s) void Foam::IOobject::setBad(const string& s)
{ {
if (objState_ != GOOD) if (objState_ != GOOD)
@ -482,6 +623,7 @@ void Foam::IOobject::operator=(const IOobject& io)
local_ = io.local_; local_ = io.local_;
rOpt_ = io.rOpt_; rOpt_ = io.rOpt_;
wOpt_ = io.wOpt_; wOpt_ = io.wOpt_;
globalObject_ = io.globalObject_;
objState_ = io.objState_; objState_ = io.objState_;
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -76,6 +76,7 @@ SourceFiles
#include "typeInfo.H" #include "typeInfo.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "InfoProxy.H" #include "InfoProxy.H"
#include "NamedEnum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -119,6 +120,16 @@ public:
NO_WRITE = 1 NO_WRITE = 1
}; };
//- Enumeration defining the file checking options
enum fileCheckTypes
{
timeStamp,
timeStampMaster,
inotify,
inotifyMaster
};
static const NamedEnum<fileCheckTypes, 4> fileCheckTypesNames;
private: private:
@ -151,6 +162,9 @@ private:
//- Register object created from this IOobject with registry if true //- Register object created from this IOobject with registry if true
bool registerObject_; bool registerObject_;
//- Is object same for all processors
bool globalObject_;
//- IOobject state //- IOobject state
objectState objState_; objectState objState_;
@ -159,10 +173,6 @@ protected:
// Protected Member Functions // Protected Member Functions
//- Construct and return an IFstream for the object.
// The results is NULL if the stream construction failed
Istream* objectStream();
//- Construct and return an IFstream for the object given the //- Construct and return an IFstream for the object given the
// exact file. The results is NULL if the stream construction failed // exact file. The results is NULL if the stream construction failed
Istream* objectStream(const fileName&); Istream* objectStream(const fileName&);
@ -180,14 +190,6 @@ public:
// Static Member Functions // Static Member Functions
//- Split path into instance, local, name components //- Split path into instance, local, name components
// input IOobject(instance, local, name)
// ----- ------
// "foo" ("", "", "foo")
// "foo/bar" ("foo", "", "bar")
// "/XXX/bar" ("/XXX", "", "bar")
// "foo/bar/" ERROR - no name
// "foo/xxx/bar" ("foo", "xxx", "bar")
// "foo/xxx/yyy/bar" ("foo", "xxx/yyy", "bar")
static bool fileNameComponents static bool fileNameComponents
( (
const fileName& path, const fileName& path,
@ -199,6 +201,9 @@ public:
template<class Name> template<class Name>
static inline word groupName(Name name, const word& group); static inline word groupName(Name name, const word& group);
//- Type of file modification checking
static fileCheckTypes fileModificationChecking;
// Constructors // Constructors
@ -222,7 +227,8 @@ public:
const objectRegistry& registry, const objectRegistry& registry,
readOption r=NO_READ, readOption r=NO_READ,
writeOption w=NO_WRITE, writeOption w=NO_WRITE,
bool registerObject=true bool registerObject=true,
bool globalObject = false
); );
//- Construct from path, registry, io options //- Construct from path, registry, io options
@ -233,7 +239,15 @@ public:
const objectRegistry& registry, const objectRegistry& registry,
readOption r=NO_READ, readOption r=NO_READ,
writeOption w=NO_WRITE, writeOption w=NO_WRITE,
bool registerObject=true bool registerObject=true,
bool globalObject = false
);
//- Construct as copy resetting registry
IOobject
(
const IOobject& io,
const objectRegistry& registry
); );
//- Construct as copy resetting name //- Construct as copy resetting name
@ -244,11 +258,17 @@ public:
); );
//- Clone //- Clone
Foam::autoPtr<IOobject> clone() const autoPtr<IOobject> clone() const
{ {
return autoPtr<IOobject>(new IOobject(*this)); return autoPtr<IOobject>(new IOobject(*this));
} }
//- Clone resetting registry
autoPtr<IOobject> clone(const objectRegistry& registry) const
{
return autoPtr<IOobject>(new IOobject(*this, registry));
}
//- Destructor //- Destructor
virtual ~IOobject(); virtual ~IOobject();
@ -306,6 +326,18 @@ public:
return registerObject_; return registerObject_;
} }
//- Is object same for all processors
bool& globalObject()
{
return globalObject_;
}
//- Is object same for all processors
bool globalObject() const
{
return globalObject_;
}
// Read/write options // Read/write options
@ -373,9 +405,11 @@ public:
return path()/name(); return path()/name();
} }
//- Return complete path + object name if the file exists //- Helper for filePath that searches locally
// either in the case/processor or case otherwise null fileName localFilePath() const;
fileName filePath() const;
//- Helper for filePath that searches up if in parallel
fileName globalFilePath() const;
// Reading // Reading
@ -383,9 +417,14 @@ public:
//- Read header //- Read header
bool readHeader(Istream&); bool readHeader(Istream&);
//- Read and check header info //- Read header (uses typeFilePath to find file) and check header
bool headerOk(); // info. Optionally checks headerClassName against type
template<class Type>
bool typeHeaderOk(const bool checkType = true);
//- Helper: warn that type does not support re-reading
template<class Type>
void warnNoRereading() const;
// Writing // Writing
@ -442,6 +481,21 @@ template<>
Ostream& operator<<(Ostream& os, const InfoProxy<IOobject>& ip); Ostream& operator<<(Ostream& os, const InfoProxy<IOobject>& ip);
//- Template function for obtaining global status
template<class T>
inline bool typeGlobal()
{
return false;
}
//- Template function for obtaining filePath
template<class T>
inline fileName typeFilePath(const IOobject& io)
{
return (typeGlobal<T>() ? io.globalFilePath() : io.localFilePath());
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam
@ -452,6 +506,12 @@ Ostream& operator<<(Ostream& os, const InfoProxy<IOobject>& ip);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "IOobjectTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -36,6 +36,9 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const InfoProxy<IOobject>& ip)
os << "IOobject: " os << "IOobject: "
<< io.type() << token::SPACE << io.type() << token::SPACE
<< io.name() << token::SPACE << io.name() << token::SPACE
<< "readOpt:" << token::SPACE << io.readOpt() << token::SPACE
<< "writeOpt:" << token::SPACE << io.writeOpt() << token::SPACE
<< "globalObject:" << token::SPACE << io.globalObject() << token::SPACE
<< io.path() << endl; << io.path() << endl;
return os; return os;

View File

@ -0,0 +1,120 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "IOobject.H"
#include "Istream.H"
#include "IOstreams.H"
#include "Pstream.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
bool Foam::IOobject::typeHeaderOk(const bool checkType)
{
bool ok = true;
// Everyone check or just master
bool masterOnly =
typeGlobal<Type>()
&& (
IOobject::fileModificationChecking == timeStampMaster
|| IOobject::fileModificationChecking == inotifyMaster
);
// Determine local status
if (!masterOnly || Pstream::master())
{
Istream* isPtr = objectStream(typeFilePath<Type>(*this));
// If the stream has failed return
if (!isPtr)
{
if (IOobject::debug)
{
InfoInFunction
<< "file " << objectPath() << " could not be opened"
<< endl;
}
ok = false;
}
else
{
// Try reading header
if (readHeader(*isPtr))
{
if (checkType && headerClassName_ != Type::typeName)
{
IOWarningInFunction(*isPtr)
<< "unexpected class name " << headerClassName_
<< " expected " << Type::typeName << endl;
ok = false;
}
}
else
{
if (IOobject::debug)
{
IOWarningInFunction(*isPtr)
<< "failed to read header of file " << objectPath()
<< endl;
}
ok = false;
}
}
delete isPtr;
}
// If masterOnly make sure all processors know about it
if (masterOnly)
{
Pstream::scatter(ok);
}
return ok;
}
template<class Type>
void Foam::IOobject::warnNoRereading() const
{
if (readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningInFunction
<< Type::typeName << ' ' << name()
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
" but " << Type::typeName
<< " does not support automatic rereading."
<< endl;
}
}
// ************************************************************************* //

View File

@ -26,7 +26,7 @@ License
#include "IOobjectList.H" #include "IOobjectList.H"
#include "Time.H" #include "Time.H"
#include "OSspecific.H" #include "OSspecific.H"
#include "IOList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -77,7 +77,8 @@ Foam::IOobjectList::IOobjectList
registerObject registerObject
); );
if (objectPtr->headerOk()) // Use object with local scope
if (objectPtr->typeHeaderOk<IOList<label> >(false))
{ {
insert(ObjectNames[i], objectPtr); insert(ObjectNames[i], objectPtr);
} }

View File

@ -0,0 +1,134 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "GlobalIOField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::GlobalIOField<Type>::GlobalIOField(const IOobject& io)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<GlobalIOField<Type> >();
readHeaderOk(IOstream::BINARY, typeName);
}
template<class Type>
Foam::GlobalIOField<Type>::GlobalIOField(const IOobject& io, const label size)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<GlobalIOField<Type> >();
if (!readHeaderOk(IOstream::BINARY, typeName))
{
Field<Type>::setSize(size);
}
}
template<class Type>
Foam::GlobalIOField<Type>::GlobalIOField
(
const IOobject& io,
const Field<Type>& f
)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<GlobalIOField<Type> >();
if (!readHeaderOk(IOstream::BINARY, typeName))
{
Field<Type>::operator=(f);
}
}
template<class Type>
Foam::GlobalIOField<Type>::GlobalIOField
(
const IOobject& io,
const Xfer<Field<Type> >& f
)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<GlobalIOField<Type> >();
Field<Type>::transfer(f());
readHeaderOk(IOstream::BINARY, typeName);
}
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class Type>
Foam::GlobalIOField<Type>::~GlobalIOField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
bool Foam::GlobalIOField<Type>::readData(Istream& is)
{
is >> *this;
return is.good();
}
template<class Type>
bool Foam::GlobalIOField<Type>::writeData(Ostream& os) const
{
return (os << static_cast<const Field<Type>&>(*this)).good();
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>
void Foam::GlobalIOField<Type>::operator=(const GlobalIOField<Type>& rhs)
{
Field<Type>::operator=(rhs);
}
template<class Type>
void Foam::GlobalIOField<Type>::operator=(const Field<Type>& rhs)
{
Field<Type>::operator=(rhs);
}
// ************************************************************************* //

View File

@ -0,0 +1,125 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::GlobalIOField
Description
IOField with global data (so optionally read from master)
SourceFiles
GlobalIOField.C
\*---------------------------------------------------------------------------*/
#ifndef GlobalIOField_H
#define GlobalIOField_H
#include "regIOobject.H"
#include "Field.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class GlobalIOField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class GlobalIOField
:
public regIOobject,
public Field<Type>
{
public:
TypeName("Field");
// Constructors
//- Construct from IOobject
GlobalIOField(const IOobject&);
//- Construct from IOobject and size (does not set values)
GlobalIOField(const IOobject&, const label size);
//- Construct from components
GlobalIOField(const IOobject&, const Field<Type>&);
//- Construct by transferring the Field contents
GlobalIOField(const IOobject&, const Xfer<Field<Type> >&);
//- Destructor
virtual ~GlobalIOField();
// Member functions
//- Is object global
virtual bool global() const
{
return true;
}
//- Return complete path + object name if the file exists
// either in the case/processor or case otherwise null
virtual fileName filePath() const
{
return globalFilePath();
}
//- ReadData function required for regIOobject read operation
virtual bool readData(Istream&);
//- WriteData function required for regIOobject write operation
bool writeData(Ostream&) const;
// Member operators
void operator=(const GlobalIOField<Type>&);
void operator=(const Field<Type>&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "GlobalIOField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,130 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "GlobalIOList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::GlobalIOList<Type>::GlobalIOList(const IOobject& io)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<GlobalIOList<Type> >();
readHeaderOk(IOstream::BINARY, typeName);
}
template<class Type>
Foam::GlobalIOList<Type>::GlobalIOList(const IOobject& io, const label size)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<GlobalIOList<Type> >();
if (!readHeaderOk(IOstream::BINARY, typeName))
{
List<Type>::setSize(size);
}
}
template<class Type>
Foam::GlobalIOList<Type>::GlobalIOList(const IOobject& io, const List<Type>& f)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<GlobalIOList<Type> >();
if (!readHeaderOk(IOstream::BINARY, typeName))
{
List<Type>::operator=(f);
}
}
template<class Type>
Foam::GlobalIOList<Type>::GlobalIOList
(
const IOobject& io,
const Xfer<List<Type> >& f
)
:
regIOobject(io)
{
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<GlobalIOList<Type> >();
List<Type>::transfer(f());
readHeaderOk(IOstream::BINARY, typeName);
}
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class Type>
Foam::GlobalIOList<Type>::~GlobalIOList()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
bool Foam::GlobalIOList<Type>::readData(Istream& is)
{
is >> *this;
return is.good();
}
template<class Type>
bool Foam::GlobalIOList<Type>::writeData(Ostream& os) const
{
return (os << *this).good();
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>
void Foam::GlobalIOList<Type>::operator=(const GlobalIOList<Type>& rhs)
{
List<Type>::operator=(rhs);
}
template<class Type>
void Foam::GlobalIOList<Type>::operator=(const List<Type>& rhs)
{
List<Type>::operator=(rhs);
}
// ************************************************************************* //

Some files were not shown because too many files have changed in this diff Show More