From 68c5d90ad02b590e10b89cf769b3c63fe101d7f2 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 8 Apr 2024 09:45:31 +0200 Subject: [PATCH] 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 --- .../IOobjects/CompactIOField/CompactIOField.C | 59 +++++------ .../IOobjects/CompactIOField/CompactIOField.H | 13 +-- .../IOobjects/CompactIOList/CompactIOList.C | 76 +++++++------ .../IOobjects/CompactIOList/CompactIOList.H | 30 +----- .../db/IOobjects/GlobalIOList/GlobalIOList.H | 4 +- src/OpenFOAM/db/IOobjects/IOField/IOField.C | 60 +++++------ src/OpenFOAM/db/IOobjects/IOField/IOField.H | 10 +- src/OpenFOAM/db/IOobjects/IOList/IOList.C | 16 +-- src/OpenFOAM/db/IOobjects/IOList/IOList.H | 4 +- src/OpenFOAM/db/IOobjects/IOMap/IOMap.C | 14 +-- src/OpenFOAM/db/IOobjects/IOMap/IOMap.H | 4 +- .../db/IOobjects/IOPtrList/IOPtrList.C | 2 +- .../db/IOobjects/IOdictionary/IOdictionary.C | 2 +- .../IOdictionary/localIOdictionary.C | 2 +- .../IOdictionary/unwatchedIOdictionary.C | 4 +- .../db/IOobjects/rawIOField/rawIOField.C | 14 +-- .../db/IOobjects/rawIOField/rawIOField.H | 4 +- .../mapDistribute/IOmapDistribute.C | 10 +- .../mapDistribute/IOmapDistribute.H | 4 +- .../mapDistribute/IOmapDistributePolyMesh.C | 10 +- .../mapDistribute/IOmapDistributePolyMesh.H | 4 +- .../polyBoundaryMesh/polyBoundaryMesh.C | 10 +- .../polyBoundaryMesh/polyBoundaryMesh.H | 4 +- .../polyBoundaryMeshEntries.C | 3 +- .../meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C | 10 +- .../meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H | 2 +- .../coordinate/systems/coordinateSystems.C | 100 +++++++++--------- .../coordinate/systems/coordinateSystems.H | 23 ++-- .../hexRef8/refinementHistory.C | 15 ++- .../hexRef8/refinementHistory.H | 4 +- .../polyTopoChanger/polyTopoChanger.C | 6 +- .../polyTopoChanger/polyTopoChanger.H | 4 +- .../faMesh/faBoundaryMesh/faBoundaryMesh.C | 12 +-- .../faMesh/faBoundaryMesh/faBoundaryMesh.H | 4 +- .../faBoundaryMesh/faBoundaryMeshEntries.C | 3 +- src/surfMesh/surfZone/surfZoneIOList.C | 6 +- src/surfMesh/surfZone/surfZoneIOList.H | 4 +- 37 files changed, 257 insertions(+), 299 deletions(-) diff --git a/src/OpenFOAM/db/IOobjects/CompactIOField/CompactIOField.C b/src/OpenFOAM/db/IOobjects/CompactIOField/CompactIOField.C index b37ae44d6b..8f5a6c2d97 100644 --- a/src/OpenFOAM/db/IOobjects/CompactIOField/CompactIOField.C +++ b/src/OpenFOAM/db/IOobjects/CompactIOField/CompactIOField.C @@ -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 -void Foam::CompactIOField::readFromStream(const bool readOnProc) +bool Foam::CompactIOField::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::readFromStream(const bool readOnProc) << exit(FatalIOError); } } -} - -template -bool Foam::CompactIOField::readContents() -{ - if - ( - readOpt() == IOobject::MUST_READ - || (isReadOptional() && headerOk()) - ) - { - readFromStream(); - return true; - } - - return false; + return true; } @@ -85,7 +88,7 @@ Foam::CompactIOField::CompactIOField(const IOobject& io) : regIOobject(io) { - readContents(); + readIOcontents(); } @@ -98,15 +101,7 @@ Foam::CompactIOField::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::CompactIOField : regIOobject(io) { - readContents(); + readIOcontents(); } @@ -132,7 +127,7 @@ Foam::CompactIOField::CompactIOField : regIOobject(io) { - if (!readContents()) + if (!readIOcontents()) { Field::resize(len); } @@ -148,7 +143,7 @@ Foam::CompactIOField::CompactIOField : regIOobject(io) { - if (!readContents()) + if (!readIOcontents()) { Field::operator=(content); } @@ -166,7 +161,7 @@ Foam::CompactIOField::CompactIOField { Field::transfer(content); - readContents(); + readIOcontents(); } diff --git a/src/OpenFOAM/db/IOobjects/CompactIOField/CompactIOField.H b/src/OpenFOAM/db/IOobjects/CompactIOField/CompactIOField.H index 506a0e0c67..efad050dbf 100644 --- a/src/OpenFOAM/db/IOobjects/CompactIOField/CompactIOField.H +++ b/src/OpenFOAM/db/IOobjects/CompactIOField/CompactIOField.H @@ -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: diff --git a/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.C b/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.C index eb9ec7c591..d6d96d9b75 100644 --- a/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.C +++ b/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.C @@ -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 -void Foam::CompactIOList::readFromStream() -{ - Istream& is = readStream(word::null); - - if (headerClassName() == IOList::typeName) - { - is >> static_cast&>(*this); - close(); - } - else if (headerClassName() == typeName) - { - is >> *this; - close(); - } - else - { - FatalIOErrorInFunction(is) - << "unexpected class name " << headerClassName() - << " expected " << typeName - << " or " << IOList::typeName << endl - << " while reading object " << name() - << exit(FatalIOError); - } -} - - -template -bool Foam::CompactIOList::readContents() +bool Foam::CompactIOList::readIOcontents() { if ( @@ -67,7 +40,28 @@ bool Foam::CompactIOList::readContents() || (isReadOptional() && headerOk()) ) { - readFromStream(); + Istream& is = readStream(word::null); + + if (headerClassName() == IOList::typeName) + { + is >> static_cast&>(*this); + close(); + } + else if (headerClassName() == typeName) + { + is >> *this; + close(); + } + else + { + FatalIOErrorInFunction(is) + << "Unexpected class name " << headerClassName() + << " expected " << typeName + << " or " << IOList::typeName << endl + << " while reading object " << name() + << exit(FatalIOError); + } + return true; } @@ -78,12 +72,14 @@ bool Foam::CompactIOList::readContents() template bool Foam::CompactIOList::overflows() const { - label size = 0; - forAll(*this, i) + const List& 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::CompactIOList(const IOobject& io) : regIOobject(io) { - readContents(); + readIOcontents(); } @@ -112,7 +108,7 @@ Foam::CompactIOList::CompactIOList : regIOobject(io) { - readContents(); + readIOcontents(); } @@ -125,7 +121,7 @@ Foam::CompactIOList::CompactIOList : regIOobject(io) { - if (!readContents()) + if (!readIOcontents()) { List::resize(len); } @@ -141,7 +137,7 @@ Foam::CompactIOList::CompactIOList : regIOobject(io) { - if (!readContents()) + if (!readIOcontents()) { List::operator=(content); } @@ -159,7 +155,7 @@ Foam::CompactIOList::CompactIOList { List::transfer(content); - readContents(); + readIOcontents(); } diff --git a/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.H b/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.H index 77d599428f..fc439588f8 100644 --- a/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.H +++ b/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.H @@ -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::operator=; - - - // IOstream operators - - //- Read List from Istream, discarding contents of existing List. - friend Istream& operator>> - ( - Istream&, - CompactIOList& - ); - - // Write List to Ostream. - friend Ostream& operator<< - ( - Ostream&, - const CompactIOList& - ); }; diff --git a/src/OpenFOAM/db/IOobjects/GlobalIOList/GlobalIOList.H b/src/OpenFOAM/db/IOobjects/GlobalIOList/GlobalIOList.H index 966a5976d9..44124a879f 100644 --- a/src/OpenFOAM/db/IOobjects/GlobalIOList/GlobalIOList.H +++ b/src/OpenFOAM/db/IOobjects/GlobalIOList/GlobalIOList.H @@ -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()); diff --git a/src/OpenFOAM/db/IOobjects/IOField/IOField.C b/src/OpenFOAM/db/IOobjects/IOField/IOField.C index 3c4a7a9eb5..89b3d2f848 100644 --- a/src/OpenFOAM/db/IOobjects/IOField/IOField.C +++ b/src/OpenFOAM/db/IOobjects/IOField/IOField.C @@ -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 -void Foam::IOField::readFromStream(const bool readOnProc) +bool Foam::IOField::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::readFromStream(const bool readOnProc) is >> *this; } close(); -} - - -template -bool Foam::IOField::readContents() -{ - if (isReadRequired() || (isReadOptional() && headerOk())) - { - readFromStream(); - return true; - } - - return false; + return true; } @@ -66,7 +72,7 @@ Foam::IOField::IOField(const IOobject& io) // Check for MUST_READ_IF_MODIFIED warnNoRereading>(); - readContents(); + readIOcontents(); } @@ -78,15 +84,7 @@ Foam::IOField::IOField(const IOobject& io, const bool readOnProc) // Check for MUST_READ_IF_MODIFIED warnNoRereading>(); - if (isReadRequired()) - { - readFromStream(readOnProc); - } - else if (isReadOptional()) - { - const bool haveFile = headerOk(); - readFromStream(readOnProc && haveFile); - } + readIOcontents(readOnProc); } @@ -98,7 +96,7 @@ Foam::IOField::IOField(const IOobject& io, Foam::zero) // Check for MUST_READ_IF_MODIFIED warnNoRereading>(); - readContents(); + readIOcontents(); } @@ -110,7 +108,7 @@ Foam::IOField::IOField(const IOobject& io, const label len) // Check for MUST_READ_IF_MODIFIED warnNoRereading>(); - if (!readContents()) + if (!readIOcontents()) { Field::resize(len); } @@ -125,7 +123,7 @@ Foam::IOField::IOField(const IOobject& io, const UList& content) // Check for MUST_READ_IF_MODIFIED warnNoRereading>(); - if (!readContents()) + if (!readIOcontents()) { Field::operator=(content); } @@ -142,7 +140,7 @@ Foam::IOField::IOField(const IOobject& io, Field&& content) Field::transfer(content); - readContents(); + readIOcontents(); } @@ -158,7 +156,7 @@ Foam::IOField::IOField(const IOobject& io, const tmp>& tfld) Field::transfer(tfld.ref()); } - if (!readContents() && !reuse) + if (!readIOcontents() && !reuse) { Field::operator=(tfld()); } @@ -185,7 +183,7 @@ template Foam::Field Foam::IOField::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); } diff --git a/src/OpenFOAM/db/IOobjects/IOField/IOField.H b/src/OpenFOAM/db/IOobjects/IOField/IOField.H index 4956086238..1cbf9a93b5 100644 --- a/src/OpenFOAM/db/IOobjects/IOField/IOField.H +++ b/src/OpenFOAM/db/IOobjects/IOField/IOField.H @@ -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: diff --git a/src/OpenFOAM/db/IOobjects/IOList/IOList.C b/src/OpenFOAM/db/IOobjects/IOList/IOList.C index 59c6b63a8e..a6a0bbb200 100644 --- a/src/OpenFOAM/db/IOobjects/IOList/IOList.C +++ b/src/OpenFOAM/db/IOobjects/IOList/IOList.C @@ -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 -bool Foam::IOList::readContents() +bool Foam::IOList::readIOcontents() { if (isReadRequired() || (isReadOptional() && headerOk())) { @@ -54,7 +54,7 @@ Foam::IOList::IOList(const IOobject& io) // Check for MUST_READ_IF_MODIFIED warnNoRereading>(); - readContents(); + readIOcontents(); } @@ -66,7 +66,7 @@ Foam::IOList::IOList(const IOobject& io, Foam::zero) // Check for MUST_READ_IF_MODIFIED warnNoRereading>(); - readContents(); + readIOcontents(); } @@ -78,7 +78,7 @@ Foam::IOList::IOList(const IOobject& io, const label len) // Check for MUST_READ_IF_MODIFIED warnNoRereading>(); - if (!readContents()) + if (!readIOcontents()) { List::resize(len); } @@ -93,7 +93,7 @@ Foam::IOList::IOList(const IOobject& io, const UList& content) // Check for MUST_READ_IF_MODIFIED warnNoRereading>(); - if (!readContents()) + if (!readIOcontents()) { List::operator=(content); } @@ -110,7 +110,7 @@ Foam::IOList::IOList(const IOobject& io, List&& content) List::transfer(content); - readContents(); + readIOcontents(); } @@ -132,7 +132,7 @@ template Foam::List Foam::IOList::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); } diff --git a/src/OpenFOAM/db/IOobjects/IOList/IOList.H b/src/OpenFOAM/db/IOobjects/IOList/IOList.H index 1f30fc4863..636fab73db 100644 --- a/src/OpenFOAM/db/IOobjects/IOList/IOList.H +++ b/src/OpenFOAM/db/IOobjects/IOList/IOList.H @@ -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: diff --git a/src/OpenFOAM/db/IOobjects/IOMap/IOMap.C b/src/OpenFOAM/db/IOobjects/IOMap/IOMap.C index 702aebd322..b88f08bab6 100644 --- a/src/OpenFOAM/db/IOobjects/IOMap/IOMap.C +++ b/src/OpenFOAM/db/IOobjects/IOMap/IOMap.C @@ -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 -bool Foam::IOMap::readContents() +bool Foam::IOMap::readIOcontents() { if (isReadRequired() || (isReadOptional() && headerOk())) { @@ -55,7 +55,7 @@ Foam::IOMap::IOMap(const IOobject& io) : regIOobject(io) { - readContents(); + readIOcontents(); } @@ -64,7 +64,7 @@ Foam::IOMap::IOMap(const IOobject& io, const label size) : regIOobject(io) { - if (!readContents()) + if (!readIOcontents()) { Map::resize(size); } @@ -76,7 +76,7 @@ Foam::IOMap::IOMap(const IOobject& io, const Map& content) : regIOobject(io) { - if (!readContents()) + if (!readIOcontents()) { Map::operator=(content); } @@ -90,7 +90,7 @@ Foam::IOMap::IOMap(const IOobject& io, Map&& content) { Map::transfer(content); - readContents(); + readIOcontents(); } @@ -100,7 +100,7 @@ template Foam::Map Foam::IOMap::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); } diff --git a/src/OpenFOAM/db/IOobjects/IOMap/IOMap.H b/src/OpenFOAM/db/IOobjects/IOMap/IOMap.H index 9cf43adee2..ede099d7f1 100644 --- a/src/OpenFOAM/db/IOobjects/IOMap/IOMap.H +++ b/src/OpenFOAM/db/IOobjects/IOMap/IOMap.H @@ -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: diff --git a/src/OpenFOAM/db/IOobjects/IOPtrList/IOPtrList.C b/src/OpenFOAM/db/IOobjects/IOPtrList/IOPtrList.C index 48efa21d5e..95a42de2e5 100644 --- a/src/OpenFOAM/db/IOobjects/IOPtrList/IOPtrList.C +++ b/src/OpenFOAM/db/IOobjects/IOPtrList/IOPtrList.C @@ -122,7 +122,7 @@ template Foam::PtrList Foam::IOPtrList::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); } diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C index 83834881ec..375b12e211 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C @@ -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); } diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/localIOdictionary.C b/src/OpenFOAM/db/IOobjects/IOdictionary/localIOdictionary.C index bd45e100c7..b938f05404 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/localIOdictionary.C +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/localIOdictionary.C @@ -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); } diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/unwatchedIOdictionary.C b/src/OpenFOAM/db/IOobjects/IOdictionary/unwatchedIOdictionary.C index f4183e9cee..1a54d61827 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/unwatchedIOdictionary.C +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/unwatchedIOdictionary.C @@ -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()) diff --git a/src/OpenFOAM/db/IOobjects/rawIOField/rawIOField.C b/src/OpenFOAM/db/IOobjects/rawIOField/rawIOField.C index 69f4d1772b..64e1959fa3 100644 --- a/src/OpenFOAM/db/IOobjects/rawIOField/rawIOField.C +++ b/src/OpenFOAM/db/IOobjects/rawIOField/rawIOField.C @@ -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 -void Foam::rawIOField::readContents +void Foam::rawIOField::readIOcontents ( Istream& is, IOobjectOption::readOption readAverage @@ -65,7 +65,7 @@ void Foam::rawIOField::readContents template -bool Foam::rawIOField::readContents +bool Foam::rawIOField::readIOcontents ( IOobjectOption::readOption readAverage ) @@ -111,7 +111,7 @@ bool Foam::rawIOField::readContents if (is.good()) { - readContents(is, readAverage); + readIOcontents(is, readAverage); close(); } } @@ -122,7 +122,7 @@ bool Foam::rawIOField::readContents if (isPtr && isPtr->good()) { - readContents(*isPtr, readAverage); + readIOcontents(*isPtr, readAverage); } else { @@ -165,7 +165,7 @@ Foam::rawIOField::rawIOField // Check for MUST_READ_IF_MODIFIED warnNoRereading>(); - readContents(readAverage); + readIOcontents(readAverage); } @@ -194,7 +194,7 @@ template Foam::Field Foam::rawIOField::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); } diff --git a/src/OpenFOAM/db/IOobjects/rawIOField/rawIOField.H b/src/OpenFOAM/db/IOobjects/rawIOField/rawIOField.H index eaf5a9e934..3e3668361e 100644 --- a/src/OpenFOAM/db/IOobjects/rawIOField/rawIOField.H +++ b/src/OpenFOAM/db/IOobjects/rawIOField/rawIOField.H @@ -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: diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.C index de98bcf879..65e2b70443 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.C @@ -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(); - readContents(); + readIOcontents(); } @@ -75,7 +75,7 @@ Foam::IOmapDistribute::IOmapDistribute // Warn for MUST_READ_IF_MODIFIED warnNoRereading(); - if (!readContents()) + if (!readIOcontents()) { mapDistribute::operator=(map); } @@ -95,7 +95,7 @@ Foam::IOmapDistribute::IOmapDistribute mapDistribute::transfer(map); - readContents(); + readIOcontents(); } diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.H b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.H index eee7b25883..59cc1cc141 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.H +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.H @@ -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: diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistributePolyMesh.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistributePolyMesh.C index d4dd4c6f07..8f35bbedaa 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistributePolyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistributePolyMesh.C @@ -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(); - readContents(); + readIOcontents(); } @@ -75,7 +75,7 @@ Foam::IOmapDistributePolyMesh::IOmapDistributePolyMesh // Warn for MUST_READ_IF_MODIFIED warnNoRereading(); - if (!readContents()) + if (!readIOcontents()) { mapDistributePolyMesh::operator=(map); } @@ -95,7 +95,7 @@ Foam::IOmapDistributePolyMesh::IOmapDistributePolyMesh mapDistributePolyMesh::transfer(map); - readContents(); + readIOcontents(); } diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistributePolyMesh.H b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistributePolyMesh.H index 5dd4a45b11..b0d85a2afd 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistributePolyMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistributePolyMesh.H @@ -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: diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C index 38751f59c6..6936849531 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C @@ -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&& entries) } -bool Foam::polyBoundaryMesh::readContents(const bool allowOptionalRead) +bool Foam::polyBoundaryMesh::readIOcontents(const bool allowOptionalRead) { bool updated = false; PtrList 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)); } diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H index 169db86464..93a059a06e 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H @@ -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: diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMeshEntries.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMeshEntries.C index 9c8cb75600..7cf2f53abb 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMeshEntries.C +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMeshEntries.C @@ -46,8 +46,7 @@ Foam::polyBoundaryMeshEntries::polyBoundaryMeshEntries(const IOobject& io) IOobject(io, IOobjectOption::NO_REGISTER) ) { - // readContents() - + // readIOcontents() if (isReadRequired() || (isReadOptional() && headerOk())) { // Read as entries diff --git a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C index f45bcd7be9..b0ce8d06c2 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C @@ -258,7 +258,7 @@ void Foam::ZoneMesh::populate template -bool Foam::ZoneMesh::readContents +bool Foam::ZoneMesh::readIOcontents ( const bool allowOptionalRead ) @@ -311,7 +311,7 @@ Foam::ZoneMesh::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::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::ZoneMesh regIOobject(io), mesh_(mesh) { - if (!readContents(true)) // allowOptionalRead = true + if (!readIOcontents(true)) // allowOptionalRead = true { // Nothing read. Use supplied zones PtrList& zones = *this; @@ -385,7 +385,7 @@ Foam::ZoneMesh::ZoneMesh regIOobject(io), mesh_(mesh) { - if (!readContents(true)) // allowOptionalRead = true + if (!readIOcontents(true)) // allowOptionalRead = true { populate(std::move(entries)); } diff --git a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H index c729327a40..0039ab43dd 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H @@ -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: diff --git a/src/OpenFOAM/primitives/coordinate/systems/coordinateSystems.C b/src/OpenFOAM/primitives/coordinate/systems/coordinateSystems.C index 54a95185d2..da4f2b5e1b 100644 --- a/src/OpenFOAM/primitives/coordinate/systems/coordinateSystems.C +++ b/src/OpenFOAM/primitives/coordinate/systems/coordinateSystems.C @@ -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"; // * * * * * * * * * * * * * 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() + regIOobject(io) { - readContents(); + readIOcontents(); } @@ -131,10 +128,9 @@ Foam::coordinateSystems::coordinateSystems const PtrList& content ) : - regIOobject(io), - PtrList() + regIOobject(io) { - if (!readContents()) + if (!readIOcontents()) { static_cast&>(*this) = content; } @@ -150,7 +146,7 @@ Foam::coordinateSystems::coordinateSystems regIOobject(io), PtrList(std::move(content)) { - readContents(); + readIOcontents(); } diff --git a/src/OpenFOAM/primitives/coordinate/systems/coordinateSystems.H b/src/OpenFOAM/primitives/coordinate/systems/coordinateSystems.H index 6dcce33a90..183415127f 100644 --- a/src/OpenFOAM/primitives/coordinate/systems/coordinateSystems.H +++ b/src/OpenFOAM/primitives/coordinate/systems/coordinateSystems.H @@ -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" - void readFromStream(const bool readOnProc = true); + //- Read if IOobject flags set. + //- Reads "coordinateSystems" or older "IOPtrList" + // 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 diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.C index 3239bf801a..18ac3e6dc2 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.C @@ -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(); - 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(); - readContents(); + readIOcontents(); // Check indices. checkIndices(); @@ -632,7 +632,7 @@ Foam::refinementHistory::refinementHistory // Warn for MUST_READ_IF_MODIFIED warnNoRereading(); - if (!readContents()) + if (!readIOcontents()) { visibleCells_.setSize(nCells); splitCells_.setCapacity(nCells); @@ -677,7 +677,7 @@ Foam::refinementHistory::refinementHistory // Warn for MUST_READ_IF_MODIFIED warnNoRereading(); - 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; } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.H index 49bd6fe779..6f40cf11dd 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.H @@ -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; diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.C b/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.C index 022de1d90d..bae650eada 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.C @@ -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(); - readContents(); + readIOcontents(); } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.H b/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.H index 8ed5efdda1..d930b56563 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.H @@ -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; diff --git a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C index 3ed9ea7f8f..89c358c1b5 100644 --- a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C +++ b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C @@ -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&& entries) } -bool Foam::faBoundaryMesh::readContents(const bool allowOptionalRead) +bool Foam::faBoundaryMesh::readIOcontents(const bool allowOptionalRead) { bool updated = false; PtrList 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)); } diff --git a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H index 0603bd28d2..9c3cc9d0e9 100644 --- a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H +++ b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H @@ -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: diff --git a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMeshEntries.C b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMeshEntries.C index 8a075e927d..59ebacfe33 100644 --- a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMeshEntries.C +++ b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMeshEntries.C @@ -45,8 +45,7 @@ Foam::faBoundaryMeshEntries::faBoundaryMeshEntries(const IOobject& io) IOobject(io, IOobjectOption::NO_REGISTER) ) { - // readContents() - + // readIOcontents() if (isReadRequired() || (isReadOptional() && headerOk())) { // Read as entries diff --git a/src/surfMesh/surfZone/surfZoneIOList.C b/src/surfMesh/surfZone/surfZoneIOList.C index b2567d286c..c7cf0c73dc 100644 --- a/src/surfMesh/surfZone/surfZoneIOList.C +++ b/src/surfMesh/surfZone/surfZoneIOList.C @@ -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 } diff --git a/src/surfMesh/surfZone/surfZoneIOList.H b/src/surfMesh/surfZone/surfZoneIOList.H index 4ceb923758..1165fb1a3f 100644 --- a/src/surfMesh/surfZone/surfZoneIOList.H +++ b/src/surfMesh/surfZone/surfZoneIOList.H @@ -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: