typeIOobject: Template typed form of IOobject for type-checked object file and header reading
used to check the existence of and open an object file, read and check the header without constructing the object. 'typeIOobject' operates in an equivalent and consistent manner to 'regIOobject' but the type information is provided by the template argument rather than via virtual functions for which the derived object would need to be constructed, which is the case for 'regIOobject'. 'typeIOobject' replaces the previous separate functions 'typeHeaderOk' and 'typeFilePath' with a single consistent interface.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
IOobject phiBHeader
|
||||
typeIOobject<surfaceScalarField> phiBHeader
|
||||
(
|
||||
"phiB",
|
||||
runTime.timeName(),
|
||||
@ -9,7 +9,7 @@ IOobject phiBHeader
|
||||
|
||||
surfaceScalarField* phiBPtr = nullptr;
|
||||
|
||||
if (phiBHeader.typeHeaderOk<surfaceScalarField>(true))
|
||||
if (phiBHeader.headerOk())
|
||||
{
|
||||
Info<< "Reading face flux ";
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ volScalarField mu
|
||||
Info<< "Constructing clouds" << endl;
|
||||
parcelCloudList clouds(rhoInf, U, mu, g);
|
||||
|
||||
IOobject Hheader
|
||||
typeIOobject<volVectorField> Hheader
|
||||
(
|
||||
"H",
|
||||
runTime.timeName(),
|
||||
@ -67,14 +67,14 @@ IOobject Hheader
|
||||
|
||||
autoPtr<volVectorField> HPtr;
|
||||
|
||||
if (Hheader.typeHeaderOk<volVectorField>(true))
|
||||
if (Hheader.headerOk())
|
||||
{
|
||||
Info<< "\nReading field H\n" << endl;
|
||||
|
||||
HPtr.reset(new volVectorField (Hheader, mesh));
|
||||
}
|
||||
|
||||
IOobject HdotGradHheader
|
||||
typeIOobject<volVectorField> HdotGradHheader
|
||||
(
|
||||
"HdotGradH",
|
||||
runTime.timeName(),
|
||||
@ -85,7 +85,7 @@ IOobject HdotGradHheader
|
||||
|
||||
autoPtr<volVectorField> HdotGradHPtr;
|
||||
|
||||
if (HdotGradHheader.typeHeaderOk<volVectorField>(true))
|
||||
if (HdotGradHheader.headerOk())
|
||||
{
|
||||
Info<< "Reading field HdotGradH" << endl;
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Info<< "Reading non-inertial frame fields" << endl;
|
||||
|
||||
IOobject linearAccelerationHeader
|
||||
typeIOobject<uniformDimensionedVectorField> linearAccelerationHeader
|
||||
(
|
||||
"linearAcceleration",
|
||||
runTime.timeName(),
|
||||
@ -11,13 +11,7 @@
|
||||
|
||||
autoPtr<uniformDimensionedVectorField> linearAccelerationPtr;
|
||||
|
||||
if
|
||||
(
|
||||
linearAccelerationHeader.typeHeaderOk<uniformDimensionedVectorField>
|
||||
(
|
||||
true
|
||||
)
|
||||
)
|
||||
if (linearAccelerationHeader.headerOk())
|
||||
{
|
||||
Info<< " Reading " << linearAccelerationHeader.name() << endl;
|
||||
|
||||
@ -28,7 +22,7 @@
|
||||
}
|
||||
|
||||
|
||||
IOobject angularVelocityHeader
|
||||
typeIOobject<uniformDimensionedVectorField> angularVelocityHeader
|
||||
(
|
||||
"angularVelocity",
|
||||
runTime.timeName(),
|
||||
@ -39,7 +33,7 @@
|
||||
|
||||
autoPtr<uniformDimensionedVectorField> angularVelocityPtr;
|
||||
|
||||
if (angularVelocityHeader.typeHeaderOk<uniformDimensionedVectorField>(true))
|
||||
if (angularVelocityHeader.headerOk())
|
||||
{
|
||||
Info<< " Reading " << angularVelocityHeader.name() << endl;
|
||||
|
||||
@ -50,7 +44,7 @@
|
||||
}
|
||||
|
||||
|
||||
IOobject angularAccelerationHeader
|
||||
typeIOobject<uniformDimensionedVectorField> angularAccelerationHeader
|
||||
(
|
||||
"angularAcceleration",
|
||||
runTime.timeName(),
|
||||
@ -61,13 +55,7 @@
|
||||
|
||||
autoPtr<uniformDimensionedVectorField> angularAccelerationPtr;
|
||||
|
||||
if
|
||||
(
|
||||
angularAccelerationHeader.typeHeaderOk<uniformDimensionedVectorField>
|
||||
(
|
||||
true
|
||||
)
|
||||
)
|
||||
if (angularAccelerationHeader.headerOk())
|
||||
{
|
||||
Info<< " Reading " << angularAccelerationHeader.name() << endl;
|
||||
|
||||
@ -78,7 +66,7 @@
|
||||
}
|
||||
|
||||
|
||||
IOobject centreOfRotationHeader
|
||||
typeIOobject<uniformDimensionedVectorField> centreOfRotationHeader
|
||||
(
|
||||
"centreOfRotation",
|
||||
runTime.timeName(),
|
||||
@ -89,13 +77,7 @@
|
||||
|
||||
autoPtr<uniformDimensionedVectorField> centreOfRotationPtr;
|
||||
|
||||
if
|
||||
(
|
||||
centreOfRotationHeader.typeHeaderOk<uniformDimensionedVectorField>
|
||||
(
|
||||
true
|
||||
)
|
||||
)
|
||||
if (centreOfRotationHeader.headerOk())
|
||||
{
|
||||
Info<< " Reading " << centreOfRotationHeader.name() << endl;
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ Foam::IOobject Foam::twoPhaseChangeModel::createIOobject
|
||||
const compressibleTwoPhaseMixture& mixture
|
||||
) const
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<IOdictionary> io
|
||||
(
|
||||
phaseChangePropertiesName,
|
||||
mixture.alpha1().mesh().time().constant(),
|
||||
@ -55,7 +55,7 @@ Foam::IOobject Foam::twoPhaseChangeModel::createIOobject
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (io.typeHeaderOk<IOdictionary>(true))
|
||||
if (io.headerOk())
|
||||
{
|
||||
io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
|
||||
return io;
|
||||
|
||||
@ -32,7 +32,7 @@ Foam::autoPtr<Foam::twoPhaseChangeModel> Foam::twoPhaseChangeModel::New
|
||||
const compressibleTwoPhaseMixture& mixture
|
||||
)
|
||||
{
|
||||
IOobject twoPhaseChangeModelIO
|
||||
typeIOobject<IOdictionary> twoPhaseChangeModelIO
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -47,7 +47,7 @@ Foam::autoPtr<Foam::twoPhaseChangeModel> Foam::twoPhaseChangeModel::New
|
||||
|
||||
word modelType(twoPhaseChangeModels::noPhaseChange::typeName);
|
||||
|
||||
if (twoPhaseChangeModelIO.typeHeaderOk<IOdictionary>(false))
|
||||
if (twoPhaseChangeModelIO.headerOk())
|
||||
{
|
||||
IOdictionary(twoPhaseChangeModelIO).lookup
|
||||
(
|
||||
|
||||
@ -44,7 +44,7 @@ Foam::MovingPhaseModel<BasePhaseModel>::phi(const volVectorField& U) const
|
||||
{
|
||||
word phiName(IOobject::groupName("phi", this->name()));
|
||||
|
||||
IOobject phiHeader
|
||||
typeIOobject<surfaceScalarField> phiHeader
|
||||
(
|
||||
phiName,
|
||||
U.mesh().time().timeName(),
|
||||
@ -52,7 +52,7 @@ Foam::MovingPhaseModel<BasePhaseModel>::phi(const volVectorField& U) const
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
if (phiHeader.typeHeaderOk<surfaceScalarField>(true))
|
||||
if (phiHeader.headerOk())
|
||||
{
|
||||
Info<< "Reading face flux field " << phiName << endl;
|
||||
|
||||
|
||||
@ -639,7 +639,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Checking for motionProperties\n" << endl;
|
||||
|
||||
IOobject motionObj
|
||||
typeIOobject<IOdictionary> motionObj
|
||||
(
|
||||
"motionProperties",
|
||||
runTime.constant(),
|
||||
@ -651,7 +651,7 @@ int main(int argc, char *argv[])
|
||||
// corrector for mesh motion
|
||||
twoDPointCorrector* correct2DPtr = nullptr;
|
||||
|
||||
if (motionObj.typeHeaderOk<IOdictionary>(true))
|
||||
if (motionObj.headerOk())
|
||||
{
|
||||
Info<< "Reading " << runTime.constant() / "motionProperties"
|
||||
<< endl << endl;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -230,7 +230,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Refinement level
|
||||
IOobject refHeader
|
||||
typeIOobject<labelIOList> refHeader
|
||||
(
|
||||
"refinementLevel",
|
||||
runTime.timeName(),
|
||||
@ -238,7 +238,7 @@ int main(int argc, char *argv[])
|
||||
runTime
|
||||
);
|
||||
|
||||
if (!readLevel && refHeader.typeHeaderOk<labelIOList>(true))
|
||||
if (!readLevel && refHeader.headerOk())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Detected " << refHeader.name() << " file in "
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -74,7 +74,7 @@ Foam::edgeStats::edgeStats(const polyMesh& mesh)
|
||||
mesh_(mesh),
|
||||
normalDir_(3)
|
||||
{
|
||||
IOobject motionObj
|
||||
typeIOobject<IOdictionary> motionObj
|
||||
(
|
||||
"motionProperties",
|
||||
mesh.time().constant(),
|
||||
@ -83,7 +83,7 @@ Foam::edgeStats::edgeStats(const polyMesh& mesh)
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (motionObj.typeHeaderOk<IOdictionary>(true))
|
||||
if (motionObj.headerOk())
|
||||
{
|
||||
Info<< "Reading " << mesh.time().constant() / "motionProperties"
|
||||
<< endl << endl;
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
&& runTime.timeName() != "0"
|
||||
)
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<IOdictionary> io
|
||||
(
|
||||
"time",
|
||||
runTime.timeName(),
|
||||
@ -19,7 +19,7 @@
|
||||
false
|
||||
);
|
||||
|
||||
if (io.typeHeaderOk<IOdictionary>(true))
|
||||
if (io.headerOk())
|
||||
{
|
||||
IOdictionary timeObject
|
||||
(
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
&& runTime.timeName() != "0"
|
||||
)
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<IOdictionary> io
|
||||
(
|
||||
"time",
|
||||
runTime.timeName(),
|
||||
@ -19,7 +19,7 @@
|
||||
false
|
||||
);
|
||||
|
||||
if (io.typeHeaderOk<IOdictionary>(true))
|
||||
if (io.headerOk())
|
||||
{
|
||||
IOdictionary timeObject
|
||||
(
|
||||
|
||||
@ -149,9 +149,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
IOobject meshDictIO(systemDictIO(dictName, args, runTime, regionName));
|
||||
typeIOobject<IOdictionary> meshDictIO
|
||||
(
|
||||
systemDictIO(dictName, args, runTime, regionName)
|
||||
);
|
||||
|
||||
if (!meshDictIO.typeHeaderOk<IOdictionary>(true))
|
||||
if (!meshDictIO.headerOk())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find file " << meshDictIO.relativeObjectPath()
|
||||
|
||||
@ -84,7 +84,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
|
||||
{
|
||||
// Create dummy system/fv*
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<IOdictionary> io
|
||||
(
|
||||
"fvSchemes",
|
||||
mesh.time().system(),
|
||||
@ -95,9 +95,9 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
|
||||
false
|
||||
);
|
||||
|
||||
Info<< "Testing:" << io.objectPath<IOdictionary>() << endl;
|
||||
Info<< "Testing:" << io.objectPath() << endl;
|
||||
|
||||
if (!io.typeHeaderOk<IOdictionary>(false))
|
||||
if (!io.headerOk())
|
||||
{
|
||||
Info<< "Writing dummy " << regionName/io.name() << endl;
|
||||
dictionary dummyDict;
|
||||
@ -112,7 +112,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
|
||||
}
|
||||
}
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<IOdictionary> io
|
||||
(
|
||||
"fvSolution",
|
||||
mesh.time().system(),
|
||||
@ -123,7 +123,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
|
||||
false
|
||||
);
|
||||
|
||||
if (!io.typeHeaderOk<IOdictionary>(false))
|
||||
if (!io.headerOk())
|
||||
{
|
||||
Info<< "Writing dummy " << regionName/io.name() << endl;
|
||||
dictionary dummyDict;
|
||||
|
||||
@ -342,7 +342,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
|
||||
{
|
||||
// Create dummy system/fv*
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<IOdictionary> io
|
||||
(
|
||||
"fvSchemes",
|
||||
mesh.time().system(),
|
||||
@ -353,9 +353,9 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
|
||||
false
|
||||
);
|
||||
|
||||
Info<< "Testing:" << io.objectPath<IOdictionary>() << endl;
|
||||
Info<< "Testing:" << io.objectPath() << endl;
|
||||
|
||||
if (!io.typeHeaderOk<IOdictionary>(true))
|
||||
if (!io.headerOk())
|
||||
{
|
||||
Info<< "Writing dummy " << regionName/io.name() << endl;
|
||||
dictionary dummyDict;
|
||||
@ -370,7 +370,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
|
||||
}
|
||||
}
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<IOdictionary> io
|
||||
(
|
||||
"fvSolution",
|
||||
mesh.time().system(),
|
||||
@ -381,7 +381,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
|
||||
false
|
||||
);
|
||||
|
||||
if (!io.typeHeaderOk<IOdictionary>(true))
|
||||
if (!io.headerOk())
|
||||
{
|
||||
Info<< "Writing dummy " << regionName/io.name() << endl;
|
||||
dictionary dummyDict;
|
||||
@ -2492,7 +2492,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
autoPtr<pointIOField> patchFaceCentresPtr;
|
||||
|
||||
IOobject io
|
||||
typeIOobject<pointIOField> io
|
||||
(
|
||||
"patchFaceCentres",
|
||||
mesh.pointsInstance(),
|
||||
@ -2500,7 +2500,8 @@ int main(int argc, char *argv[])
|
||||
mesh,
|
||||
IOobject::MUST_READ
|
||||
);
|
||||
if (io.typeHeaderOk<pointIOField>(true))
|
||||
|
||||
if (io.headerOk())
|
||||
{
|
||||
// Read patchFaceCentres and patchEdgeCentres
|
||||
Info<< "Reading patch face,edge centres : "
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -65,7 +65,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
IOobject Uheader
|
||||
typeIOobject<volVectorField> Uheader
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
@ -74,7 +74,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
// Check U exists
|
||||
if (Uheader.typeHeaderOk<volVectorField>(true))
|
||||
if (Uheader.headerOk())
|
||||
{
|
||||
Info<< " Reading U" << endl;
|
||||
volVectorField U(Uheader, mesh);
|
||||
|
||||
@ -189,11 +189,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Dictionary to control refinement
|
||||
const word dictName("refineMeshDict");
|
||||
IOobject dictIO(systemDictIO(dictName, args, runTime));
|
||||
typeIOobject<IOdictionary> dictIO(systemDictIO(dictName, args, runTime));
|
||||
dictionary refineDict;
|
||||
if (readDict)
|
||||
{
|
||||
if (dictIO.typeHeaderOk<IOdictionary>(true))
|
||||
if (dictIO.headerOk())
|
||||
{
|
||||
Info<< "Refining according to "
|
||||
<< dictIO.path(typeGlobalFile<IOdictionary>()) << nl << endl;
|
||||
@ -209,7 +209,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if (!refineAllCells)
|
||||
{
|
||||
if (dictIO.typeHeaderOk<IOdictionary>(true))
|
||||
if (dictIO.headerOk())
|
||||
{
|
||||
Info<< "Refining according to "
|
||||
<< dictIO.path(typeGlobalFile<IOdictionary>()) << nl << endl;
|
||||
|
||||
@ -575,7 +575,7 @@ autoPtr<mapPolyMesh> createRegionMesh
|
||||
{
|
||||
// Create dummy system/fv*
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<IOdictionary> io
|
||||
(
|
||||
"fvSchemes",
|
||||
mesh.time().system(),
|
||||
@ -586,9 +586,9 @@ autoPtr<mapPolyMesh> createRegionMesh
|
||||
false
|
||||
);
|
||||
|
||||
Info<< "Testing:" << io.objectPath<IOdictionary>() << endl;
|
||||
Info<< "Testing:" << io.objectPath() << endl;
|
||||
|
||||
if (!io.typeHeaderOk<IOdictionary>(true))
|
||||
if (!io.headerOk())
|
||||
{
|
||||
Info<< "Writing dummy " << regionName/io.name() << endl;
|
||||
dictionary dummyDict;
|
||||
@ -603,7 +603,7 @@ autoPtr<mapPolyMesh> createRegionMesh
|
||||
}
|
||||
}
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<IOdictionary> io
|
||||
(
|
||||
"fvSolution",
|
||||
mesh.time().system(),
|
||||
@ -614,8 +614,7 @@ autoPtr<mapPolyMesh> createRegionMesh
|
||||
false
|
||||
);
|
||||
|
||||
if (!io.typeHeaderOk<IOdictionary>(true))
|
||||
// if (!exists(io.objectPath()))
|
||||
if (!io.headerOk())
|
||||
{
|
||||
Info<< "Writing dummy " << regionName/io.name() << endl;
|
||||
dictionary dummyDict;
|
||||
|
||||
@ -2,4 +2,5 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools
|
||||
|
||||
@ -89,7 +89,7 @@ bool writeZones(const word& name, const fileName& meshDir, Time& runTime)
|
||||
|
||||
bool writeOk = false;
|
||||
|
||||
if (io.typeHeaderOk<meshCellZones>(false))
|
||||
if (io.headerOk())
|
||||
{
|
||||
Info<< " Reading " << io.headerClassName()
|
||||
<< " : " << name << endl;
|
||||
@ -199,7 +199,7 @@ bool writeOptionalMeshObject
|
||||
|
||||
bool writeOk = false;
|
||||
|
||||
bool haveFile = io.typeHeaderOk<IOField<label>>(false);
|
||||
bool haveFile = io.headerOk();
|
||||
|
||||
// Make sure all know if there is a valid class name
|
||||
stringList classNames(1, io.headerClassName());
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -48,7 +48,7 @@ inline bool writeMeshObject
|
||||
bool disableHeaderChecking = false
|
||||
)
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<CheckType> io
|
||||
(
|
||||
name,
|
||||
runTime.timeName(),
|
||||
@ -61,11 +61,7 @@ inline bool writeMeshObject
|
||||
|
||||
bool writeOk = false;
|
||||
|
||||
if
|
||||
(
|
||||
io.typeHeaderOk<Type>(false)
|
||||
&& io.headerClassName() == CheckType::typeName
|
||||
)
|
||||
if (io.headerOk())
|
||||
{
|
||||
Info<< " Reading " << io.headerClassName()
|
||||
<< " : " << name << endl;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -106,7 +106,7 @@ int main(int argc, char *argv[])
|
||||
IOobject::MUST_READ
|
||||
);
|
||||
|
||||
if (obj.typeHeaderOk<volScalarField>(false))
|
||||
if (obj.headerOk())
|
||||
{
|
||||
addToFieldList(vsf, obj, objI, mesh);
|
||||
addToFieldList(vvf, obj, objI, mesh);
|
||||
|
||||
@ -382,7 +382,7 @@ int main(int argc, char *argv[])
|
||||
label nProcs = fileHandler().nProcs(runTime.path(), regionDir);
|
||||
|
||||
// Get the dictionary IO
|
||||
const IOobject dictIO
|
||||
const typeIOobject<IOdictionary> dictIO
|
||||
(
|
||||
systemDictIO(dictName, args, runTime, regionName)
|
||||
);
|
||||
@ -432,13 +432,13 @@ int main(int argc, char *argv[])
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
dictIO.objectPath<domainDecomposition>()
|
||||
dictIO.objectPath()
|
||||
);
|
||||
|
||||
// Decompose the mesh
|
||||
if (!decomposeFieldsOnly)
|
||||
{
|
||||
mesh.decomposeMesh(dictIO.objectPath<domainDecomposition>());
|
||||
mesh.decomposeMesh(dictIO.objectPath());
|
||||
|
||||
mesh.writeDecomposition(decomposeSets);
|
||||
|
||||
|
||||
@ -331,9 +331,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Problem: faceCompactIOList recognises both 'faceList' and
|
||||
// 'faceCompactList' so we should be lenient when doing
|
||||
// typeHeaderOk
|
||||
if (!facesIO.typeHeaderOk<faceCompactIOList>(false))
|
||||
// 'faceCompactList' so we cannot check the type
|
||||
if (!facesIO.headerOk())
|
||||
{
|
||||
Info<< "No mesh." << nl << endl;
|
||||
continue;
|
||||
|
||||
@ -16,6 +16,6 @@ for (label n1=0; n1<Times.size() && variableGood; ++n1)
|
||||
Times[n1].name(),
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
).typeHeaderOk<volScalarField>(false);
|
||||
).headerOk();
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ if (Times.size() > 1)
|
||||
{
|
||||
if (Times[timeI].name() != mesh.pointsInstance())
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<pointIOField> io
|
||||
(
|
||||
"points",
|
||||
Times[timeI].name(),
|
||||
@ -17,7 +17,8 @@ if (Times.size() > 1)
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
);
|
||||
if (io.typeHeaderOk<pointIOField>(true))
|
||||
|
||||
if (io.headerOk())
|
||||
{
|
||||
meshMoving = true;
|
||||
break;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -584,10 +584,8 @@ int main(int argc, char *argv[])
|
||||
IOobject::MUST_READ
|
||||
);
|
||||
|
||||
bool fieldExists = fieldObject.typeHeaderOk<IOField<scalar>>
|
||||
(
|
||||
false
|
||||
);
|
||||
bool fieldExists = fieldObject.headerOk();
|
||||
|
||||
if (fieldType == scalarIOField::typeName)
|
||||
{
|
||||
ensightCloudField<scalar>
|
||||
|
||||
@ -6,13 +6,13 @@ if (timeDirs.size() > 1)
|
||||
hasMovingMesh = true;
|
||||
for (label i=0; i < timeDirs.size() && hasMovingMesh; ++i)
|
||||
{
|
||||
hasMovingMesh = IOobject
|
||||
hasMovingMesh = typeIOobject<pointIOField>
|
||||
(
|
||||
"points",
|
||||
timeDirs[i].name(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
).typeHeaderOk<pointIOField>(true);
|
||||
).headerOk();
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
&& runTime.timeName() != "0"
|
||||
)
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<IOdictionary> io
|
||||
(
|
||||
"time",
|
||||
runTime.timeName(),
|
||||
@ -24,7 +24,7 @@
|
||||
false
|
||||
);
|
||||
|
||||
if (io.typeHeaderOk<IOdictionary>(true))
|
||||
if (io.headerOk())
|
||||
{
|
||||
io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
|
||||
IOdictionary timeObject(io);
|
||||
@ -34,7 +34,7 @@
|
||||
else
|
||||
{
|
||||
Info<< "skip ... missing entry "
|
||||
<< io.objectPath<IOdictionary>() << endl;
|
||||
<< io.objectPath() << endl;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<pointIOField> io
|
||||
(
|
||||
"points",
|
||||
runTime.timeName(),
|
||||
@ -7,7 +7,7 @@
|
||||
mesh
|
||||
);
|
||||
|
||||
if (io.typeHeaderOk<pointIOField>(true))
|
||||
if (io.headerOk())
|
||||
{
|
||||
// Read new points
|
||||
io.readOpt() = IOobject::MUST_READ;
|
||||
|
||||
@ -71,13 +71,7 @@ for (label i=0; i < nTypes; i++)
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
lagrangianHeader.typeHeaderOk<IOPosition<Cloud<passiveParticle>>>
|
||||
(
|
||||
false
|
||||
)
|
||||
)
|
||||
if (lagrangianHeader.headerOk())
|
||||
{
|
||||
Cloud<passiveParticle> particles(mesh, cloud::defaultName);
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
IOobject ioPoints
|
||||
typeIOobject<pointIOField> ioPoints
|
||||
(
|
||||
"points",
|
||||
runTime.timeName(),
|
||||
@ -6,7 +6,7 @@ IOobject ioPoints
|
||||
mesh
|
||||
);
|
||||
|
||||
if (ioPoints.typeHeaderOk<pointIOField>(true))
|
||||
if (ioPoints.headerOk())
|
||||
{
|
||||
Info<< "new points available" << endl;
|
||||
// Reading new points
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -586,13 +586,13 @@ double* Foam::vtkPVFoam::findTimes(int& nTimeSteps)
|
||||
|
||||
if
|
||||
(
|
||||
IOobject
|
||||
typeIOobject<pointIOField>
|
||||
(
|
||||
"points",
|
||||
timeName,
|
||||
meshDir_,
|
||||
runTime
|
||||
).typeHeaderOk<pointIOField>(true)
|
||||
).headerOk()
|
||||
)
|
||||
{
|
||||
break;
|
||||
|
||||
@ -120,7 +120,7 @@ void Foam::vtkPVFoam::convertFields(vtkMultiBlockDataSet* output)
|
||||
forAllConstIter(IOobjectList, objects, iter)
|
||||
{
|
||||
Info<< " " << iter()->name()
|
||||
<< " == " << iter()->objectPath<volScalarField>() << nl;
|
||||
<< " == " << iter()->objectPath(false) << nl;
|
||||
}
|
||||
printMemory();
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ Foam::wordList Foam::vtkPVFoam::getZoneNames(const word& zoneType) const
|
||||
false
|
||||
);
|
||||
|
||||
if (ioObj.typeHeaderOk<meshCellZones>(false))
|
||||
if (ioObj.headerOk())
|
||||
{
|
||||
zonesEntries zones(ioObj);
|
||||
|
||||
@ -321,7 +321,7 @@ void Foam::vtkPVFoam::updateInfoPatches
|
||||
{
|
||||
// Mesh not loaded - read from file
|
||||
// but this could fail if we've supplied a bad region name
|
||||
IOobject ioObj
|
||||
typeIOobject<polyBoundaryMesh> ioObj
|
||||
(
|
||||
"boundary",
|
||||
dbPtr_().findInstance
|
||||
@ -338,7 +338,7 @@ void Foam::vtkPVFoam::updateInfoPatches
|
||||
);
|
||||
|
||||
// This should only ever fail if the mesh region doesn't exist
|
||||
if (ioObj.typeHeaderOk<polyBoundaryMesh>(true))
|
||||
if (ioObj.headerOk())
|
||||
{
|
||||
polyBoundaryMeshEntries patchEntries(ioObj);
|
||||
|
||||
|
||||
@ -171,7 +171,7 @@ int USERD_set_filenames
|
||||
false
|
||||
);
|
||||
|
||||
if (sprayHeader.typeHeaderOk<Cloud<passiveParticle>>(false))
|
||||
if (sprayHeader.headerOk())
|
||||
{
|
||||
Info<< "[Found lagrangian]" << endl;
|
||||
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
|
||||
if (nVar >= Num_variables - nSprayVariables)
|
||||
{
|
||||
return Z_UNDEF;
|
||||
}
|
||||
|
||||
IOobject fieldObjectPtr
|
||||
typeIOobject<volScalarField> fieldObjectPtr
|
||||
(
|
||||
fieldNames[var2field[nVar]],
|
||||
runTime.timeName(),
|
||||
@ -12,7 +11,7 @@ IOobject fieldObjectPtr
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
if (!fieldObjectPtr.typeHeaderOk<volScalarField>(true))
|
||||
if (!fieldObjectPtr.headerOk())
|
||||
{
|
||||
return Z_UNDEF;
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ if (nVar >= Num_variables - nSprayVariables)
|
||||
}
|
||||
|
||||
|
||||
IOobject fieldObjectPtr
|
||||
typeIOobject<volTensorField> fieldObjectPtr
|
||||
(
|
||||
fieldNames[var2field[nVar]],
|
||||
runTime.timeName(),
|
||||
@ -12,7 +12,7 @@ IOobject fieldObjectPtr
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
if (!fieldObjectPtr.typeHeaderOk<volTensorField>(true))
|
||||
if (!fieldObjectPtr.headerOk())
|
||||
{
|
||||
return Z_UNDEF;
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ if (nVar >= Num_variables - nSprayVariables)
|
||||
}
|
||||
|
||||
|
||||
IOobject fieldObjectPtr
|
||||
typeIOobject<volVectorField> fieldObjectPtr
|
||||
(
|
||||
fieldNames[var2field[nVar]],
|
||||
runTime.timeName(),
|
||||
@ -12,7 +12,7 @@ IOobject fieldObjectPtr
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
if (!fieldObjectPtr.typeHeaderOk<volVectorField>(true))
|
||||
if (!fieldObjectPtr.headerOk())
|
||||
{
|
||||
return Z_UNDEF;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ if (nVar >= Num_variables - nSprayVariables)
|
||||
return Z_UNDEF;
|
||||
}
|
||||
|
||||
IOobject fieldObjectPtr
|
||||
typeIOobject<volScalarField> fieldObjectPtr
|
||||
(
|
||||
fieldNames[var2field[nVar]],
|
||||
runTime.timeName(),
|
||||
@ -13,7 +13,7 @@ IOobject fieldObjectPtr
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
if (!fieldObjectPtr.typeHeaderOk<volScalarField>(true))
|
||||
if (!fieldObjectPtr.headerOk())
|
||||
{
|
||||
return Z_UNDEF;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ if (nVar >= Num_variables - nSprayVariables)
|
||||
return Z_UNDEF;
|
||||
}
|
||||
|
||||
IOobject fieldObjectPtr
|
||||
typeIOobject<volTensorField> fieldObjectPtr
|
||||
(
|
||||
fieldNames[var2field[nVar]],
|
||||
runTime.timeName(),
|
||||
@ -13,7 +13,7 @@ IOobject fieldObjectPtr
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
if (!fieldObjectPtr.typeHeaderOk<volTensorField>(true))
|
||||
if (!fieldObjectPtr.headerOk())
|
||||
{
|
||||
return Z_UNDEF;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ if (nVar >= Num_variables - nSprayVariables)
|
||||
return Z_UNDEF;
|
||||
}
|
||||
|
||||
IOobject fieldObjectPtr
|
||||
typeIOobject<volVectorField> fieldObjectPtr
|
||||
(
|
||||
fieldNames[var2field[nVar]],
|
||||
runTime.timeName(),
|
||||
@ -13,7 +13,7 @@ IOobject fieldObjectPtr
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
if (!fieldObjectPtr.typeHeaderOk<volVectorField>(true))
|
||||
if (!fieldObjectPtr.headerOk())
|
||||
{
|
||||
return Z_UNDEF;
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
IOobject UMeanHeader
|
||||
typeIOobject<volVectorField> UMeanHeader
|
||||
(
|
||||
"UMean",
|
||||
runTime.timeName(),
|
||||
@ -6,7 +6,7 @@
|
||||
IOobject::MUST_READ
|
||||
);
|
||||
|
||||
if (!UMeanHeader.typeHeaderOk<volVectorField>(true))
|
||||
if (!UMeanHeader.headerOk())
|
||||
{
|
||||
Info<< " No UMean field" << endl;
|
||||
continue;
|
||||
|
||||
@ -174,7 +174,7 @@ int main(int argc, char *argv[])
|
||||
epsilon.write();
|
||||
|
||||
// Turbulence omega
|
||||
IOobject omegaHeader
|
||||
typeIOobject<volScalarField> omegaHeader
|
||||
(
|
||||
"omega",
|
||||
runTime.timeName(),
|
||||
@ -184,7 +184,7 @@ int main(int argc, char *argv[])
|
||||
false
|
||||
);
|
||||
|
||||
if (omegaHeader.typeHeaderOk<volScalarField>(true))
|
||||
if (omegaHeader.headerOk())
|
||||
{
|
||||
volScalarField omega(omegaHeader, mesh);
|
||||
|
||||
@ -202,7 +202,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// Turbulence nuTilda
|
||||
IOobject nuTildaHeader
|
||||
typeIOobject<volScalarField> nuTildaHeader
|
||||
(
|
||||
"nuTilda",
|
||||
runTime.timeName(),
|
||||
@ -212,7 +212,7 @@ int main(int argc, char *argv[])
|
||||
false
|
||||
);
|
||||
|
||||
if (nuTildaHeader.typeHeaderOk<volScalarField>(true))
|
||||
if (nuTildaHeader.headerOk())
|
||||
{
|
||||
volScalarField nuTilda(nuTildaHeader, mesh);
|
||||
nuTilda = nut;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
EXE_INC = \
|
||||
EXE_INC = -ggdb3 \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -59,7 +59,7 @@ void MapConsistentVolFields
|
||||
// Read field
|
||||
fieldType fieldSource(*fieldIter(), meshSource);
|
||||
|
||||
IOobject fieldTargetIOobject
|
||||
typeIOobject<fieldType> fieldTargetIOobject
|
||||
(
|
||||
fieldIter()->name(),
|
||||
meshTarget.time().timeName(),
|
||||
@ -68,7 +68,7 @@ void MapConsistentVolFields
|
||||
IOobject::AUTO_WRITE
|
||||
);
|
||||
|
||||
if (fieldTargetIOobject.typeHeaderOk<fieldType>(true))
|
||||
if (fieldTargetIOobject.headerOk())
|
||||
{
|
||||
// Read fieldTarget
|
||||
fieldType fieldTarget
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -53,7 +53,7 @@ void MapVolFields
|
||||
|
||||
forAllIter(IOobjectList, fields, fieldIter)
|
||||
{
|
||||
IOobject fieldTargetIOobject
|
||||
typeIOobject<fieldType> fieldTargetIOobject
|
||||
(
|
||||
fieldIter()->name(),
|
||||
meshTarget.time().timeName(),
|
||||
@ -62,7 +62,7 @@ void MapVolFields
|
||||
IOobject::AUTO_WRITE
|
||||
);
|
||||
|
||||
if (fieldTargetIOobject.typeHeaderOk<fieldType>(true))
|
||||
if (fieldTargetIOobject.headerOk())
|
||||
{
|
||||
Info<< " interpolating " << fieldIter()->name() << endl;
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ void UnMapped(const IOobjectList& objects)
|
||||
|
||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
||||
{
|
||||
mvBak(fieldIter()->objectPath<Type>(), "unmapped");
|
||||
mvBak(fieldIter()->objectPath(false), "unmapped");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -141,7 +141,7 @@ void MapVolFields
|
||||
{
|
||||
const fieldType fieldSource(*fieldIter(), meshSource);
|
||||
|
||||
IOobject targetIO
|
||||
typeIOobject<fieldType> targetIO
|
||||
(
|
||||
fieldName,
|
||||
meshTarget.time().timeName(),
|
||||
@ -149,7 +149,7 @@ void MapVolFields
|
||||
IOobject::MUST_READ
|
||||
);
|
||||
|
||||
if (targetIO.typeHeaderOk<fieldType>(true))
|
||||
if (targetIO.headerOk())
|
||||
{
|
||||
Info<< " interpolating onto existing field "
|
||||
<< fieldName << endl;
|
||||
|
||||
@ -41,7 +41,7 @@ void UnMapped(const IOobjectList& objects)
|
||||
|
||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
||||
{
|
||||
mvBak(fieldIter()->objectPath<Type>(), "unmapped");
|
||||
mvBak(fieldIter()->objectPath(false), "unmapped");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ bool setCellFieldType
|
||||
word fieldName(fieldValueStream);
|
||||
|
||||
// Check the current time directory
|
||||
IOobject fieldHeader
|
||||
typeIOobject<fieldType> fieldHeader
|
||||
(
|
||||
fieldName,
|
||||
mesh.time().timeName(),
|
||||
@ -67,9 +67,9 @@ bool setCellFieldType
|
||||
);
|
||||
|
||||
// Check the "constant" directory
|
||||
if (!fieldHeader.typeHeaderOk<fieldType>(true))
|
||||
if (!fieldHeader.headerOk())
|
||||
{
|
||||
fieldHeader = IOobject
|
||||
fieldHeader = typeIOobject<fieldType>
|
||||
(
|
||||
fieldName,
|
||||
mesh.time().constant(),
|
||||
@ -79,7 +79,7 @@ bool setCellFieldType
|
||||
}
|
||||
|
||||
// Check field exists
|
||||
if (fieldHeader.typeHeaderOk<fieldType>(true))
|
||||
if (fieldHeader.headerOk())
|
||||
{
|
||||
Info<< " Setting internal values of "
|
||||
<< fieldHeader.headerClassName()
|
||||
@ -204,7 +204,7 @@ bool setFaceFieldType
|
||||
word fieldName(fieldValueStream);
|
||||
|
||||
// Check the current time directory
|
||||
IOobject fieldHeader
|
||||
typeIOobject<fieldType> fieldHeader
|
||||
(
|
||||
fieldName,
|
||||
mesh.time().timeName(),
|
||||
@ -213,9 +213,9 @@ bool setFaceFieldType
|
||||
);
|
||||
|
||||
// Check the "constant" directory
|
||||
if (!fieldHeader.typeHeaderOk<fieldType>(true))
|
||||
if (!fieldHeader.headerOk())
|
||||
{
|
||||
fieldHeader = IOobject
|
||||
fieldHeader = typeIOobject<fieldType>
|
||||
(
|
||||
fieldName,
|
||||
mesh.time().constant(),
|
||||
@ -225,7 +225,7 @@ bool setFaceFieldType
|
||||
}
|
||||
|
||||
// Check field exists
|
||||
if (fieldHeader.typeHeaderOk<fieldType>(true))
|
||||
if (fieldHeader.headerOk())
|
||||
{
|
||||
Info<< " Setting patchField values of "
|
||||
<< fieldHeader.headerClassName()
|
||||
|
||||
@ -156,7 +156,7 @@ int main(int argc, char *argv[])
|
||||
Pstream::scatterList(meshBb);
|
||||
}
|
||||
|
||||
IOobject io
|
||||
typeIOobject<searchableSurface> io
|
||||
(
|
||||
surfFileName,
|
||||
runTime.constant(),
|
||||
@ -167,7 +167,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
// Look for file (using searchableSurface rules)
|
||||
const fileName actualPath(typeFilePath<searchableSurface>(io));
|
||||
const fileName actualPath(io.filePath());
|
||||
fileName localPath(actualPath);
|
||||
localPath.replace(runTime.rootPath() + '/', "");
|
||||
|
||||
|
||||
@ -159,7 +159,7 @@ Maxwell<BasicMomentumTransportModel>::Maxwell
|
||||
|
||||
forAll(sigmas_, modei)
|
||||
{
|
||||
IOobject header
|
||||
typeIOobject<volSymmTensorField> header
|
||||
(
|
||||
IOobject::groupName("sigma" + name(modei), alphaRhoPhi.group()),
|
||||
this->runTime_.timeName(),
|
||||
@ -168,7 +168,7 @@ Maxwell<BasicMomentumTransportModel>::Maxwell
|
||||
);
|
||||
|
||||
// Check if mode field exists and can be read
|
||||
if (header.typeHeaderOk<volSymmTensorField>(true))
|
||||
if (header.headerOk())
|
||||
{
|
||||
Info<< " Reading mode stress field "
|
||||
<< header.name() << endl;
|
||||
|
||||
@ -45,7 +45,7 @@ Foam::IOdictionary Foam::momentumTransportModel::readModelDict
|
||||
bool registerObject
|
||||
)
|
||||
{
|
||||
IOobject momentumTransport
|
||||
typeIOobject<IOdictionary> momentumTransport
|
||||
(
|
||||
IOobject::groupName(typeName, group),
|
||||
obr.time().constant(),
|
||||
@ -55,13 +55,13 @@ Foam::IOdictionary Foam::momentumTransportModel::readModelDict
|
||||
registerObject
|
||||
);
|
||||
|
||||
if (momentumTransport.typeHeaderOk<IOdictionary>(true))
|
||||
if (momentumTransport.headerOk())
|
||||
{
|
||||
return momentumTransport;
|
||||
}
|
||||
else
|
||||
{
|
||||
IOobject turbulenceProperties
|
||||
typeIOobject<IOdictionary> turbulenceProperties
|
||||
(
|
||||
IOobject::groupName("turbulenceProperties", group),
|
||||
obr.time().constant(),
|
||||
@ -71,7 +71,7 @@ Foam::IOdictionary Foam::momentumTransportModel::readModelDict
|
||||
registerObject
|
||||
);
|
||||
|
||||
if (turbulenceProperties.typeHeaderOk<IOdictionary>(true))
|
||||
if (turbulenceProperties.headerOk())
|
||||
{
|
||||
return turbulenceProperties;
|
||||
}
|
||||
|
||||
@ -61,6 +61,13 @@ Description
|
||||
- \par NO_WRITE
|
||||
No automatic write on destruction but can be written explicitly
|
||||
|
||||
Class
|
||||
Foam::typeIOobject
|
||||
|
||||
Description
|
||||
Templated form of IOobject providing type information for file reading and
|
||||
header type checking.
|
||||
|
||||
SourceFiles
|
||||
IOobject.C
|
||||
IOobjectReadHeader.C
|
||||
@ -134,6 +141,7 @@ public:
|
||||
|
||||
static const NamedEnum<fileCheckTypes, 4> fileCheckTypesNames;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Data
|
||||
@ -176,6 +184,11 @@ protected:
|
||||
//- Set the object state to bad
|
||||
void setBad(const string&);
|
||||
|
||||
//- Read header using typeGlobalFile to find file
|
||||
// and optionally check the headerClassName against Type
|
||||
template<class Type>
|
||||
bool typeHeaderOk(const bool checkType);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -411,11 +424,6 @@ public:
|
||||
return path(global)/name();
|
||||
}
|
||||
|
||||
//- Return complete path + object name including the processor
|
||||
// sub-directory for a parallel run if globalFile is false for Type
|
||||
template<class Type>
|
||||
inline fileName objectPath() const;
|
||||
|
||||
//- Return the path relative to the case directory
|
||||
fileName relativePath() const;
|
||||
|
||||
@ -438,10 +446,9 @@ public:
|
||||
//- Read header
|
||||
bool readHeader(Istream&);
|
||||
|
||||
//- Read header (uses typeFilePath to find file) and check header
|
||||
// info. Optionally checks headerClassName against type
|
||||
template<class Type>
|
||||
bool typeHeaderOk(const bool checkType = true);
|
||||
//- Read header of local object without type-checking
|
||||
// Mainly used to create IOobjectLists
|
||||
bool headerOk();
|
||||
|
||||
//- Helper: warn that type does not support re-reading
|
||||
template<class Type>
|
||||
@ -516,19 +523,6 @@ inline bool typeGlobalFile()
|
||||
return typeGlobal<Type>();
|
||||
}
|
||||
|
||||
//- Template function for obtaining filePath
|
||||
template<class Type>
|
||||
inline fileName typeFilePath(const IOobject& io)
|
||||
{
|
||||
return io.filePath(Type::typeName, typeGlobalFile<Type>());
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
inline fileName IOobject::objectPath() const
|
||||
{
|
||||
return objectPath(typeGlobalFile<Type>());
|
||||
}
|
||||
|
||||
inline IOobject unregister(const IOobject& io)
|
||||
{
|
||||
IOobject uio(io);
|
||||
@ -537,6 +531,53 @@ inline IOobject unregister(const IOobject& io)
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class typeIOobject Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class typeIOobject
|
||||
:
|
||||
public IOobject
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
using IOobject::IOobject;
|
||||
|
||||
typeIOobject(const IOobject& io)
|
||||
:
|
||||
IOobject(io)
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Reading
|
||||
|
||||
//- Read header (uses typeGlobalFile to find file) and check
|
||||
bool headerOk();
|
||||
|
||||
using IOobject::objectPath;
|
||||
|
||||
//- Return the object path for this Type
|
||||
inline fileName objectPath() const
|
||||
{
|
||||
return objectPath(typeGlobalFile<Type>());
|
||||
}
|
||||
|
||||
using IOobject::filePath;
|
||||
|
||||
//- Return the path for the file for this Type
|
||||
inline fileName filePath() const
|
||||
{
|
||||
return filePath(Type::typeName, typeGlobalFile<Type>());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -28,6 +28,12 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::IOobject::headerOk()
|
||||
{
|
||||
return typeHeaderOk<IOobject>(false);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::IOobject::readHeader(Istream& is)
|
||||
{
|
||||
if (IOobject::debug)
|
||||
|
||||
@ -49,7 +49,10 @@ bool Foam::IOobject::typeHeaderOk(const bool checkType)
|
||||
// Determine local status
|
||||
if (!masterOnly || Pstream::master())
|
||||
{
|
||||
const fileName fName(typeFilePath<Type>(*this));
|
||||
const fileName fName
|
||||
(
|
||||
filePath(Type::typeName, typeGlobalFile<Type>())
|
||||
);
|
||||
|
||||
ok = fp.readHeader(*this, fName, Type::typeName);
|
||||
if (ok && checkType && headerClassName_ != Type::typeName)
|
||||
@ -88,4 +91,11 @@ void Foam::IOobject::warnNoRereading() const
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
bool Foam::typeIOobject<Type>::headerOk()
|
||||
{
|
||||
return typeHeaderOk<Type>(true);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -26,7 +26,6 @@ License
|
||||
#include "IOobjectList.H"
|
||||
#include "Time.H"
|
||||
#include "OSspecific.H"
|
||||
#include "IOList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -57,7 +56,6 @@ Foam::IOobjectList::IOobjectList
|
||||
newInstance
|
||||
);
|
||||
|
||||
|
||||
forAll(ObjectNames, i)
|
||||
{
|
||||
IOobject* objectPtr = new IOobject
|
||||
@ -72,7 +70,7 @@ Foam::IOobjectList::IOobjectList
|
||||
);
|
||||
|
||||
// Use object with local scope
|
||||
if (objectPtr->typeHeaderOk<IOList<label>>(false))
|
||||
if (objectPtr->headerOk())
|
||||
{
|
||||
insert(ObjectNames[i], objectPtr);
|
||||
}
|
||||
|
||||
@ -421,15 +421,15 @@ Foam::fileName Foam::regIOobject::filePath() const
|
||||
|
||||
bool Foam::regIOobject::headerOk()
|
||||
{
|
||||
// Note: Should be consistent with IOobject::typeHeaderOk(false)
|
||||
// Note: Should be consistent with typeIOobject<Type>::headerOk()
|
||||
|
||||
bool ok = true;
|
||||
|
||||
fileName fName(filePath());
|
||||
const fileName fName(filePath());
|
||||
|
||||
ok = Foam::fileHandler().readHeader(*this, fName, type());
|
||||
|
||||
if (!ok && IOobject::debug)
|
||||
if (IOobject::debug && (!ok || headerClassName() != type()))
|
||||
{
|
||||
IOWarningInFunction(fName)
|
||||
<< "failed to read header of file " << objectPath()
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -110,10 +110,7 @@ bool Foam::GeometricField<Type, PatchField, GeoMesh>::readIfPresent()
|
||||
else if
|
||||
(
|
||||
this->readOpt() == IOobject::READ_IF_PRESENT
|
||||
&& this->template typeHeaderOk<GeometricField<Type, PatchField, GeoMesh>>
|
||||
(
|
||||
true
|
||||
)
|
||||
&& this->headerOk()
|
||||
)
|
||||
{
|
||||
readFields();
|
||||
@ -141,7 +138,7 @@ template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
bool Foam::GeometricField<Type, PatchField, GeoMesh>::readOldTimeIfPresent()
|
||||
{
|
||||
// Read the old time field if present
|
||||
IOobject field0
|
||||
typeIOobject<GeometricField<Type, PatchField, GeoMesh>> field0
|
||||
(
|
||||
this->name() + "_0",
|
||||
this->time().timeName(),
|
||||
@ -151,13 +148,7 @@ bool Foam::GeometricField<Type, PatchField, GeoMesh>::readOldTimeIfPresent()
|
||||
this->registerObject()
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
field0.template typeHeaderOk<GeometricField<Type, PatchField, GeoMesh>>
|
||||
(
|
||||
true
|
||||
)
|
||||
)
|
||||
if (field0.headerOk())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
|
||||
@ -370,9 +370,8 @@ bool Foam::fileOperation::exists(IOobject& io) const
|
||||
}
|
||||
else
|
||||
{
|
||||
ok =
|
||||
isFile(objPath)
|
||||
&& io.typeHeaderOk<IOList<label>>(false);// object with local scope
|
||||
// IOobject::headerOk assumes local scope
|
||||
ok = isFile(objPath) && io.headerOk();
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
@ -389,9 +388,8 @@ bool Foam::fileOperation::exists(IOobject& io) const
|
||||
}
|
||||
else
|
||||
{
|
||||
ok =
|
||||
isFile(originalPath)
|
||||
&& io.typeHeaderOk<IOList<label>>(false);
|
||||
// IOobject::headerOk assumes local scope
|
||||
ok = isFile(originalPath) && io.headerOk();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -1858,7 +1858,7 @@ const Foam::labelList& Foam::globalMeshData::sharedPointGlobalLabels() const
|
||||
);
|
||||
labelList& sharedPointGlobalLabels = sharedPointGlobalLabelsPtr_();
|
||||
|
||||
IOobject addrHeader
|
||||
typeIOobject<labelIOList> addrHeader
|
||||
(
|
||||
"pointProcAddressing",
|
||||
mesh_.facesInstance()/mesh_.meshSubDir,
|
||||
@ -1866,7 +1866,7 @@ const Foam::labelList& Foam::globalMeshData::sharedPointGlobalLabels() const
|
||||
IOobject::MUST_READ
|
||||
);
|
||||
|
||||
if (addrHeader.typeHeaderOk<labelIOList>(true))
|
||||
if (addrHeader.headerOk())
|
||||
{
|
||||
// There is a pointProcAddressing file so use it to get labels
|
||||
// on the original mesh
|
||||
|
||||
@ -137,7 +137,7 @@ void Foam::polyMesh::calcDirections() const
|
||||
|
||||
Foam::autoPtr<Foam::labelIOList> Foam::polyMesh::readTetBasePtIs() const
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<labelIOList> io
|
||||
(
|
||||
"tetBasePtIs",
|
||||
instance(),
|
||||
@ -147,7 +147,7 @@ Foam::autoPtr<Foam::labelIOList> Foam::polyMesh::readTetBasePtIs() const
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (io.typeHeaderOk<labelIOList>())
|
||||
if (io.headerOk())
|
||||
{
|
||||
return autoPtr<labelIOList>(new labelIOList(io));
|
||||
}
|
||||
@ -1250,7 +1250,7 @@ Foam::IOobject Foam::polyMesh::points0IO
|
||||
{
|
||||
// Check that points0 are actually in constant directory
|
||||
|
||||
IOobject io
|
||||
typeIOobject<pointIOField> io
|
||||
(
|
||||
"points0",
|
||||
instance,
|
||||
@ -1261,7 +1261,7 @@ Foam::IOobject Foam::polyMesh::points0IO
|
||||
false
|
||||
);
|
||||
|
||||
if (io.typeHeaderOk<pointIOField>())
|
||||
if (io.headerOk())
|
||||
{
|
||||
return io;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -46,7 +46,7 @@ void Foam::preservePatchTypes
|
||||
|
||||
// Read boundary file as single dictionary
|
||||
{
|
||||
IOobject patchEntriesHeader
|
||||
typeIOobject<polyBoundaryMeshEntries> patchEntriesHeader
|
||||
(
|
||||
"boundary",
|
||||
meshInstance,
|
||||
@ -57,7 +57,7 @@ void Foam::preservePatchTypes
|
||||
false
|
||||
);
|
||||
|
||||
if (patchEntriesHeader.typeHeaderOk<polyBoundaryMesh>(true))
|
||||
if (patchEntriesHeader.headerOk())
|
||||
{
|
||||
// Create a list of entries from the boundary file.
|
||||
polyBoundaryMeshEntries patchEntries(patchEntriesHeader);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2020 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -82,7 +82,7 @@ Foam::laminarThermophysicalTransportModel
|
||||
const thermoModel& thermo
|
||||
)
|
||||
{
|
||||
IOobject header
|
||||
typeIOobject<IOdictionary> header
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
@ -96,7 +96,7 @@ Foam::laminarThermophysicalTransportModel
|
||||
false
|
||||
);
|
||||
|
||||
if (header.typeHeaderOk<IOdictionary>(true))
|
||||
if (header.headerOk())
|
||||
{
|
||||
IOdictionary modelDict(header);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2020 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -82,7 +82,7 @@ Foam::LESThermophysicalTransportModel
|
||||
const thermoModel& thermo
|
||||
)
|
||||
{
|
||||
IOobject header
|
||||
typeIOobject<IOdictionary> header
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
@ -96,7 +96,7 @@ Foam::LESThermophysicalTransportModel
|
||||
false
|
||||
);
|
||||
|
||||
if (header.typeHeaderOk<IOdictionary>(true))
|
||||
if (header.headerOk())
|
||||
{
|
||||
IOdictionary modelDict(header);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2020 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -82,7 +82,7 @@ Foam::RASThermophysicalTransportModel
|
||||
const thermoModel& thermo
|
||||
)
|
||||
{
|
||||
IOobject header
|
||||
typeIOobject<IOdictionary> header
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
@ -96,7 +96,7 @@ Foam::RASThermophysicalTransportModel
|
||||
false
|
||||
);
|
||||
|
||||
if (header.typeHeaderOk<IOdictionary>(true))
|
||||
if (header.headerOk())
|
||||
{
|
||||
IOdictionary modelDict(header);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -47,7 +47,7 @@ Foam::IOobject Foam::combustionModel::createIOobject
|
||||
const word& combustionProperties
|
||||
) const
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<IOdictionary> io
|
||||
(
|
||||
thermo.phasePropertyName(combustionProperties),
|
||||
thermo.T().mesh().time().constant(),
|
||||
@ -56,7 +56,7 @@ Foam::IOobject Foam::combustionModel::createIOobject
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (io.typeHeaderOk<IOdictionary>(true))
|
||||
if (io.headerOk())
|
||||
{
|
||||
io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
|
||||
return io;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,7 +35,7 @@ Foam::autoPtr<Foam::combustionModel> Foam::combustionModel::New
|
||||
const word& combustionProperties
|
||||
)
|
||||
{
|
||||
IOobject combIO
|
||||
typeIOobject<IOdictionary> combIO
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -49,7 +49,7 @@ Foam::autoPtr<Foam::combustionModel> Foam::combustionModel::New
|
||||
);
|
||||
|
||||
word modelType(combustionModels::noCombustion::typeName);
|
||||
if (combIO.typeHeaderOk<IOdictionary>(false))
|
||||
if (combIO.headerOk())
|
||||
{
|
||||
IOdictionary(combIO).lookup(combustionModel::typeName) >> modelType;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,9 +30,9 @@ License
|
||||
|
||||
Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io)
|
||||
{
|
||||
IOobject dictHeader(dynamicMeshDictIOobject(io));
|
||||
typeIOobject<IOdictionary> dictHeader(dynamicMeshDictIOobject(io));
|
||||
|
||||
if (dictHeader.typeHeaderOk<IOdictionary>(true))
|
||||
if (dictHeader.headerOk())
|
||||
{
|
||||
IOdictionary dict(dictHeader);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -111,19 +111,16 @@ Foam::componentDisplacementMotionSolver::componentDisplacementMotionSolver
|
||||
<< "Number of points in mesh " << mesh.nPoints()
|
||||
<< " differs from number of points " << points0_.size()
|
||||
<< " read from file "
|
||||
<< typeFilePath<pointIOField>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
mesh.time().constant(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
)
|
||||
<< typeIOobject<pointIOField>
|
||||
(
|
||||
"points",
|
||||
mesh.time().constant(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
).filePath()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -51,19 +51,16 @@ Foam::points0MotionSolver::points0MotionSolver
|
||||
<< "Number of points in mesh " << mesh.nPoints()
|
||||
<< " differs from number of points " << points0_.size()
|
||||
<< " read from file "
|
||||
<< typeFilePath<pointIOField>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
mesh.time().constant(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
)
|
||||
<< typeIOobject<pointIOField>
|
||||
(
|
||||
"points",
|
||||
mesh.time().constant(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
).filePath()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -52,7 +52,7 @@ Foam::dynamicMeshPointInterpolator::dynamicMeshPointInterpolator
|
||||
|
||||
forAll(allTimes, i)
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<pointVectorField> io
|
||||
(
|
||||
fieldName_,
|
||||
allTimes[i].name(),
|
||||
@ -61,7 +61,8 @@ Foam::dynamicMeshPointInterpolator::dynamicMeshPointInterpolator
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
);
|
||||
if (io.typeHeaderOk<pointVectorField>(false))
|
||||
|
||||
if (io.headerOk())
|
||||
{
|
||||
names.append(allTimes[i].name());
|
||||
values.append(allTimes[i].value());
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,11 +39,11 @@ License
|
||||
Foam::hexRef8Data::hexRef8Data(const IOobject& io)
|
||||
{
|
||||
{
|
||||
IOobject rio(io);
|
||||
typeIOobject<labelIOList> rio(io);
|
||||
rio.rename("cellLevel");
|
||||
bool haveFile = returnReduce
|
||||
(
|
||||
rio.typeHeaderOk<labelIOList>(true),
|
||||
rio.headerOk(),
|
||||
orOp<bool>()
|
||||
);
|
||||
if (haveFile)
|
||||
@ -53,11 +53,11 @@ Foam::hexRef8Data::hexRef8Data(const IOobject& io)
|
||||
}
|
||||
}
|
||||
{
|
||||
IOobject rio(io);
|
||||
typeIOobject<labelIOList> rio(io);
|
||||
rio.rename("pointLevel");
|
||||
bool haveFile = returnReduce
|
||||
(
|
||||
rio.typeHeaderOk<labelIOList>(true),
|
||||
rio.headerOk(),
|
||||
orOp<bool>()
|
||||
);
|
||||
if (haveFile)
|
||||
@ -67,11 +67,11 @@ Foam::hexRef8Data::hexRef8Data(const IOobject& io)
|
||||
}
|
||||
}
|
||||
{
|
||||
IOobject rio(io);
|
||||
typeIOobject<uniformDimensionedScalarField> rio(io);
|
||||
rio.rename("level0Edge");
|
||||
bool haveFile = returnReduce
|
||||
(
|
||||
rio.typeHeaderOk<uniformDimensionedScalarField>(true),
|
||||
rio.headerOk(),
|
||||
orOp<bool>()
|
||||
);
|
||||
if (haveFile)
|
||||
@ -81,11 +81,11 @@ Foam::hexRef8Data::hexRef8Data(const IOobject& io)
|
||||
}
|
||||
}
|
||||
{
|
||||
IOobject rio(io);
|
||||
typeIOobject<refinementHistory> rio(io);
|
||||
rio.rename("refinementHistory");
|
||||
bool haveFile = returnReduce
|
||||
(
|
||||
rio.typeHeaderOk<refinementHistory>(true),
|
||||
rio.headerOk(),
|
||||
orOp<bool>()
|
||||
);
|
||||
if (haveFile)
|
||||
|
||||
@ -470,4 +470,10 @@ fvConstraints = $(general)/fvConstraints
|
||||
$(fvConstraints)/fvConstraint.C
|
||||
$(fvConstraints)/fvConstraints.C
|
||||
|
||||
cellSources = sets/cellSources
|
||||
$(cellSources)/fieldToCell/fieldToCell.C
|
||||
|
||||
faceSources = sets/faceSources
|
||||
$(faceSources)/patchFluxToFace/patchFluxToFace.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libfiniteVolume
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -34,7 +34,7 @@ Foam::IOobject Foam::IOMRFZoneList::createIOobject
|
||||
const fvMesh& mesh
|
||||
) const
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<IOdictionary> io
|
||||
(
|
||||
"MRFProperties",
|
||||
mesh.time().constant(),
|
||||
@ -43,7 +43,7 @@ Foam::IOobject Foam::IOMRFZoneList::createIOobject
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (io.typeHeaderOk<IOdictionary>(true))
|
||||
if (io.headerOk())
|
||||
{
|
||||
Info<< "Creating MRF zone list from " << io.name() << endl;
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ Foam::IOobject Foam::fvConstraints::createIOobject
|
||||
const fvMesh& mesh
|
||||
) const
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<IOdictionary> io
|
||||
(
|
||||
typeName,
|
||||
mesh.time().system(),
|
||||
@ -51,7 +51,7 @@ Foam::IOobject Foam::fvConstraints::createIOobject
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (io.typeHeaderOk<IOdictionary>(true))
|
||||
if (io.headerOk())
|
||||
{
|
||||
Info<< "Creating fvConstraints from "
|
||||
<< io.instance()/io.name() << nl
|
||||
@ -66,7 +66,7 @@ Foam::IOobject Foam::fvConstraints::createIOobject
|
||||
// check if the fvOptions file is in system
|
||||
io.rename("fvOptions");
|
||||
|
||||
if (io.typeHeaderOk<IOdictionary>(true))
|
||||
if (io.headerOk())
|
||||
{
|
||||
Warning
|
||||
<< "Creating fvConstraints from "
|
||||
@ -82,7 +82,7 @@ Foam::IOobject Foam::fvConstraints::createIOobject
|
||||
// check if the fvOptions file is in constant
|
||||
io.instance() = mesh.time().constant();
|
||||
|
||||
if (io.typeHeaderOk<IOdictionary>(true))
|
||||
if (io.headerOk())
|
||||
{
|
||||
Warning
|
||||
<< "Creating fvConstraints from "
|
||||
|
||||
@ -42,7 +42,7 @@ Foam::IOobject Foam::fvModels::createIOobject
|
||||
const fvMesh& mesh
|
||||
) const
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<IOdictionary> io
|
||||
(
|
||||
typeName,
|
||||
mesh.time().constant(),
|
||||
@ -51,7 +51,7 @@ Foam::IOobject Foam::fvModels::createIOobject
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (io.typeHeaderOk<IOdictionary>(true))
|
||||
if (io.headerOk())
|
||||
{
|
||||
Info<< "Creating fvModels from "
|
||||
<< io.instance()/io.name() << nl
|
||||
@ -66,7 +66,7 @@ Foam::IOobject Foam::fvModels::createIOobject
|
||||
// check if the fvOptions file is in constant
|
||||
io.rename("fvOptions");
|
||||
|
||||
if (io.typeHeaderOk<IOdictionary>(true))
|
||||
if (io.headerOk())
|
||||
{
|
||||
Warning
|
||||
<< "Creating fvModels from "
|
||||
@ -82,7 +82,7 @@ Foam::IOobject Foam::fvModels::createIOobject
|
||||
// check if the fvOptions file is in system
|
||||
io.instance() = mesh.time().system();
|
||||
|
||||
if (io.typeHeaderOk<IOdictionary>(true))
|
||||
if (io.headerOk())
|
||||
{
|
||||
Warning
|
||||
<< "Creating fvModels from "
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
if (!mesh.foundObject<IOdictionary>("radiationProperties"))
|
||||
{
|
||||
IOobject radiationProperties
|
||||
typeIOobject<IOdictionary> radiationProperties
|
||||
(
|
||||
"radiationProperties",
|
||||
runTime.constant(),
|
||||
@ -10,7 +10,7 @@ if (!mesh.foundObject<IOdictionary>("radiationProperties"))
|
||||
false
|
||||
);
|
||||
|
||||
if (radiationProperties.typeHeaderOk<IOdictionary>(false))
|
||||
if (radiationProperties.headerOk())
|
||||
{
|
||||
const word modelType
|
||||
(
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -34,7 +34,7 @@ Foam::IOobject Foam::IOporosityModelList::createIOobject
|
||||
const fvMesh& mesh
|
||||
) const
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<IOdictionary> io
|
||||
(
|
||||
"porosityProperties",
|
||||
mesh.time().constant(),
|
||||
@ -43,7 +43,7 @@ Foam::IOobject Foam::IOporosityModelList::createIOobject
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (io.typeHeaderOk<IOdictionary>(true))
|
||||
if (io.headerOk())
|
||||
{
|
||||
Info<< "Creating porosity model list from " << io.name() << nl << endl;
|
||||
|
||||
|
||||
@ -120,12 +120,12 @@ CrankNicolsonDdtScheme<Type>::ddt0_
|
||||
runTime.timeIndex() == runTime.startTimeIndex()
|
||||
|| runTime.timeIndex() == runTime.startTimeIndex() + 1
|
||||
)
|
||||
&& IOobject
|
||||
&& typeIOobject<DDt0Field<GeoField>>
|
||||
(
|
||||
name,
|
||||
startTimeName,
|
||||
mesh()
|
||||
).typeHeaderOk<DDt0Field<GeoField>>()
|
||||
).headerOk()
|
||||
)
|
||||
{
|
||||
regIOobject::store
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,6 +29,7 @@ License
|
||||
#include "Time.H"
|
||||
#include "IFstream.H"
|
||||
#include "fieldDictionary.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -125,8 +126,7 @@ void Foam::fieldToCell::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
// Try to load field
|
||||
IOobject fieldObject
|
||||
typeIOobject<volScalarField> fieldObject
|
||||
(
|
||||
fieldName_,
|
||||
mesh().time().timeName(),
|
||||
@ -136,41 +136,68 @@ void Foam::fieldToCell::applyToSet
|
||||
false
|
||||
);
|
||||
|
||||
// Note: should check for volScalarField but that introduces dependency
|
||||
// on volMesh so just use another type with processor-local scope
|
||||
if (!fieldObject.typeHeaderOk<labelIOList>(false))
|
||||
if (!fieldObject.IOobject::headerOk())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Cannot read field " << fieldName_
|
||||
<< " from time " << mesh().time().timeName() << endl;
|
||||
}
|
||||
else if (fieldObject.headerClassName() == "volScalarField")
|
||||
else if (fieldObject.IOobject::headerOk())
|
||||
{
|
||||
IFstream str(typeFilePath<labelIOList>(fieldObject));
|
||||
IFstream str(fieldObject.filePath());
|
||||
|
||||
// Read dictionary
|
||||
fieldDictionary fieldDict(fieldObject, fieldObject.headerClassName());
|
||||
const fieldDictionary fieldDict
|
||||
(
|
||||
fieldObject,
|
||||
volScalarField::typeName
|
||||
);
|
||||
|
||||
scalarField internalVals("internalField", fieldDict, mesh().nCells());
|
||||
const scalarField internalVals
|
||||
(
|
||||
"internalField",
|
||||
fieldDict, mesh().nCells()
|
||||
);
|
||||
|
||||
applyToSet(action, internalVals, set);
|
||||
}
|
||||
else if (fieldObject.headerClassName() == "volVectorField")
|
||||
{
|
||||
IFstream str(typeFilePath<labelIOList>(fieldObject));
|
||||
|
||||
// Read dictionary
|
||||
fieldDictionary fieldDict(fieldObject, fieldObject.headerClassName());
|
||||
|
||||
vectorField internalVals("internalField", fieldDict, mesh().nCells());
|
||||
|
||||
applyToSet(action, mag(internalVals), set);
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningInFunction
|
||||
typeIOobject<volVectorField> fieldObject
|
||||
(
|
||||
fieldName_,
|
||||
mesh().time().timeName(),
|
||||
mesh(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE,
|
||||
false
|
||||
);
|
||||
|
||||
if (fieldObject.IOobject::headerOk())
|
||||
{
|
||||
IFstream str(fieldObject.filePath());
|
||||
|
||||
// Read dictionary
|
||||
const fieldDictionary fieldDict
|
||||
(
|
||||
fieldObject,
|
||||
volVectorField::typeName
|
||||
);
|
||||
|
||||
const vectorField internalVals
|
||||
(
|
||||
"internalField",
|
||||
fieldDict, mesh().nCells()
|
||||
);
|
||||
|
||||
applyToSet(action, mag(internalVals), set);
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Cannot handle fields of type " << fieldObject.headerClassName()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,6 +29,7 @@ License
|
||||
#include "Time.H"
|
||||
#include "IFstream.H"
|
||||
#include "fieldDictionary.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -132,8 +133,7 @@ void Foam::patchFluxToFace::applyToSet
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
// Try to load field
|
||||
IOobject fieldObject
|
||||
typeIOobject<surfaceScalarField> fieldObject
|
||||
(
|
||||
fieldName_,
|
||||
mesh().time().timeName(),
|
||||
@ -143,17 +143,9 @@ void Foam::patchFluxToFace::applyToSet
|
||||
false
|
||||
);
|
||||
|
||||
// Note: should check for surfaceScalarField but that introduces dependency
|
||||
// on volMesh so just use another type with processor-local scope
|
||||
if (!fieldObject.typeHeaderOk<labelIOList>(false))
|
||||
if (fieldObject.headerOk())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Cannot read flux field " << fieldName_
|
||||
<< " from time " << mesh().time().timeName() << endl;
|
||||
}
|
||||
else if (fieldObject.headerClassName() == "surfaceScalarField")
|
||||
{
|
||||
IFstream str(typeFilePath<labelIOList>(fieldObject));
|
||||
IFstream str(fieldObject.filePath());
|
||||
|
||||
// Read dictionary
|
||||
const fieldDictionary fieldDict
|
||||
@ -174,8 +166,8 @@ void Foam::patchFluxToFace::applyToSet
|
||||
else
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Incorrect flux field type " << fieldObject.headerClassName()
|
||||
<< endl;
|
||||
<< "Cannot read flux field " << fieldName_
|
||||
<< " from time " << mesh().time().timeName() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,7 +243,7 @@ void Foam::functionObjects::fieldAverage::readAveragingProperties()
|
||||
}
|
||||
else
|
||||
{
|
||||
IOobject propsDictHeader
|
||||
typeIOobject<timeIOdictionary> propsDictHeader
|
||||
(
|
||||
name() + "Properties",
|
||||
obr_.time().timeName(obr_.time().startTime().value()),
|
||||
@ -254,7 +254,7 @@ void Foam::functionObjects::fieldAverage::readAveragingProperties()
|
||||
false
|
||||
);
|
||||
|
||||
if (!propsDictHeader.typeHeaderOk<timeIOdictionary>())
|
||||
if (!propsDictHeader.headerOk())
|
||||
{
|
||||
Log << " Starting averaging at time "
|
||||
<< obr_.time().timeName() << nl;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -79,7 +79,7 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform
|
||||
}
|
||||
else
|
||||
{
|
||||
IOobject fieldHeader
|
||||
typeIOobject<VolFieldType> fieldHeader
|
||||
(
|
||||
fieldName,
|
||||
mesh_.time().timeName(),
|
||||
@ -88,11 +88,7 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
fieldHeader.typeHeaderOk<VolFieldType>(false)
|
||||
&& fieldHeader.headerClassName() == VolFieldType::typeName
|
||||
)
|
||||
if (fieldHeader.headerOk())
|
||||
{
|
||||
DebugInfo
|
||||
<< type() << ": Field " << fieldName << " read from file"
|
||||
@ -103,20 +99,28 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform
|
||||
mesh_.lookupObject<VolFieldType>(fieldName)
|
||||
);
|
||||
}
|
||||
else if
|
||||
(
|
||||
fieldHeader.typeHeaderOk<SurfaceFieldType>(false)
|
||||
&& fieldHeader.headerClassName() == SurfaceFieldType::typeName
|
||||
)
|
||||
else
|
||||
{
|
||||
DebugInfo
|
||||
<< type() << ": Field " << fieldName << " read from file"
|
||||
<< endl;
|
||||
|
||||
transformField<SurfaceFieldType>
|
||||
typeIOobject<SurfaceFieldType> fieldHeader
|
||||
(
|
||||
mesh_.lookupObject<SurfaceFieldType>(fieldName)
|
||||
fieldName,
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (fieldHeader.headerOk())
|
||||
{
|
||||
DebugInfo
|
||||
<< type() << ": Field " << fieldName << " read from file"
|
||||
<< endl;
|
||||
|
||||
transformField<SurfaceFieldType>
|
||||
(
|
||||
mesh_.lookupObject<SurfaceFieldType>(fieldName)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -55,7 +55,7 @@ void Foam::functionObjects::readFields::loadField
|
||||
}
|
||||
else
|
||||
{
|
||||
IOobject fieldHeader
|
||||
typeIOobject<VolFieldType> fieldHeader
|
||||
(
|
||||
fieldName,
|
||||
mesh_.time().timeName(),
|
||||
@ -64,11 +64,7 @@ void Foam::functionObjects::readFields::loadField
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
fieldHeader.typeHeaderOk<VolFieldType>(false)
|
||||
&& fieldHeader.headerClassName() == VolFieldType::typeName
|
||||
)
|
||||
if (fieldHeader.headerOk())
|
||||
{
|
||||
// Store field locally
|
||||
Log << " Reading " << fieldName << endl;
|
||||
@ -77,18 +73,26 @@ void Foam::functionObjects::readFields::loadField
|
||||
vflds.setSize(sz+1);
|
||||
vflds.set(sz, new VolFieldType(fieldHeader, mesh_));
|
||||
}
|
||||
else if
|
||||
(
|
||||
fieldHeader.typeHeaderOk<SurfaceFieldType>(false)
|
||||
&& fieldHeader.headerClassName() == SurfaceFieldType::typeName
|
||||
)
|
||||
else
|
||||
{
|
||||
// Store field locally
|
||||
Log << " Reading " << fieldName << endl;
|
||||
typeIOobject<SurfaceFieldType> fieldHeader
|
||||
(
|
||||
fieldName,
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
label sz = sflds.size();
|
||||
sflds.setSize(sz+1);
|
||||
sflds.set(sz, new SurfaceFieldType(fieldHeader, mesh_));
|
||||
if (fieldHeader.headerOk())
|
||||
{
|
||||
// Store field locally
|
||||
Log << " Reading " << fieldName << endl;
|
||||
|
||||
label sz = sflds.size();
|
||||
sflds.setSize(sz+1);
|
||||
sflds.set(sz, new SurfaceFieldType(fieldHeader, mesh_));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -56,7 +56,7 @@ bool Foam::functionObjects::writeDictionary::tryDirectory
|
||||
bool& firstDict
|
||||
)
|
||||
{
|
||||
IOobject dictIO
|
||||
typeIOobject<IOdictionary> dictIO
|
||||
(
|
||||
dictNames_[dictI],
|
||||
location,
|
||||
@ -66,7 +66,7 @@ bool Foam::functionObjects::writeDictionary::tryDirectory
|
||||
false
|
||||
);
|
||||
|
||||
if (dictIO.typeHeaderOk<IOdictionary>(true))
|
||||
if (dictIO.headerOk())
|
||||
{
|
||||
IOdictionary dict(dictIO);
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ namespace heatTransferModels
|
||||
|
||||
void Foam::fv::heatTransferModels::constant::readCoeffs()
|
||||
{
|
||||
IOobject htcIO
|
||||
typeIOobject<volScalarField> htcIO
|
||||
(
|
||||
"htc",
|
||||
mesh().time().constant(),
|
||||
@ -67,7 +67,7 @@ void Foam::fv::heatTransferModels::constant::readCoeffs()
|
||||
);
|
||||
htcPtr_.clear();
|
||||
}
|
||||
else if (htcIO.typeHeaderOk<volScalarField>(false))
|
||||
else if (htcIO.headerOk())
|
||||
{
|
||||
htc_ = dimensionedScalar("htc", dimPower/dimTemperature/dimArea, NaN);
|
||||
htcPtr_.set(new volScalarField(htcIO, mesh()));
|
||||
@ -77,7 +77,7 @@ void Foam::fv::heatTransferModels::constant::readCoeffs()
|
||||
FatalIOErrorInFunction(coeffs())
|
||||
<< "Heat transfer coefficient (htc) not found. A uniform htc "
|
||||
<< "value should be specified, or a non-uniform field should "
|
||||
<< "exist at " << htcIO.objectPath<volScalarField>()
|
||||
<< "exist at " << htcIO.objectPath()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ namespace fv
|
||||
|
||||
void Foam::fv::heatTransferModel::readCoeffs()
|
||||
{
|
||||
IOobject AoVIO
|
||||
typeIOobject<volScalarField> AoVIO
|
||||
(
|
||||
"AoV",
|
||||
mesh().time().constant(),
|
||||
@ -56,7 +56,7 @@ void Foam::fv::heatTransferModel::readCoeffs()
|
||||
AoV_ = dimensionedScalar("AoV", dimless/dimLength, coeffs());
|
||||
AoVPtr_.clear();
|
||||
}
|
||||
else if (AoVIO.typeHeaderOk<volScalarField>(false))
|
||||
else if (AoVIO.headerOk())
|
||||
{
|
||||
AoV_ = dimensionedScalar("AoV", dimless/dimLength, NaN);
|
||||
AoVPtr_.set(new volScalarField(AoVIO, mesh()));
|
||||
@ -66,7 +66,7 @@ void Foam::fv::heatTransferModel::readCoeffs()
|
||||
FatalIOErrorInFunction(coeffs())
|
||||
<< "Area per unit volume (AoV) not found. A uniform AoV "
|
||||
<< "value should be specified, or a non-uniform field should "
|
||||
<< "exist at " << AoVIO.objectPath<volScalarField>()
|
||||
<< "exist at " << AoVIO.objectPath()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -88,7 +88,7 @@ Foam::displacementLaplacianFvMotionSolver::displacementLaplacianFvMotionSolver
|
||||
: -1
|
||||
)
|
||||
{
|
||||
IOobject io
|
||||
typeIOobject<pointVectorField> io
|
||||
(
|
||||
"pointLocation",
|
||||
fvMesh_.time().timeName(),
|
||||
@ -105,7 +105,7 @@ Foam::displacementLaplacianFvMotionSolver::displacementLaplacianFvMotionSolver
|
||||
}
|
||||
|
||||
|
||||
if (io.typeHeaderOk<pointVectorField>(true))
|
||||
if (io.headerOk())
|
||||
{
|
||||
pointLocation_.reset
|
||||
(
|
||||
|
||||
@ -39,7 +39,7 @@ Foam::word Foam::Cloud<ParticleType>::cloudPropertiesName("cloudProperties");
|
||||
template<class ParticleType>
|
||||
void Foam::Cloud<ParticleType>::readCloudUniformProperties()
|
||||
{
|
||||
IOobject dictObj
|
||||
typeIOobject<timeIOdictionary> dictObj
|
||||
(
|
||||
cloudPropertiesName,
|
||||
time().timeName(),
|
||||
@ -50,7 +50,7 @@ void Foam::Cloud<ParticleType>::readCloudUniformProperties()
|
||||
false
|
||||
);
|
||||
|
||||
if (dictObj.typeHeaderOk<timeIOdictionary>(true))
|
||||
if (dictObj.headerOk())
|
||||
{
|
||||
const timeIOdictionary uniformPropsDict(dictObj);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -44,9 +44,12 @@ void Foam::particle::readFields(TrackCloudType& c)
|
||||
{
|
||||
bool valid = c.size();
|
||||
|
||||
IOobject procIO(c.fieldIOobject("origProcId", IOobject::MUST_READ));
|
||||
typeIOobject<IOField<label>> procIO
|
||||
(
|
||||
c.fieldIOobject("origProcId", IOobject::MUST_READ)
|
||||
);
|
||||
|
||||
bool haveFile = procIO.typeHeaderOk<IOField<label>>(true);
|
||||
bool haveFile = procIO.headerOk();
|
||||
|
||||
IOField<label> origProcId(procIO, valid && haveFile);
|
||||
c.checkFieldIOobject(c, origProcId);
|
||||
|
||||
@ -41,7 +41,7 @@ void Foam::parcelCloudList::initialise
|
||||
const Args& ... args
|
||||
)
|
||||
{
|
||||
IOobject cloudsIO
|
||||
typeIOobject<wordGlobalIOList> cloudsIO
|
||||
(
|
||||
cloudsName,
|
||||
mesh_.time().constant(),
|
||||
@ -50,7 +50,7 @@ void Foam::parcelCloudList::initialise
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (cloudsIO.typeHeaderOk<wordGlobalIOList>(false))
|
||||
if (cloudsIO.headerOk())
|
||||
{
|
||||
wordGlobalIOList cloudNames(cloudsIO);
|
||||
|
||||
@ -63,7 +63,7 @@ void Foam::parcelCloudList::initialise
|
||||
}
|
||||
else
|
||||
{
|
||||
IOobject cloudIO
|
||||
typeIOobject<IOdictionary> cloudIO
|
||||
(
|
||||
"cloudProperties",
|
||||
mesh_.time().constant(),
|
||||
@ -72,7 +72,7 @@ void Foam::parcelCloudList::initialise
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (cloudIO.typeHeaderOk<IOdictionary>(false))
|
||||
if (cloudIO.headerOk())
|
||||
{
|
||||
this->setSize(1);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2020 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -101,7 +101,7 @@ Foam::PatchCollisionDensity<CloudType>::PatchCollisionDensity
|
||||
collisionDensity_ == 0;
|
||||
collisionDensity0_ == 0;
|
||||
|
||||
IOobject io
|
||||
typeIOobject<volScalarField> io
|
||||
(
|
||||
this->owner().name() + ":collisionDensity",
|
||||
this->owner().mesh().time().timeName(),
|
||||
@ -110,7 +110,7 @@ Foam::PatchCollisionDensity<CloudType>::PatchCollisionDensity
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (io.typeHeaderOk<volScalarField>())
|
||||
if (io.headerOk())
|
||||
{
|
||||
const volScalarField collisionDensity(io, this->owner().mesh());
|
||||
collisionDensity_ == collisionDensity.boundaryField();
|
||||
|
||||
@ -46,7 +46,7 @@ void Foam::refinementFeatures::read
|
||||
|
||||
// Try reading extendedEdgeMesh first
|
||||
|
||||
IOobject extFeatObj
|
||||
typeIOobject<extendedFeatureEdgeMesh> extFeatObj
|
||||
(
|
||||
featFileName, // name
|
||||
io.time().constant(), // instance
|
||||
@ -57,7 +57,7 @@ void Foam::refinementFeatures::read
|
||||
false
|
||||
);
|
||||
|
||||
const fileName fName(typeFilePath<extendedFeatureEdgeMesh>(extFeatObj));
|
||||
const fileName fName(extFeatObj.filePath());
|
||||
|
||||
if (!fName.empty() && extendedEdgeMesh::canRead(fName))
|
||||
{
|
||||
@ -77,7 +77,7 @@ void Foam::refinementFeatures::read
|
||||
{
|
||||
// Try reading edgeMesh
|
||||
|
||||
IOobject featObj
|
||||
typeIOobject<featureEdgeMesh> featObj
|
||||
(
|
||||
featFileName,
|
||||
io.time().constant(),
|
||||
@ -88,7 +88,7 @@ void Foam::refinementFeatures::read
|
||||
false
|
||||
);
|
||||
|
||||
const fileName fName(typeFilePath<featureEdgeMesh>(featObj));
|
||||
const fileName fName(featObj.filePath());
|
||||
|
||||
if (fName.empty())
|
||||
{
|
||||
@ -96,7 +96,7 @@ void Foam::refinementFeatures::read
|
||||
(
|
||||
dict
|
||||
) << "Could not open "
|
||||
<< featObj.objectPath<featureEdgeMesh>()
|
||||
<< featObj.objectPath()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
|
||||
@ -128,9 +128,8 @@ $(topoSets)/pointZoneSet.C
|
||||
|
||||
sets/topoSetSource/topoSetSource.C
|
||||
|
||||
cellSources = sets/cellSources
|
||||
cellSources = sets/cellSources
|
||||
$(cellSources)/faceToCell/faceToCell.C
|
||||
$(cellSources)/fieldToCell/fieldToCell.C
|
||||
$(cellSources)/pointToCell/pointToCell.C
|
||||
$(cellSources)/shapeToCell/shapeToCell.C
|
||||
$(cellSources)/boxToCell/boxToCell.C
|
||||
@ -154,15 +153,14 @@ $(faceSources)/faceToFace/faceToFace.C
|
||||
$(faceSources)/labelToFace/labelToFace.C
|
||||
$(faceSources)/cellToFace/cellToFace.C
|
||||
$(faceSources)/normalToFace/normalToFace.C
|
||||
$(faceSources)/pointToFace/pointToFace.C
|
||||
$(faceSources)/patchToFace/patchToFace.C
|
||||
$(faceSources)/pointToFace/pointToFace.C
|
||||
$(faceSources)/boundaryToFace/boundaryToFace.C
|
||||
$(faceSources)/zoneToFace/zoneToFace.C
|
||||
$(faceSources)/boxToFace/boxToFace.C
|
||||
$(faceSources)/regionToFace/regionToFace.C
|
||||
$(faceSources)/cylinderToFace/cylinderToFace.C
|
||||
$(faceSources)/cylinderAnnulusToFace/cylinderAnnulusToFace.C
|
||||
$(faceSources)/patchFluxToFace/patchFluxToFace.C
|
||||
|
||||
pointSources = sets/pointSources
|
||||
$(pointSources)/labelToPoint/labelToPoint.C
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -66,7 +66,7 @@ bool Foam::fileFormats::edgeMeshFormat::read
|
||||
|
||||
// Construct IOobject to re-use the headerOk & readHeader
|
||||
// (so we can read ascii and binary)
|
||||
IOobject io
|
||||
typeIOobject<featureEdgeMesh> io
|
||||
(
|
||||
filename,
|
||||
dummyTime,
|
||||
@ -75,14 +75,14 @@ bool Foam::fileFormats::edgeMeshFormat::read
|
||||
false
|
||||
);
|
||||
|
||||
if (!io.typeHeaderOk<featureEdgeMesh>(false))
|
||||
if (!io.headerOk())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot read file " << filename
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
const fileName fName(typeFilePath<featureEdgeMesh>(io));
|
||||
const fileName fName(io.filePath());
|
||||
|
||||
autoPtr<IFstream> isPtr(new IFstream(fName));
|
||||
bool ok = false;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -64,7 +64,7 @@ bool Foam::fileFormats::extendedEdgeMeshFormat::read
|
||||
|
||||
// Construct IOobject to re-use the headerOk & readHeader
|
||||
// (so we can read ascii and binary)
|
||||
IOobject io
|
||||
typeIOobject<extendedFeatureEdgeMesh> io
|
||||
(
|
||||
filename,
|
||||
dummyTime,
|
||||
@ -73,14 +73,14 @@ bool Foam::fileFormats::extendedEdgeMeshFormat::read
|
||||
false
|
||||
);
|
||||
|
||||
if (!io.typeHeaderOk<extendedFeatureEdgeMesh>(false))
|
||||
if (!io.headerOk())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot read file " << filename
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
const fileName fName(typeFilePath<extendedFeatureEdgeMesh>(io));
|
||||
const fileName fName(io.filePath());
|
||||
|
||||
autoPtr<IFstream> isPtr(new IFstream(fName));
|
||||
bool ok = false;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user