mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: IOobject hasHeaderClassName() method
- simple wrapper for (!headerClassName().empty()) when checking if reading was successful.
This commit is contained in:
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2021 OpenCFD Ltd.
|
Copyright (C) 2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -129,7 +129,7 @@ class readFieldsHandler
|
|||||||
const bool ok =
|
const bool ok =
|
||||||
(
|
(
|
||||||
io.typeHeaderOk<regIOobject>(false) // Preload header info
|
io.typeHeaderOk<regIOobject>(false) // Preload header info
|
||||||
&& !io.headerClassName().empty() // Extra safety
|
&& io.hasHeaderClassName() // Extra safety
|
||||||
&&
|
&&
|
||||||
(
|
(
|
||||||
loadField<scalar>(io)
|
loadField<scalar>(io)
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2021 OpenCFD Ltd.
|
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -129,7 +129,7 @@ class readFieldsHandler
|
|||||||
const bool ok =
|
const bool ok =
|
||||||
(
|
(
|
||||||
io.typeHeaderOk<regIOobject>(false) // Preload header info
|
io.typeHeaderOk<regIOobject>(false) // Preload header info
|
||||||
&& !io.headerClassName().empty() // Extra safety
|
&& io.hasHeaderClassName() // Extra safety
|
||||||
&&
|
&&
|
||||||
(
|
(
|
||||||
loadField<scalar>(io)
|
loadField<scalar>(io)
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -482,6 +482,9 @@ public:
|
|||||||
|
|
||||||
// Checks
|
// Checks
|
||||||
|
|
||||||
|
//- True if headerClassName() is non-empty (after reading)
|
||||||
|
inline bool hasHeaderClassName() const noexcept;
|
||||||
|
|
||||||
//- Test if headerClassName() equals the given class name
|
//- Test if headerClassName() equals the given class name
|
||||||
inline bool isHeaderClassName(const word& clsName) const;
|
inline bool isHeaderClassName(const word& clsName) const;
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -146,6 +146,12 @@ inline unsigned Foam::IOobject::scalarByteSize() const noexcept
|
|||||||
|
|
||||||
// Checks
|
// Checks
|
||||||
|
|
||||||
|
inline bool Foam::IOobject::hasHeaderClassName() const noexcept
|
||||||
|
{
|
||||||
|
return !headerClassName_.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::IOobject::isHeaderClassName(const word& clsName) const
|
inline bool Foam::IOobject::isHeaderClassName(const word& clsName) const
|
||||||
{
|
{
|
||||||
return (clsName == headerClassName_);
|
return (clsName == headerClassName_);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017, 2020 OpenFOAM Foundation
|
Copyright (C) 2011-2017, 2020 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -313,7 +313,7 @@ Foam::polyMesh::polyMesh(const IOobject& io, const bool doInit)
|
|||||||
oldPointsPtr_(nullptr),
|
oldPointsPtr_(nullptr),
|
||||||
oldCellCentresPtr_(nullptr)
|
oldCellCentresPtr_(nullptr)
|
||||||
{
|
{
|
||||||
if (!owner_.headerClassName().empty())
|
if (owner_.hasHeaderClassName())
|
||||||
{
|
{
|
||||||
initMesh();
|
initMesh();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -240,7 +240,7 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate()
|
|||||||
// Boundary is set so can use initMesh now (uses boundary_ to
|
// Boundary is set so can use initMesh now (uses boundary_ to
|
||||||
// determine internal and active faces)
|
// determine internal and active faces)
|
||||||
|
|
||||||
if (!owner_.headerClassName().empty())
|
if (owner_.hasHeaderClassName())
|
||||||
{
|
{
|
||||||
initMesh();
|
initMesh();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -192,7 +192,7 @@ Foam::label Foam::functionObjects::fvExpressionField::loadFields
|
|||||||
const bool ok =
|
const bool ok =
|
||||||
(
|
(
|
||||||
io.typeHeaderOk<regIOobject>(false) // Preload header info
|
io.typeHeaderOk<regIOobject>(false) // Preload header info
|
||||||
&& !io.headerClassName().empty() // Extra safety
|
&& io.hasHeaderClassName() // Extra safety
|
||||||
&&
|
&&
|
||||||
(
|
(
|
||||||
loadField<scalar>(io)
|
loadField<scalar>(io)
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -104,7 +104,7 @@ bool Foam::functionObjects::readFields::execute()
|
|||||||
const bool ok =
|
const bool ok =
|
||||||
(
|
(
|
||||||
io.typeHeaderOk<regIOobject>(false) // Preload header info
|
io.typeHeaderOk<regIOobject>(false) // Preload header info
|
||||||
&& !io.headerClassName().empty() // Extra safety
|
&& io.hasHeaderClassName() // Extra safety
|
||||||
&&
|
&&
|
||||||
(
|
(
|
||||||
loadField<scalar>(io)
|
loadField<scalar>(io)
|
||||||
|
|||||||
Reference in New Issue
Block a user