From 68c5d90ad02b590e10b89cf769b3c63fe101d7f2 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> 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 | 92 +++++++++---------- .../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, 253 insertions(+), 295 deletions(-) diff --git a/src/OpenFOAM/db/IOobjects/CompactIOField/CompactIOField.C b/src/OpenFOAM/db/IOobjects/CompactIOField/CompactIOField.C index b37ae44d6b5..8f5a6c2d978 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<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(); } diff --git a/src/OpenFOAM/db/IOobjects/CompactIOField/CompactIOField.H b/src/OpenFOAM/db/IOobjects/CompactIOField/CompactIOField.H index 506a0e0c67b..efad050dbf7 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 eb9ec7c591e..d6d96d9b75f 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<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(); } diff --git a/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.H b/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.H index 77d599428f6..fc439588f89 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<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>& - ); }; diff --git a/src/OpenFOAM/db/IOobjects/GlobalIOList/GlobalIOList.H b/src/OpenFOAM/db/IOobjects/GlobalIOList/GlobalIOList.H index 966a5976d98..44124a879f5 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 3c4a7a9eb5c..89b3d2f8488 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<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); } diff --git a/src/OpenFOAM/db/IOobjects/IOField/IOField.H b/src/OpenFOAM/db/IOobjects/IOField/IOField.H index 49560862383..1cbf9a93b5a 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 59c6b63a8e9..a6a0bbb2002 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<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); } diff --git a/src/OpenFOAM/db/IOobjects/IOList/IOList.H b/src/OpenFOAM/db/IOobjects/IOList/IOList.H index 1f30fc4863e..636fab73dbb 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 702aebd322e..b88f08bab6b 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<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); } diff --git a/src/OpenFOAM/db/IOobjects/IOMap/IOMap.H b/src/OpenFOAM/db/IOobjects/IOMap/IOMap.H index 9cf43adee26..ede099d7f15 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 48efa21d5ea..95a42de2e5b 100644 --- a/src/OpenFOAM/db/IOobjects/IOPtrList/IOPtrList.C +++ b/src/OpenFOAM/db/IOobjects/IOPtrList/IOPtrList.C @@ -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); } diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C index 83834881ec7..375b12e211f 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 bd45e100c78..b938f054043 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 f4183e9ceea..1a54d618279 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 69f4d1772b5..64e1959fa3c 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<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); } diff --git a/src/OpenFOAM/db/IOobjects/rawIOField/rawIOField.H b/src/OpenFOAM/db/IOobjects/rawIOField/rawIOField.H index eaf5a9e934e..3e3668361ea 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 de98bcf8791..65e2b70443a 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<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(); } diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.H b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.H index eee7b25883d..59cc1cc141f 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 d4dd4c6f076..8f35bbedaa2 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<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(); } diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistributePolyMesh.H b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistributePolyMesh.H index 5dd4a45b111..b0d85a2afd7 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 38751f59c6f..69368495318 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<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)); } diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H index 169db86464c..93a059a06e6 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 9c8cb756004..7cf2f53abb9 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 f45bcd7be95..b0ce8d06c22 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<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)); } diff --git a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H index c729327a400..0039ab43dd4 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 54a95185d20..da4f2b5e1bc 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<coordinateSystem>"; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::coordinateSystems::readFromStream(const bool readOnProc) +bool Foam::coordinateSystems::readIOcontents() { - Istream& is = readStream(word::null, readOnProc); + if (isReadRequired() || (isReadOptional() && headerOk())) + { + // Attempt reading + } + else + { + return false; + } + - if (readOnProc) + // Do reading + Istream& is = readStream(word::null); + + if (headerClassName() == typeName) { - 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); - } + 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); + } -bool Foam::coordinateSystems::readContents() -{ - if (isReadRequired() || (isReadOptional() && headerOk())) + this->readIstream(is, coordinateSystem::iNew()); + close(); + } + else { - readFromStream(); - return true; + FatalIOErrorInFunction(is) + << "Unexpected class name " << headerClassName() + << " expected " << typeName + << " or " << headerTypeCompat << nl + << " while reading object " << name() + << exit(FatalIOError); } - return false; + 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(); } diff --git a/src/OpenFOAM/primitives/coordinate/systems/coordinateSystems.H b/src/OpenFOAM/primitives/coordinate/systems/coordinateSystems.H index 6dcce33a900..183415127f5 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<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 diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.C index 3239bf801ad..18ac3e6dc2e 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<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; } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.H index 49bd6fe7795..6f40cf11dd6 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 022de1d90db..bae650eadaa 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<polyTopoChanger>(); - readContents(); + readIOcontents(); } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.H b/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.H index 8ed5efdda1b..d930b56563e 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 3ed9ea7f8fc..89c358c1b57 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<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)); } diff --git a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H index 0603bd28d2e..9c3cc9d0e90 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 8a075e927df..59ebacfe33f 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 b2567d286ca..c7cf0c73dc8 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 4ceb9237582..1165fb1a3fd 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: -- GitLab