STYLE: rename readContents -> readIOcontents for private/protected method

- leave 'readContents' method name for exposed (public) methods.
  Generally not a problem, but can confuse the compiler when various
  public/private versions are available with the same number of
  parameters.

STYLE: adjust meshObject debug statements
This commit is contained in:
Mark Olesen 2024-04-08 09:45:31 +02:00
parent 0dcc53ab03
commit 68c5d90ad0
37 changed files with 257 additions and 299 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,8 +32,26 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class T, class BaseType>
void Foam::CompactIOField<T, BaseType>::readFromStream(const bool readOnProc)
bool Foam::CompactIOField<T, BaseType>::readIOcontents(bool readOnProc)
{
if (readOpt() == IOobject::MUST_READ)
{
// Reading
}
else if (isReadOptional())
{
if (!headerOk())
{
readOnProc = false;
}
}
else
{
return false;
}
// Do reading
Istream& is = readStream(word::null, readOnProc);
if (readOnProc)
@ -58,23 +76,8 @@ void Foam::CompactIOField<T, BaseType>::readFromStream(const bool readOnProc)
<< exit(FatalIOError);
}
}
}
template<class T, class BaseType>
bool Foam::CompactIOField<T, BaseType>::readContents()
{
if
(
readOpt() == IOobject::MUST_READ
|| (isReadOptional() && headerOk())
)
{
readFromStream();
return true;
}
return false;
return true;
}
@ -85,7 +88,7 @@ Foam::CompactIOField<T, BaseType>::CompactIOField(const IOobject& io)
:
regIOobject(io)
{
readContents();
readIOcontents();
}
@ -98,15 +101,7 @@ Foam::CompactIOField<T, BaseType>::CompactIOField
:
regIOobject(io)
{
if (readOpt() == IOobject::MUST_READ)
{
readFromStream(readOnProc);
}
else if (isReadOptional())
{
const bool haveFile = headerOk();
readFromStream(readOnProc && haveFile);
}
readIOcontents(readOnProc);
}
@ -119,7 +114,7 @@ Foam::CompactIOField<T, BaseType>::CompactIOField
:
regIOobject(io)
{
readContents();
readIOcontents();
}
@ -132,7 +127,7 @@ Foam::CompactIOField<T, BaseType>::CompactIOField
:
regIOobject(io)
{
if (!readContents())
if (!readIOcontents())
{
Field<T>::resize(len);
}
@ -148,7 +143,7 @@ Foam::CompactIOField<T, BaseType>::CompactIOField
:
regIOobject(io)
{
if (!readContents())
if (!readIOcontents())
{
Field<T>::operator=(content);
}
@ -166,7 +161,7 @@ Foam::CompactIOField<T, BaseType>::CompactIOField
{
Field<T>::transfer(content);
readContents();
readIOcontents();
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020-2022 OpenCFD Ltd.
Copyright (C) 2020-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -76,13 +76,10 @@ class CompactIOField
{
// Private Member Functions
//- Read according to header type, with optional 'on-proc' value
void readFromStream(const bool readOnProc = true);
//- Read if IOobject flags set. Return true if read.
// Reads according to the header type
bool readContents();
//- Read if IOobject flags set and 'on-proc' is true.
//- Reads according to the header type.
// Return true if read (only accurate when readOnProc == true).
bool readIOcontents(bool readOnProc = true);
public:

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2022 OpenCFD Ltd.
Copyright (C) 2015-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,34 +32,7 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class T, class BaseType>
void Foam::CompactIOList<T, BaseType>::readFromStream()
{
Istream& is = readStream(word::null);
if (headerClassName() == IOList<T>::typeName)
{
is >> static_cast<List<T>&>(*this);
close();
}
else if (headerClassName() == typeName)
{
is >> *this;
close();
}
else
{
FatalIOErrorInFunction(is)
<< "unexpected class name " << headerClassName()
<< " expected " << typeName
<< " or " << IOList<T>::typeName << endl
<< " while reading object " << name()
<< exit(FatalIOError);
}
}
template<class T, class BaseType>
bool Foam::CompactIOList<T, BaseType>::readContents()
bool Foam::CompactIOList<T, BaseType>::readIOcontents()
{
if
(
@ -67,7 +40,28 @@ bool Foam::CompactIOList<T, BaseType>::readContents()
|| (isReadOptional() && headerOk())
)
{
readFromStream();
Istream& is = readStream(word::null);
if (headerClassName() == IOList<T>::typeName)
{
is >> static_cast<List<T>&>(*this);
close();
}
else if (headerClassName() == typeName)
{
is >> *this;
close();
}
else
{
FatalIOErrorInFunction(is)
<< "Unexpected class name " << headerClassName()
<< " expected " << typeName
<< " or " << IOList<T>::typeName << endl
<< " while reading object " << name()
<< exit(FatalIOError);
}
return true;
}
@ -78,12 +72,14 @@ bool Foam::CompactIOList<T, BaseType>::readContents()
template<class T, class BaseType>
bool Foam::CompactIOList<T, BaseType>::overflows() const
{
label size = 0;
forAll(*this, i)
const List<T>& lists = *this;
label total = 0;
for (const auto& sublist : lists)
{
const label oldSize = size;
size += this->operator[](i).size();
if (size < oldSize)
const label prev = total;
total += sublist.size();
if (total < prev)
{
return true;
}
@ -99,7 +95,7 @@ Foam::CompactIOList<T, BaseType>::CompactIOList(const IOobject& io)
:
regIOobject(io)
{
readContents();
readIOcontents();
}
@ -112,7 +108,7 @@ Foam::CompactIOList<T, BaseType>::CompactIOList
:
regIOobject(io)
{
readContents();
readIOcontents();
}
@ -125,7 +121,7 @@ Foam::CompactIOList<T, BaseType>::CompactIOList
:
regIOobject(io)
{
if (!readContents())
if (!readIOcontents())
{
List<T>::resize(len);
}
@ -141,7 +137,7 @@ Foam::CompactIOList<T, BaseType>::CompactIOList
:
regIOobject(io)
{
if (!readContents())
if (!readIOcontents())
{
List<T>::operator=(content);
}
@ -159,7 +155,7 @@ Foam::CompactIOList<T, BaseType>::CompactIOList
{
List<T>::transfer(content);
readContents();
readIOcontents();
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -43,7 +43,6 @@ SourceFiles
#define Foam_CompactIOList_H
#include "IOList.H"
#include "regIOobject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -76,12 +75,10 @@ class CompactIOList
{
// Private Member Functions
//- Read according to header type
void readFromStream();
//- Read if IOobject flags set. Return true if read.
// Reads according to the header type
bool readContents();
//- Reads according to the header type.
// Return true if read.
bool readIOcontents();
//- Has too many elements in it?
bool overflows() const;
@ -130,7 +127,7 @@ public:
const bool writeOnProc
) const;
virtual bool writeData(Ostream&) const;
virtual bool writeData(Ostream& os) const;
// Member Operators
@ -140,23 +137,6 @@ public:
//- Copy or move assignment of entries
using List<T>::operator=;
// IOstream operators
//- Read List from Istream, discarding contents of existing List.
friend Istream& operator>> <T, BaseType>
(
Istream&,
CompactIOList<T, BaseType>&
);
// Write List to Ostream.
friend Ostream& operator<< <T, BaseType>
(
Ostream&,
const CompactIOList<T, BaseType>&
);
};

View File

@ -91,14 +91,14 @@ public:
// Member Functions
//- Is object global
//- This object is global
virtual bool global() const
{
return true;
}
//- Return complete path + object name if the file exists
// either in the case/processor or case otherwise null
//- either in the case/processor or case otherwise null
virtual fileName filePath() const
{
return globalFilePath(type());

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-2023 OpenCFD Ltd.
Copyright (C) 2016-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,8 +31,26 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
void Foam::IOField<Type>::readFromStream(const bool readOnProc)
bool Foam::IOField<Type>::readIOcontents(bool readOnProc)
{
if (isReadRequired())
{
// Reading
}
else if (isReadOptional())
{
if (!headerOk())
{
readOnProc = false;
}
}
else
{
return false;
}
// Do reading
Istream& is = readStream(typeName, readOnProc);
if (readOnProc)
@ -40,19 +58,7 @@ void Foam::IOField<Type>::readFromStream(const bool readOnProc)
is >> *this;
}
close();
}
template<class Type>
bool Foam::IOField<Type>::readContents()
{
if (isReadRequired() || (isReadOptional() && headerOk()))
{
readFromStream();
return true;
}
return false;
return true;
}
@ -66,7 +72,7 @@ Foam::IOField<Type>::IOField(const IOobject& io)
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOField<Type>>();
readContents();
readIOcontents();
}
@ -78,15 +84,7 @@ Foam::IOField<Type>::IOField(const IOobject& io, const bool readOnProc)
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOField<Type>>();
if (isReadRequired())
{
readFromStream(readOnProc);
}
else if (isReadOptional())
{
const bool haveFile = headerOk();
readFromStream(readOnProc && haveFile);
}
readIOcontents(readOnProc);
}
@ -98,7 +96,7 @@ Foam::IOField<Type>::IOField(const IOobject& io, Foam::zero)
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOField<Type>>();
readContents();
readIOcontents();
}
@ -110,7 +108,7 @@ Foam::IOField<Type>::IOField(const IOobject& io, const label len)
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOField<Type>>();
if (!readContents())
if (!readIOcontents())
{
Field<Type>::resize(len);
}
@ -125,7 +123,7 @@ Foam::IOField<Type>::IOField(const IOobject& io, const UList<Type>& content)
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOField<Type>>();
if (!readContents())
if (!readIOcontents())
{
Field<Type>::operator=(content);
}
@ -142,7 +140,7 @@ Foam::IOField<Type>::IOField(const IOobject& io, Field<Type>&& content)
Field<Type>::transfer(content);
readContents();
readIOcontents();
}
@ -158,7 +156,7 @@ Foam::IOField<Type>::IOField(const IOobject& io, const tmp<Field<Type>>& tfld)
Field<Type>::transfer(tfld.ref());
}
if (!readContents() && !reuse)
if (!readIOcontents() && !reuse)
{
Field<Type>::operator=(tfld());
}
@ -185,7 +183,7 @@ template<class Type>
Foam::Field<Type> Foam::IOField<Type>::readContents(const IOobject& io)
{
IOobject rio(io, IOobjectOption::NO_REGISTER);
if (rio.readOpt() == IOobjectOption::MUST_READ_IF_MODIFIED)
if (rio.readOpt() == IOobjectOption::READ_MODIFIED)
{
rio.readOpt(IOobjectOption::MUST_READ);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2023 OpenCFD Ltd.
Copyright (C) 2018-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -58,11 +58,9 @@ class IOField
{
// Private Member Functions
//- Read with optional 'on-proc' value
void readFromStream(const bool readOnProc = true);
//- Read if IOobject flags set. Return true if read.
bool readContents();
//- Read if IOobject flags set and 'on-proc' is true.
// Return true if read (only accurate when readOnProc == true).
bool readIOcontents(bool readOnProc = true);
public:

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2023 OpenCFD Ltd.
Copyright (C) 2016-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,7 +31,7 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class T>
bool Foam::IOList<T>::readContents()
bool Foam::IOList<T>::readIOcontents()
{
if (isReadRequired() || (isReadOptional() && headerOk()))
{
@ -54,7 +54,7 @@ Foam::IOList<T>::IOList(const IOobject& io)
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOList<T>>();
readContents();
readIOcontents();
}
@ -66,7 +66,7 @@ Foam::IOList<T>::IOList(const IOobject& io, Foam::zero)
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOList<T>>();
readContents();
readIOcontents();
}
@ -78,7 +78,7 @@ Foam::IOList<T>::IOList(const IOobject& io, const label len)
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOList<T>>();
if (!readContents())
if (!readIOcontents())
{
List<T>::resize(len);
}
@ -93,7 +93,7 @@ Foam::IOList<T>::IOList(const IOobject& io, const UList<T>& content)
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<IOList<T>>();
if (!readContents())
if (!readIOcontents())
{
List<T>::operator=(content);
}
@ -110,7 +110,7 @@ Foam::IOList<T>::IOList(const IOobject& io, List<T>&& content)
List<T>::transfer(content);
readContents();
readIOcontents();
}
@ -132,7 +132,7 @@ template<class T>
Foam::List<T> Foam::IOList<T>::readContents(const IOobject& io)
{
IOobject rio(io, IOobjectOption::NO_REGISTER);
if (rio.readOpt() == IOobjectOption::MUST_READ_IF_MODIFIED)
if (rio.readOpt() == IOobjectOption::READ_MODIFIED)
{
rio.readOpt(IOobjectOption::MUST_READ);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2023 OpenCFD Ltd.
Copyright (C) 2018-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -59,7 +59,7 @@ class IOList
// Private Member Functions
//- Read if IOobject flags set. Return true if read.
bool readContents();
bool readIOcontents();
public:

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2023 OpenCFD Ltd.
Copyright (C) 2018-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,7 +31,7 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class T>
bool Foam::IOMap<T>::readContents()
bool Foam::IOMap<T>::readIOcontents()
{
if (isReadRequired() || (isReadOptional() && headerOk()))
{
@ -55,7 +55,7 @@ Foam::IOMap<T>::IOMap(const IOobject& io)
:
regIOobject(io)
{
readContents();
readIOcontents();
}
@ -64,7 +64,7 @@ Foam::IOMap<T>::IOMap(const IOobject& io, const label size)
:
regIOobject(io)
{
if (!readContents())
if (!readIOcontents())
{
Map<T>::resize(size);
}
@ -76,7 +76,7 @@ Foam::IOMap<T>::IOMap(const IOobject& io, const Map<T>& content)
:
regIOobject(io)
{
if (!readContents())
if (!readIOcontents())
{
Map<T>::operator=(content);
}
@ -90,7 +90,7 @@ Foam::IOMap<T>::IOMap(const IOobject& io, Map<T>&& content)
{
Map<T>::transfer(content);
readContents();
readIOcontents();
}
@ -100,7 +100,7 @@ template<class T>
Foam::Map<T> Foam::IOMap<T>::readContents(const IOobject& io)
{
IOobject rio(io, IOobjectOption::NO_REGISTER);
if (rio.readOpt() == IOobjectOption::MUST_READ_IF_MODIFIED)
if (rio.readOpt() == IOobjectOption::READ_MODIFIED)
{
rio.readOpt(IOobjectOption::MUST_READ);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2023 OpenCFD Ltd.
Copyright (C) 2018-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -60,7 +60,7 @@ class IOMap
// Private Member Functions
//- Read if IOobject flags set. Return true if read.
bool readContents();
bool readIOcontents();
public:

View File

@ -122,7 +122,7 @@ template<class T>
Foam::PtrList<T> Foam::IOPtrList<T>::readContents(const IOobject& io)
{
IOobject rio(io, IOobjectOption::NO_REGISTER);
if (rio.readOpt() == IOobjectOption::MUST_READ_IF_MODIFIED)
if (rio.readOpt() == IOobjectOption::READ_MODIFIED)
{
rio.readOpt(IOobjectOption::MUST_READ);
}

View File

@ -96,7 +96,7 @@ Foam::IOdictionary::IOdictionary
Foam::dictionary Foam::IOdictionary::readContents(const IOobject& io)
{
IOobject rio(io, IOobjectOption::NO_REGISTER);
if (rio.readOpt() == IOobjectOption::MUST_READ_IF_MODIFIED)
if (rio.readOpt() == IOobjectOption::READ_MODIFIED)
{
rio.readOpt(IOobjectOption::MUST_READ);
}

View File

@ -93,7 +93,7 @@ Foam::localIOdictionary::localIOdictionary
Foam::dictionary Foam::localIOdictionary::readContents(const IOobject& io)
{
IOobject rio(io, IOobjectOption::NO_REGISTER);
if (rio.readOpt() == IOobjectOption::MUST_READ_IF_MODIFIED)
if (rio.readOpt() == IOobjectOption::READ_MODIFIED)
{
rio.readOpt(IOobjectOption::MUST_READ);
}

View File

@ -97,7 +97,7 @@ Foam::label Foam::unwatchedIOdictionary::addWatch(const fileName& f)
{
label index = -1;
if (readOpt() == IOobject::MUST_READ_IF_MODIFIED)
if (readOpt() == IOobjectOption::READ_MODIFIED)
{
index = files_.find(f);
@ -113,7 +113,7 @@ Foam::label Foam::unwatchedIOdictionary::addWatch(const fileName& f)
void Foam::unwatchedIOdictionary::addWatch()
{
if (readOpt() == IOobject::MUST_READ_IF_MODIFIED)
if (readOpt() == IOobjectOption::READ_MODIFIED)
{
fileName f = filePath();
if (f.empty())

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2023 OpenCFD Ltd.
Copyright (C) 2016-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,7 +31,7 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
void Foam::rawIOField<Type>::readContents
void Foam::rawIOField<Type>::readIOcontents
(
Istream& is,
IOobjectOption::readOption readAverage
@ -65,7 +65,7 @@ void Foam::rawIOField<Type>::readContents
template<class Type>
bool Foam::rawIOField<Type>::readContents
bool Foam::rawIOField<Type>::readIOcontents
(
IOobjectOption::readOption readAverage
)
@ -111,7 +111,7 @@ bool Foam::rawIOField<Type>::readContents
if (is.good())
{
readContents(is, readAverage);
readIOcontents(is, readAverage);
close();
}
}
@ -122,7 +122,7 @@ bool Foam::rawIOField<Type>::readContents
if (isPtr && isPtr->good())
{
readContents(*isPtr, readAverage);
readIOcontents(*isPtr, readAverage);
}
else
{
@ -165,7 +165,7 @@ Foam::rawIOField<Type>::rawIOField
// Check for MUST_READ_IF_MODIFIED
warnNoRereading<rawIOField<Type>>();
readContents(readAverage);
readIOcontents(readAverage);
}
@ -194,7 +194,7 @@ template<class Type>
Foam::Field<Type> Foam::rawIOField<Type>::readContents(const IOobject& io)
{
IOobject rio(io, IOobjectOption::NO_REGISTER);
if (rio.readOpt() == IOobjectOption::MUST_READ_IF_MODIFIED)
if (rio.readOpt() == IOobjectOption::READ_MODIFIED)
{
rio.readOpt(IOobjectOption::MUST_READ);
}

View File

@ -67,10 +67,10 @@ class rawIOField
// Private Member Functions
//- Read contents and average
void readContents(Istream&, IOobjectOption::readOption readAverage);
void readIOcontents(Istream&, IOobjectOption::readOption readAverage);
//- Read if IOobject flags set. Return true if read.
bool readContents(IOobjectOption::readOption readAverage);
bool readIOcontents(IOobjectOption::readOption readAverage);
public:

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2014-2015 OpenFOAM Foundation
Copyright (C) 2015-2022 OpenCFD Ltd.
Copyright (C) 2015-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -38,7 +38,7 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::IOmapDistribute::readContents()
bool Foam::IOmapDistribute::readIOcontents()
{
if (isReadRequired() || (isReadOptional() && headerOk()))
{
@ -60,7 +60,7 @@ Foam::IOmapDistribute::IOmapDistribute(const IOobject& io)
// Warn for MUST_READ_IF_MODIFIED
warnNoRereading<IOmapDistribute>();
readContents();
readIOcontents();
}
@ -75,7 +75,7 @@ Foam::IOmapDistribute::IOmapDistribute
// Warn for MUST_READ_IF_MODIFIED
warnNoRereading<IOmapDistribute>();
if (!readContents())
if (!readIOcontents())
{
mapDistribute::operator=(map);
}
@ -95,7 +95,7 @@ Foam::IOmapDistribute::IOmapDistribute
mapDistribute::transfer(map);
readContents();
readIOcontents();
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2014 OpenFOAM Foundation
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -60,7 +60,7 @@ class IOmapDistribute
// Private Member Functions
//- Read if IOobject flags set. Return true if read.
bool readContents();
bool readIOcontents();
public:

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
Copyright (C) 2022-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -38,7 +38,7 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::IOmapDistributePolyMesh::readContents()
bool Foam::IOmapDistributePolyMesh::readIOcontents()
{
if (isReadRequired() || (isReadOptional() && headerOk()))
{
@ -60,7 +60,7 @@ Foam::IOmapDistributePolyMesh::IOmapDistributePolyMesh(const IOobject& io)
// Warn for MUST_READ_IF_MODIFIED
warnNoRereading<IOmapDistributePolyMesh>();
readContents();
readIOcontents();
}
@ -75,7 +75,7 @@ Foam::IOmapDistributePolyMesh::IOmapDistributePolyMesh
// Warn for MUST_READ_IF_MODIFIED
warnNoRereading<IOmapDistributePolyMesh>();
if (!readContents())
if (!readIOcontents())
{
mapDistributePolyMesh::operator=(map);
}
@ -95,7 +95,7 @@ Foam::IOmapDistributePolyMesh::IOmapDistributePolyMesh
mapDistributePolyMesh::transfer(map);
readContents();
readIOcontents();
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
Copyright (C) 2022-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -60,7 +60,7 @@ class IOmapDistributePolyMesh
// Private Member Functions
//- Read if IOobject flags set. Return true if read.
bool readContents();
bool readIOcontents();
public:

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2023 OpenCFD Ltd.
Copyright (C) 2018-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -134,7 +134,7 @@ void Foam::polyBoundaryMesh::populate(PtrList<entry>&& entries)
}
bool Foam::polyBoundaryMesh::readContents(const bool allowOptionalRead)
bool Foam::polyBoundaryMesh::readIOcontents(const bool allowOptionalRead)
{
bool updated = false;
PtrList<entry> entries;
@ -180,7 +180,7 @@ Foam::polyBoundaryMesh::polyBoundaryMesh
regIOobject(io),
mesh_(mesh)
{
readContents(false); // allowOptionalRead = false
readIOcontents(false); // allowOptionalRead = false
}
@ -221,7 +221,7 @@ Foam::polyBoundaryMesh::polyBoundaryMesh
regIOobject(io),
mesh_(pm)
{
if (!readContents(true)) // allowOptionalRead = true
if (!readIOcontents(true)) // allowOptionalRead = true
{
// Nothing read. Use supplied patches
polyPatchList& patches = *this;
@ -246,7 +246,7 @@ Foam::polyBoundaryMesh::polyBoundaryMesh
regIOobject(io),
mesh_(pm)
{
if (!readContents(true)) // allowOptionalRead = true
if (!readIOcontents(true)) // allowOptionalRead = true
{
populate(std::move(entries));
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2023 OpenCFD Ltd.
Copyright (C) 2018-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -101,7 +101,7 @@ class polyBoundaryMesh
//- Return true if contents were read
//- (controlled by IOobject readOption flags).
bool readContents(const bool allowOptionalRead);
bool readIOcontents(const bool allowOptionalRead);
public:

View File

@ -46,8 +46,7 @@ Foam::polyBoundaryMeshEntries::polyBoundaryMeshEntries(const IOobject& io)
IOobject(io, IOobjectOption::NO_REGISTER)
)
{
// readContents()
// readIOcontents()
if (isReadRequired() || (isReadOptional() && headerOk()))
{
// Read as entries

View File

@ -258,7 +258,7 @@ void Foam::ZoneMesh<ZoneType, MeshType>::populate
template<class ZoneType, class MeshType>
bool Foam::ZoneMesh<ZoneType, MeshType>::readContents
bool Foam::ZoneMesh<ZoneType, MeshType>::readIOcontents
(
const bool allowOptionalRead
)
@ -311,7 +311,7 @@ Foam::ZoneMesh<ZoneType, MeshType>::ZoneMesh
{
// Note: this is inconsistent with polyBoundaryMesh
// which does not permit optional reading
readContents(true); // allowOptionalRead = true
readIOcontents(true); // allowOptionalRead = true
}
@ -343,7 +343,7 @@ Foam::ZoneMesh<ZoneType, MeshType>::ZoneMesh
{
// Note: this is inconsistent with polyBoundaryMesh
// which does not read all
readContents(true); // allowOptionalRead = true
readIOcontents(true); // allowOptionalRead = true
}
@ -359,7 +359,7 @@ Foam::ZoneMesh<ZoneType, MeshType>::ZoneMesh
regIOobject(io),
mesh_(mesh)
{
if (!readContents(true)) // allowOptionalRead = true
if (!readIOcontents(true)) // allowOptionalRead = true
{
// Nothing read. Use supplied zones
PtrList<ZoneType>& zones = *this;
@ -385,7 +385,7 @@ Foam::ZoneMesh<ZoneType, MeshType>::ZoneMesh
regIOobject(io),
mesh_(mesh)
{
if (!readContents(true)) // allowOptionalRead = true
if (!readIOcontents(true)) // allowOptionalRead = true
{
populate(std::move(entries));
}

View File

@ -106,7 +106,7 @@ class ZoneMesh
//- Return true if contents were read
//- (controlled by IOobject readOption flags).
bool readContents(const bool allowOptionalRead);
bool readIOcontents(const bool allowOptionalRead);
public:

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -46,55 +46,53 @@ static const char* headerTypeCompat = "IOPtrList<coordinateSystem>";
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::coordinateSystems::readFromStream(const bool readOnProc)
{
Istream& is = readStream(word::null, readOnProc);
if (readOnProc)
{
if (headerClassName() == typeName)
{
this->readIstream(is, coordinateSystem::iNew());
close();
}
else if (headerClassName() == headerTypeCompat)
{
// Older (1806 and earlier) header name
if (error::master())
{
std::cerr
<< "--> FOAM IOWarning :" << nl
<< " Found header class name '" << headerTypeCompat
<< "' instead of '" << typeName << "'" << nl;
error::warnAboutAge("header class", 1806);
}
this->readIstream(is, coordinateSystem::iNew());
close();
}
else
{
FatalIOErrorInFunction(is)
<< "unexpected class name " << headerClassName()
<< " expected " << typeName
<< " or " << headerTypeCompat << nl
<< " while reading object " << name()
<< exit(FatalIOError);
}
}
}
bool Foam::coordinateSystems::readContents()
bool Foam::coordinateSystems::readIOcontents()
{
if (isReadRequired() || (isReadOptional() && headerOk()))
{
readFromStream();
return true;
// Attempt reading
}
else
{
return false;
}
return false;
// Do reading
Istream& is = readStream(word::null);
if (headerClassName() == typeName)
{
this->readIstream(is, coordinateSystem::iNew());
close();
}
else if (headerClassName() == headerTypeCompat)
{
// Older (1806 and earlier) header name
if (error::master())
{
std::cerr
<< "--> FOAM IOWarning :" << nl
<< " Found header class name '" << headerTypeCompat
<< "' instead of '" << typeName << "'" << nl;
error::warnAboutAge("header class", 1806);
}
this->readIstream(is, coordinateSystem::iNew());
close();
}
else
{
FatalIOErrorInFunction(is)
<< "Unexpected class name " << headerClassName()
<< " expected " << typeName
<< " or " << headerTypeCompat << nl
<< " while reading object " << name()
<< exit(FatalIOError);
}
return true;
}
@ -102,10 +100,9 @@ bool Foam::coordinateSystems::readContents()
Foam::coordinateSystems::coordinateSystems(const IOobject& io)
:
regIOobject(io),
PtrList<coordinateSystem>()
regIOobject(io)
{
readContents();
readIOcontents();
}
@ -131,10 +128,9 @@ Foam::coordinateSystems::coordinateSystems
const PtrList<coordinateSystem>& content
)
:
regIOobject(io),
PtrList<coordinateSystem>()
regIOobject(io)
{
if (!readContents())
if (!readIOcontents())
{
static_cast<PtrList<coordinateSystem>&>(*this) = content;
}
@ -150,7 +146,7 @@ Foam::coordinateSystems::coordinateSystems
regIOobject(io),
PtrList<coordinateSystem>(std::move(content))
{
readContents();
readIOcontents();
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -83,11 +83,18 @@ class coordinateSystems
{
// Private Member Functions
//- Read "coordinateSystems" or older "IOPtrList<coordinateSystem>"
void readFromStream(const bool readOnProc = true);
//- Read if IOobject flags set.
//- Reads "coordinateSystems" or older "IOPtrList<coordinateSystem>"
// Return true if read.
bool readIOcontents();
//- Read if IOobject flags set. Return true if read.
bool readContents();
public:
//- Declare type-name, virtual type (without debug switch)
TypeNameNoDebug("coordinateSystems");
// Generated Methods
//- No copy construct
coordinateSystems(const coordinateSystems&) = delete;
@ -96,12 +103,6 @@ class coordinateSystems
void operator=(const coordinateSystems&) = delete;
public:
//- Declare type-name, virtual type (without debug switch)
TypeNameNoDebug("coordinateSystems");
// Constructors
//- Read construct from IOobject

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2022 OpenCFD Ltd.
Copyright (C) 2015-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -43,7 +43,7 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::refinementHistory::readContents()
bool Foam::refinementHistory::readIOcontents()
{
if (isReadRequired() || (isReadOptional() && headerOk()))
{
@ -566,7 +566,7 @@ Foam::refinementHistory::refinementHistory(const IOobject& io)
// Warn for MUST_READ_IF_MODIFIED
warnNoRereading<refinementHistory>();
readContents();
readIOcontents();
// When running in redistributePar + READ_IF_PRESENT it can happen
// that some processors do have refinementHistory and some don't so
@ -602,7 +602,7 @@ Foam::refinementHistory::refinementHistory
// Warn for MUST_READ_IF_MODIFIED
warnNoRereading<refinementHistory>();
readContents();
readIOcontents();
// Check indices.
checkIndices();
@ -632,7 +632,7 @@ Foam::refinementHistory::refinementHistory
// Warn for MUST_READ_IF_MODIFIED
warnNoRereading<refinementHistory>();
if (!readContents())
if (!readIOcontents())
{
visibleCells_.setSize(nCells);
splitCells_.setCapacity(nCells);
@ -677,7 +677,7 @@ Foam::refinementHistory::refinementHistory
// Warn for MUST_READ_IF_MODIFIED
warnNoRereading<refinementHistory>();
if (!readContents())
if (!readIOcontents())
{
visibleCells_.setSize(nCells);
splitCells_.setCapacity(nCells);
@ -737,8 +737,7 @@ Foam::refinementHistory::refinementHistory
if (io.isAnyRead())
{
WarningInFunction
<< "read option IOobject::MUST_READ or READ_IF_PRESENT "
<< "or MUST_READ_IF_MODIFIED"
<< "Read option MUST_READ, READ_IF_PRESENT or READ_MODIFIED"
<< " suggests that a read constructor would be more appropriate."
<< endl;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2015-2020 OpenCFD Ltd.
Copyright (C) 2015-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -176,7 +176,7 @@ private:
);
//- Read if IOobject flags set. Return true if read.
bool readContents();
bool readIOcontents();
//- Check consistency of structure, i.e. indices into splitCells_.
void checkIndices() const;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -42,7 +42,7 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::polyTopoChanger::readContents()
bool Foam::polyTopoChanger::readIOcontents()
{
if (isReadRequired() || (isReadOptional() && headerOk()))
{
@ -93,7 +93,7 @@ Foam::polyTopoChanger::polyTopoChanger
// Warn for MUST_READ_IF_MODIFIED
warnNoRereading<polyTopoChanger>();
readContents();
readIOcontents();
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -68,7 +68,7 @@ class polyTopoChanger
// Private Member Functions
//- Read if IOobject flags set, set modifiers. Return true if read.
bool readContents();
bool readIOcontents();
//- No copy construct
polyTopoChanger(const polyTopoChanger&) = delete;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2018-2023 OpenCFD Ltd.
Copyright (C) 2018-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -129,14 +129,14 @@ void Foam::faBoundaryMesh::populate(PtrList<entry>&& entries)
}
bool Foam::faBoundaryMesh::readContents(const bool allowOptionalRead)
bool Foam::faBoundaryMesh::readIOcontents(const bool allowOptionalRead)
{
bool updated = false;
PtrList<entry> entries;
if
(
isReadRequired()
this->isReadRequired()
|| (allowOptionalRead && this->isReadOptional() && this->headerOk())
)
{
@ -175,7 +175,7 @@ Foam::faBoundaryMesh::faBoundaryMesh
regIOobject(io),
mesh_(mesh)
{
readContents(false); // allowOptionalRead = false
readIOcontents(false); // allowOptionalRead = false
}
@ -216,7 +216,7 @@ Foam::faBoundaryMesh::faBoundaryMesh
regIOobject(io),
mesh_(fam)
{
if (!readContents(true)) // allowOptionalRead = true
if (!readIOcontents(true)) // allowOptionalRead = true
{
// Nothing read. Use supplied patches
faPatchList& patches = *this;
@ -241,7 +241,7 @@ Foam::faBoundaryMesh::faBoundaryMesh
regIOobject(io),
mesh_(fam)
{
if (!readContents(true)) // allowOptionalRead = true
if (!readIOcontents(true)) // allowOptionalRead = true
{
populate(std::move(entries));
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2018-2023 OpenCFD Ltd.
Copyright (C) 2018-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -94,7 +94,7 @@ class faBoundaryMesh
//- Return true if contents were read
//- (controlled by IOobject readOption flags).
bool readContents(const bool allowOptionalRead);
bool readIOcontents(const bool allowOptionalRead);
public:

View File

@ -45,8 +45,7 @@ Foam::faBoundaryMeshEntries::faBoundaryMeshEntries(const IOobject& io)
IOobject(io, IOobjectOption::NO_REGISTER)
)
{
// readContents()
// readIOcontents()
if (isReadRequired() || (isReadOptional() && headerOk()))
{
// Read as entries

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2023 OpenCFD Ltd.
Copyright (C) 2018-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -38,7 +38,7 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::surfZoneIOList::readContents()
bool Foam::surfZoneIOList::readIOcontents()
{
if
(
@ -96,7 +96,7 @@ Foam::surfZoneIOList::surfZoneIOList
regIOobject(io),
surfZoneList()
{
readContents(); // allowOptionalRead = false
readIOcontents(); // allowOptionalRead = false
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2023 OpenCFD Ltd.
Copyright (C) 2018-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -60,7 +60,7 @@ class surfZoneIOList
//- Return true if contents were read
//- (controlled by IOobject readOption flags).
bool readContents();
bool readIOcontents();
public: