diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H index 28fb68c07d..41400468f6 100644 --- a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H +++ b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H @@ -90,9 +90,6 @@ protected: // Protected Member Functions - //- True if all entries have identical values, and list is non-empty - inline bool uniform() const; - //- Write the FixedList with its compound type void writeEntry(Ostream& os) const; @@ -242,6 +239,9 @@ public: //- Check index is within valid range [0,N) inline void checkIndex(const label i) const; + //- True if all entries have identical values, and list is non-empty + inline bool uniform() const; + // Search diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H b/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H index f324e79c1d..59bcf717a0 100644 --- a/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H +++ b/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H @@ -37,25 +37,6 @@ inline const Foam::FixedList& Foam::FixedList::null() } -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -template -inline bool Foam::FixedList::uniform() const -{ - if (empty()) return false; // <- Compile-time disabled anyhow - - for (unsigned i=1; i @@ -299,6 +280,23 @@ inline void Foam::FixedList::checkIndex(const label i) const } +template +inline bool Foam::FixedList::uniform() const +{ + if (empty()) return false; // <- Compile-time disabled anyhow + + for (unsigned i=1; i inline bool Foam::FixedList::found ( diff --git a/src/OpenFOAM/containers/Lists/UIndirectList/UIndirectList.H b/src/OpenFOAM/containers/Lists/UIndirectList/UIndirectList.H index ee8ac502b1..f693cc4750 100644 --- a/src/OpenFOAM/containers/Lists/UIndirectList/UIndirectList.H +++ b/src/OpenFOAM/containers/Lists/UIndirectList/UIndirectList.H @@ -67,14 +67,6 @@ class UIndirectList UList& values_; const labelUList& addressing_; -protected: - - // Protected Member Functions - - //- True if all entries have identical values, and list is non-empty - inline bool uniform() const; - - public: // STL type definitions @@ -123,6 +115,9 @@ public: //- Return true if the list is empty (ie, size() is zero). inline bool empty() const; + //- True if all entries have identical values, and list is non-empty + inline bool uniform() const; + //- Return the first element of the list. inline T& first(); diff --git a/src/OpenFOAM/containers/Lists/UIndirectList/UIndirectListI.H b/src/OpenFOAM/containers/Lists/UIndirectList/UIndirectListI.H index 55f1438fc4..3ee84127e5 100644 --- a/src/OpenFOAM/containers/Lists/UIndirectList/UIndirectListI.H +++ b/src/OpenFOAM/containers/Lists/UIndirectList/UIndirectListI.H @@ -23,32 +23,6 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -template -inline bool Foam::UIndirectList::uniform() const -{ - const label len = this->size(); - - if (!len) - { - return false; - } - - const T& val = (*this)[0]; - - for (label i=1; i @@ -79,6 +53,32 @@ inline bool Foam::UIndirectList::empty() const } +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +template +inline bool Foam::UIndirectList::uniform() const +{ + const label len = this->size(); + + if (!len) + { + return false; + } + + const T& val = (*this)[0]; + + for (label i=1; i inline T& Foam::UIndirectList::first() { diff --git a/src/OpenFOAM/containers/Lists/UList/UList.H b/src/OpenFOAM/containers/Lists/UList/UList.H index 8d81d5f589..88d84bc9a4 100644 --- a/src/OpenFOAM/containers/Lists/UList/UList.H +++ b/src/OpenFOAM/containers/Lists/UList/UList.H @@ -112,9 +112,6 @@ protected: // Use with care inline void size(const label n); - //- True if all entries have identical values, and list is non-empty - inline bool uniform() const; - //- Write the UList with its compound type void writeEntry(Ostream& os) const; @@ -280,19 +277,22 @@ public: inline const T& last() const; - // Check + // Check - //- Check start is within valid range [0,size) - inline void checkStart(const label start) const; + //- Check start is within valid range [0,size) + inline void checkStart(const label start) const; - //- Check size is within valid range [0,size] - inline void checkSize(const label size) const; + //- Check size is within valid range [0,size] + inline void checkSize(const label size) const; - //- Check index is within valid range [0,size) - inline void checkIndex(const label i) const; + //- Check index is within valid range [0,size) + inline void checkIndex(const label i) const; + + //- True if all entries have identical values, and list is non-empty + inline bool uniform() const; - // Search + // Search //- Find index of the first occurrence of the value. // When start is specified, any occurrences before start are ignored. @@ -313,7 +313,7 @@ public: inline bool found(const T& val, const label start=0) const; - // Edit + // Edit //- Move element to the first position. void moveFirst(const label i); @@ -328,7 +328,7 @@ public: void swapLast(const label i); - // Copy + // Copy //- Copy the pointer held by the given UList inline void shallowCopy(const UList& list); diff --git a/src/OpenFOAM/containers/Lists/UList/UListI.H b/src/OpenFOAM/containers/Lists/UList/UListI.H index abe26ca776..188666665c 100644 --- a/src/OpenFOAM/containers/Lists/UList/UListI.H +++ b/src/OpenFOAM/containers/Lists/UList/UListI.H @@ -27,33 +27,6 @@ License #include "pTraits.H" #include "Swap.H" -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -template -inline bool Foam::UList::uniform() const -{ - const label len = size(); - - if (len == 0) - { - return false; - } - - const T& val = first(); - - for (label i=1; i @@ -166,6 +139,30 @@ inline void Foam::UList::checkIndex(const label i) const } +template +inline bool Foam::UList::uniform() const +{ + const label len = size(); + + if (len == 0) + { + return false; + } + + const T& val = first(); + + for (label i=1; i inline T& Foam::UList::first() {