diff --git a/src/OpenFOAM/db/IOobjects/CompactIOField/CompactIOField.C b/src/OpenFOAM/db/IOobjects/CompactIOField/CompactIOField.C index b37ae44d6b5c7d64ea6702874274c00a2c7be994..8f5a6c2d9789db56a14b93b00d408f4861464f47 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 506a0e0c67bf6646a69dff8f6775a87f3770f087..efad050dbf7a36112b221bc2b2aa054d56da6c4c 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 eb9ec7c591eb447065ebd1bada2c155f9eac01a1..d6d96d9b75fc1fd4c9f0b574b0364bdc2833eb76 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 77d599428f6ff731cf768495cf05afafe68609ce..fc439588f890deef2763aec376d11cce7b8b4ba7 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 966a5976d98f62501ebb67485d7bd803bef2749f..44124a879f5efb7a8541118defa4efbbb2d3f820 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 3c4a7a9eb5c8068c6b3295cdf6806cf66045df66..89b3d2f8488267fcb08da254d7254fc4b4040323 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 495608623834381229f986c15bd1a16d80c7037e..1cbf9a93b5a36c05d951169601d99d6016cbc99a 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 59c6b63a8e9a9790a76d47d8dee54390ef9c3d00..a6a0bbb2002c737c004d2409228b76341f67d5ee 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 1f30fc4863e071011722ed4d534e4b1d1175fb0f..636fab73dbbb0baaf4a88cca017e9583e67e1d01 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 702aebd322ebb11d0998ae438dde9f297c96123e..b88f08bab6b6e0b0f54be128043be73558650ec9 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 9cf43adee26c2d95b25541e7230709475138b1d0..ede099d7f1511267dba92eecf01ec42cd0c4893b 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 48efa21d5ea2764005454b81ce089ff12528a984..95a42de2e5bf96001818f468481fc4e3bdb1e498 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 83834881ec780ea84af366c4ee35db6be7e1eef1..375b12e211fade0490cc613b5d0782db276f8eb1 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 bd45e100c782c1d490447494b41e5ffd9f4ee209..b938f0540432ec2e62640f2f89a0dcaff9cbb783 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 f4183e9ceea4a52b5314bcc1f1955621b55fa396..1a54d61827904993868d3a524abbd5bf1ffed20d 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 69f4d1772b547a273a2e726b109b4e462ca47825..64e1959fa3c1fce9ad4eeb36a52ed965aa93946d 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 eaf5a9e934eb911c27a27b4242c5db4a8079289b..3e3668361eacd5e68f453a87e31a5380e8422251 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 de98bcf8791d5a69df48d7f19e8ff499c273eb28..65e2b70443a55f2ae762d4e13831d1b93aef32d5 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 eee7b25883d1b2c6584f6b210d5d0783814ff850..59cc1cc141f8426964c4435ac92b6fc08c1eb1b3 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 d4dd4c6f076f960bcb46c26d8dca0d0fbbdf34c0..8f35bbedaa269eabeecda102e895ea3311108a03 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 5dd4a45b1114914eda2cd7bd00fe473599ad348f..b0d85a2afd79d8ee9aa947958ac3905eb8c6d908 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 38751f59c6f5bb11858413d871724860bdcd24aa..693684953181ec1f2de617bd66f7b6735579be26 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 169db86464c713fc6d3062f2c79e53a34b92bf29..93a059a06e61a5f47475135c80e7130d87d82284 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 9c8cb756004e9ea354edb573188a7373a7ad6ceb..7cf2f53abb979b481dbe764ba12857943348cf39 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 f45bcd7be95c5d5ac143074388b7b920654e03ae..b0ce8d06c22eab7334a7344724954ea6aeb57c5f 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 c729327a400e7c2e0412b4b9f994d48ebacaf35b..0039ab43dd427ab1836ee4a24ea244af3d100a0e 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 54a95185d208616db2857e648fda0686c5d3447e..da4f2b5e1bcc352f437a4ff729a449dd30510f37 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 6dcce33a9003282e7a54e250c334f7db78ec3012..183415127f5b35363f1e67a516623c8fc4f472c2 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 3239bf801ad9a285dfa2172a3ae1ba942aef71a5..18ac3e6dc2e1c6ba235289a3ddb2440cf99deeeb 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 49bd6fe7795c1e8311dcbe976ccee3499bf18ed3..6f40cf11dd6d6b560c7fc5aa136bc41759a07519 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 022de1d90db2fa53fc1212a4ca3f59c653381be9..bae650eadaaf4333e95bdfe17397b7ae1a9b4b0a 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 8ed5efdda1bbdd29d5bb97952b663b3227ba6cc9..d930b56563e32ebbe8b97c089fb005b4c50f60a4 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 3ed9ea7f8fc7c6b3a0e5dfdd4a55a1d1705d2ce5..89c358c1b5711b2151763bce4ecd2171e5530eea 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 0603bd28d2e9a093113fc0e415fd11d9cf3fbdf2..9c3cc9d0e90adb36263380cce30af8f7ae29858d 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 8a075e927df2388f67bed60504c0ced2f0e4c264..59ebacfe33feb11bbc4d7f8a8e06e404f18cbd38 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 b2567d286cad77963ee2b27718c1830b4fe29eab..c7cf0c73dc8bc4605d36dac33e45eeff45061f1e 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 4ceb9237582c67cd1ee50c702f50eaf119f8c2be..1165fb1a3fd9d1da70f7b929a023c073ade5bff1 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: