mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
- support selective enable/disable of the file banner. ENH: improve code isolation for decomposedBlockData - use readBlockEntry/writeBlockEntry to encapsulate the IO handling, which ensures more consistency - new decomposedBlockData::readHeader for chaining into the block header information. - remove unused constructors for decomposedBlockData ENH: minor cleanup of collated fileOperations
230 lines
4.4 KiB
C++
230 lines
4.4 KiB
C++
/*---------------------------------------------------------------------------*\
|
|
========= |
|
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
\\ / O peration |
|
|
\\ / A nd | www.openfoam.com
|
|
\\/ M anipulation |
|
|
-------------------------------------------------------------------------------
|
|
Copyright (C) 2017-2021 OpenCFD Ltd.
|
|
-------------------------------------------------------------------------------
|
|
License
|
|
This file is part of OpenFOAM.
|
|
|
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
|
|
|
template<class StringType>
|
|
inline Foam::word Foam::IOobject::groupName
|
|
(
|
|
StringType base,
|
|
const word& group
|
|
)
|
|
{
|
|
if (group.empty())
|
|
{
|
|
return base;
|
|
}
|
|
|
|
return base + ('.' + group);
|
|
}
|
|
|
|
|
|
template<class StringType>
|
|
inline Foam::word Foam::IOobject::scopedName
|
|
(
|
|
StringType scope,
|
|
const word& name
|
|
)
|
|
{
|
|
if (name.empty())
|
|
{
|
|
return scope;
|
|
}
|
|
else if (scope.empty())
|
|
{
|
|
return name;
|
|
}
|
|
|
|
return scope + (IOobject::scopeSeparator + name);
|
|
}
|
|
|
|
|
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
|
|
// General access
|
|
|
|
inline const Foam::word& Foam::IOobject::name() const noexcept
|
|
{
|
|
return name_;
|
|
}
|
|
|
|
|
|
inline Foam::word Foam::IOobject::group() const
|
|
{
|
|
return name_.ext();
|
|
}
|
|
|
|
|
|
inline Foam::word Foam::IOobject::member() const
|
|
{
|
|
return name_.lessExt();
|
|
}
|
|
|
|
|
|
inline const Foam::word& Foam::IOobject::headerClassName() const noexcept
|
|
{
|
|
return headerClassName_;
|
|
}
|
|
|
|
|
|
inline Foam::word& Foam::IOobject::headerClassName() noexcept
|
|
{
|
|
return headerClassName_;
|
|
}
|
|
|
|
|
|
inline const Foam::string& Foam::IOobject::note() const noexcept
|
|
{
|
|
return note_;
|
|
}
|
|
|
|
|
|
inline Foam::string& Foam::IOobject::note() noexcept
|
|
{
|
|
return note_;
|
|
}
|
|
|
|
|
|
inline bool Foam::IOobject::registerObject() const noexcept
|
|
{
|
|
return registerObject_;
|
|
}
|
|
|
|
|
|
inline bool& Foam::IOobject::registerObject() noexcept
|
|
{
|
|
return registerObject_;
|
|
}
|
|
|
|
|
|
inline bool Foam::IOobject::globalObject() const noexcept
|
|
{
|
|
return globalObject_;
|
|
}
|
|
|
|
|
|
inline bool& Foam::IOobject::globalObject() noexcept
|
|
{
|
|
return globalObject_;
|
|
}
|
|
|
|
|
|
inline unsigned Foam::IOobject::labelByteSize() const noexcept
|
|
{
|
|
return static_cast<unsigned>(sizeofLabel_);
|
|
}
|
|
|
|
|
|
inline unsigned Foam::IOobject::scalarByteSize() const noexcept
|
|
{
|
|
return static_cast<unsigned>(sizeofScalar_);
|
|
}
|
|
|
|
|
|
// Checks
|
|
|
|
inline bool Foam::IOobject::isHeaderClassName(const word& clsName) const
|
|
{
|
|
return (clsName == headerClassName_);
|
|
}
|
|
|
|
|
|
template<class Type>
|
|
inline bool Foam::IOobject::isHeaderClassName() const
|
|
{
|
|
return (Type::typeName == headerClassName_);
|
|
}
|
|
|
|
|
|
// Read/write options
|
|
|
|
inline Foam::IOobject::readOption Foam::IOobject::readOpt() const noexcept
|
|
{
|
|
return rOpt_;
|
|
}
|
|
|
|
|
|
inline Foam::IOobject::readOption& Foam::IOobject::readOpt() noexcept
|
|
{
|
|
return rOpt_;
|
|
}
|
|
|
|
|
|
inline Foam::IOobject::writeOption Foam::IOobject::writeOpt() const noexcept
|
|
{
|
|
return wOpt_;
|
|
}
|
|
|
|
|
|
inline Foam::IOobject::writeOption& Foam::IOobject::writeOpt() noexcept
|
|
{
|
|
return wOpt_;
|
|
}
|
|
|
|
|
|
// Path components
|
|
|
|
inline const Foam::fileName& Foam::IOobject::instance() const noexcept
|
|
{
|
|
return instance_;
|
|
}
|
|
|
|
|
|
inline Foam::fileName& Foam::IOobject::instance() noexcept
|
|
{
|
|
return instance_;
|
|
}
|
|
|
|
|
|
inline const Foam::fileName& Foam::IOobject::local() const noexcept
|
|
{
|
|
return local_;
|
|
}
|
|
|
|
|
|
inline Foam::fileName Foam::IOobject::objectPath() const
|
|
{
|
|
return path()/name();
|
|
}
|
|
|
|
|
|
// Error Handling
|
|
|
|
inline bool Foam::IOobject::good() const noexcept
|
|
{
|
|
return objState_ == GOOD;
|
|
}
|
|
|
|
|
|
inline bool Foam::IOobject::bad() const noexcept
|
|
{
|
|
return objState_ == BAD;
|
|
}
|
|
|
|
|
|
// ************************************************************************* //
|