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:
Henry Weller
2021-08-12 10:12:03 +01:00
parent 0a3a6312e5
commit b9123328fb
114 changed files with 514 additions and 475 deletions

View File

@ -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()