diff --git a/src/OpenFOAM/containers/HashTables/HashPtrTable/HashPtrTableIO.C b/src/OpenFOAM/containers/HashTables/HashPtrTable/HashPtrTableIO.C index ddd10aea4cf8923147aa5a33f816d9fb8f1dd83e..a19dd42b0350dc0922b127b5626b1451675ee0c4 100644 --- a/src/OpenFOAM/containers/HashTables/HashPtrTable/HashPtrTableIO.C +++ b/src/OpenFOAM/containers/HashTables/HashPtrTable/HashPtrTableIO.C @@ -47,10 +47,10 @@ void Foam::HashPtrTable<T, Key, Hash>::read(Istream& is, const INew& inewt) if (firstToken.isLabel()) { - label s = firstToken.labelToken(); + const label s = firstToken.labelToken(); // Read beginning of contents - char delimiter = is.readBeginList("HashPtrTable<T, Key, Hash>"); + const char delimiter = is.readBeginList("HashPtrTable<T, Key, Hash>"); if (s) { diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTableIO.C b/src/OpenFOAM/containers/HashTables/HashTable/HashTableIO.C index 280fc8a623bc9f57d3ca8d46f4152f766d931295..4d9c37384518d0cd8ce9d86c140d19ad8b500f6e 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTableIO.C +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTableIO.C @@ -41,7 +41,7 @@ Foam::HashTable<T, Key, Hash>::HashTable(Istream& is, const label size) { table_ = new hashedEntry*[tableSize_]; - for (label hashIdx = 0; hashIdx < tableSize_; hashIdx++) + for (label hashIdx = 0; hashIdx < tableSize_; ++hashIdx) { table_[hashIdx] = 0; } @@ -116,10 +116,10 @@ Foam::Istream& Foam::operator>> if (firstToken.isLabel()) { - label s = firstToken.labelToken(); + const label s = firstToken.labelToken(); // Read beginning of contents - char delimiter = is.readBeginList("HashTable<T, Key, Hash>"); + const char delimiter = is.readBeginList("HashTable<T, Key, Hash>"); if (s) { @@ -130,7 +130,7 @@ Foam::Istream& Foam::operator>> if (delimiter == token::BEGIN_LIST) { - for (label i=0; i<s; i++) + for (label i=0; i<s; ++i) { Key key; is >> key; diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILListIO.C b/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILListIO.C index befc71d1ebf47533d1b88d0c543ff26fab7cef8a..5b398198e583e8f13d7f899bb030f56ed8459b50 100644 --- a/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILListIO.C +++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILListIO.C @@ -44,10 +44,10 @@ void Foam::ILList<LListBase, T>::read(Istream& is, const INew& iNew) if (firstToken.isLabel()) { - label s = firstToken.labelToken(); + const label s = firstToken.labelToken(); // Read beginning of contents - char delimiter = is.readBeginList("ILList<LListBase, T>"); + const char delimiter = is.readBeginList("ILList<LListBase, T>"); if (s) { diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LListIO.C b/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LListIO.C index a766ee85b9975ac842a51cd886b3741058c9eb53..028901452822906fe81f31143b5327c8532bc28a 100644 --- a/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LListIO.C +++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LListIO.C @@ -55,10 +55,10 @@ Foam::Istream& Foam::operator>>(Istream& is, LList<LListBase, T>& L) if (firstToken.isLabel()) { - label s = firstToken.labelToken(); + const label s = firstToken.labelToken(); // Read beginning of contents - char delimiter = is.readBeginList("LList<LListBase, T>"); + const char delimiter = is.readBeginList("LList<LListBase, T>"); if (s) { diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrListIO.C b/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrListIO.C index 6a691c078a7ddda745ba58b35a3ce96c42ed4a16..e23b2ddae1a1a7f3c13934ab470a2e1d237c63d3 100644 --- a/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrListIO.C +++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrListIO.C @@ -49,10 +49,10 @@ void Foam::LPtrList<LListBase, T>::read(Istream& is, const INew& iNew) if (firstToken.isLabel()) { - label s = firstToken.labelToken(); + const label s = firstToken.labelToken(); // Read beginning of contents - char delimiter = is.readBeginList("LPtrList<LListBase, T>"); + const char delimiter = is.readBeginList("LPtrList<LListBase, T>"); if (s) { diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H index 375151c4635066b9c6f3da4917ef1356ca76157f..6e23dc7040910b11094ad7deaa2380c4653d9815 100644 --- a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H +++ b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H @@ -125,7 +125,7 @@ public: inline FixedList(); //- Construct from value - explicit inline FixedList(const T&); + explicit inline FixedList(const T& t); //- Construct from C-array explicit inline FixedList(const T v[Size]); @@ -135,19 +135,19 @@ public: inline FixedList(InputIterator first, InputIterator last); //- Construct from an initializer list - inline FixedList(std::initializer_list<T>); + inline FixedList(std::initializer_list<T> lst); //- Construct from UList - explicit inline FixedList(const UList<T>&); + explicit inline FixedList(const UList<T>& lst); //- Construct from SLList - explicit inline FixedList(const SLList<T>&); + explicit inline FixedList(const SLList<T>& lst); //- Copy constructor - inline FixedList(const FixedList<T, Size>&); + inline FixedList(const FixedList<T, Size>& lst); //- Construct from Istream - FixedList(Istream&); + FixedList(Istream& is); //- Clone inline autoPtr<FixedList<T, Size>> clone() const; @@ -205,39 +205,39 @@ public: //- Dummy resize function // needed to make FixedList consistent with List - inline void resize(const label); + inline void resize(const label s); //- Dummy setSize function // needed to make FixedList consistent with List - inline void setSize(const label); + inline void setSize(const label s); //- Copy (not transfer) the argument contents // needed to make FixedList consistent with List - void transfer(const FixedList<T, Size>&); + void transfer(const FixedList<T, Size>& lst); // Member operators //- Return element of FixedList - inline T& operator[](const label); + inline T& operator[](const label i); //- Return element of constant FixedList - inline const T& operator[](const label) const; + inline const T& operator[](const label i) const; //- Assignment to array operator. Takes linear time - inline void operator=(const T v[Size]); + inline void operator=(const T lst[Size]); //- Assignment to UList operator. Takes linear time - inline void operator=(const UList<T>&); + inline void operator=(const UList<T>& lst); //- Assignment to SLList operator. Takes linear time - inline void operator=(const SLList<T>&); + inline void operator=(const SLList<T>& lst); //- Assignment to an initializer list. Takes linear time - inline void operator=(std::initializer_list<T>); + inline void operator=(std::initializer_list<T> lst); //- Assignment of all entries to the given value - inline void operator=(const T&); + inline void operator=(const T& t); // STL type definitions @@ -333,7 +333,7 @@ public: inline bool empty() const; //- Swap two FixedLists of the same type in constant time - void swap(FixedList<T, Size>&); + void swap(FixedList<T, Size>& a); // STL member operators @@ -341,22 +341,22 @@ public: //- Equality operation on FixedLists of the same type. // Returns true when the FixedLists are elementwise equal // (using FixedList::value_type::operator==). Takes linear time - bool operator==(const FixedList<T, Size>&) const; + bool operator==(const FixedList<T, Size>& a) const; //- The opposite of the equality operation. Takes linear time - bool operator!=(const FixedList<T, Size>&) const; + bool operator!=(const FixedList<T, Size>& a) const; //- Compare two FixedLists lexicographically. Takes linear time - bool operator<(const FixedList<T, Size>&) const; + bool operator<(const FixedList<T, Size>& a) const; //- Compare two FixedLists lexicographically. Takes linear time - bool operator>(const FixedList<T, Size>&) const; + bool operator>(const FixedList<T, Size>& a) const; //- Return true if !(a > b). Takes linear time - bool operator<=(const FixedList<T, Size>&) const; + bool operator<=(const FixedList<T, Size>& a) const; //- Return true if !(a < b). Takes linear time - bool operator>=(const FixedList<T, Size>&) const; + bool operator>=(const FixedList<T, Size>& a) const; // Writing @@ -365,17 +365,21 @@ public: void writeEntry(const word& keyword, Ostream& os) const; + // IOstream operators //- Read List from Istream, discarding contents of existing List friend Istream& operator>> <T, Size> - (Istream&, FixedList<T, Size>&); + ( + Istream& is, + FixedList<T, Size>& L + ); //- Write FixedList to Ostream friend Ostream& operator<< <T, Size> ( - Ostream&, - const FixedList<T, Size>& + Ostream& os, + const FixedList<T, Size>& L ); }; diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C b/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C index 6e300a7da30f1387a5b39d13f59d805afe14bf33..03a610af9f711cf5bee92143dc969ea9da6ddc24 100644 --- a/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C +++ b/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C @@ -112,7 +112,7 @@ Foam::Istream& Foam::operator>>(Foam::Istream& is, FixedList<T, Size>& L) } // Read beginning of contents - char delimiter = is.readBeginList("FixedList"); + const char delimiter = is.readBeginList("FixedList"); if (delimiter == token::BEGIN_LIST) { diff --git a/src/OpenFOAM/containers/Lists/List/ListIO.C b/src/OpenFOAM/containers/Lists/List/ListIO.C index 6229cb94904c4ccf241f1a9325e1b60b1191cda7..46183bb45b625805af80fac89a5f5a9053febc0d 100644 --- a/src/OpenFOAM/containers/Lists/List/ListIO.C +++ b/src/OpenFOAM/containers/Lists/List/ListIO.C @@ -74,13 +74,13 @@ Foam::Istream& Foam::operator>>(Istream& is, List<T>& L) if (is.format() == IOstream::ASCII || !contiguous<T>()) { // Read beginning of contents - char delimiter = is.readBeginList("List"); + const char delimiter = is.readBeginList("List"); if (s) { if (delimiter == token::BEGIN_LIST) { - for (label i=0; i<s; i++) + for (label i=0; i<s; ++i) { is >> L[i]; @@ -103,7 +103,7 @@ Foam::Istream& Foam::operator>>(Istream& is, List<T>& L) "reading the single entry" ); - for (label i=0; i<s; i++) + for (label i=0; i<s; ++i) { L[i] = element; } diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOps.H b/src/OpenFOAM/containers/Lists/ListOps/ListOps.H index 47cb900fea395fb151b7c23368018999ae8a00f1..68a43ff87609e80e12f6bbbe1f5cdc6622a03b6c 100644 --- a/src/OpenFOAM/containers/Lists/ListOps/ListOps.H +++ b/src/OpenFOAM/containers/Lists/ListOps/ListOps.H @@ -51,7 +51,7 @@ extern const labelList emptyLabelList; template<class Type> static const List<Type>& emptyList() { - return *reinterpret_cast<const List<Type>* >(&emptyLabelList); + return *reinterpret_cast<const List<Type>*>(&emptyLabelList); } //- Renumber the values (not the indices) of a list. @@ -263,7 +263,7 @@ public: }; -//- Helper class for list to append unique elelements of y onto the end of x +//- Helper class for list to append unique elements of y onto the end of x template<class T> class ListUniqueEqOp { diff --git a/src/OpenFOAM/containers/Lists/PtrList/PtrListIO.C b/src/OpenFOAM/containers/Lists/PtrList/PtrListIO.C index 902b716961253bb9a941e7a3ff88209ed433fca8..a9ce86e43ce1a89e1cb508c8e7abd8903aea8a9a 100644 --- a/src/OpenFOAM/containers/Lists/PtrList/PtrListIO.C +++ b/src/OpenFOAM/containers/Lists/PtrList/PtrListIO.C @@ -48,12 +48,13 @@ void Foam::PtrList<T>::read(Istream& is, const INew& inewt) if (firstToken.isLabel()) { // Read size of list - label s = firstToken.labelToken(); + const label s = firstToken.labelToken(); + // Set list length to that read setSize(s); // Read beginning of contents - char delimiter = is.readBeginList("PtrList"); + const char delimiter = is.readBeginList("PtrList"); if (s) { @@ -81,7 +82,7 @@ void Foam::PtrList<T>::read(Istream& is, const INew& inewt) "reading the single entry" ); - for (label i=1; i<s; i++) + for (label i=1; i<s; ++i) { set(i, tPtr->clone()); } diff --git a/src/OpenFOAM/containers/Lists/SubList/SubListI.H b/src/OpenFOAM/containers/Lists/SubList/SubListI.H index dbbed7469baecb610f36bba690721ac92287c5a7..733b813b51c39a39723e3f2d6f66ac429a5c9d57 100644 --- a/src/OpenFOAM/containers/Lists/SubList/SubListI.H +++ b/src/OpenFOAM/containers/Lists/SubList/SubListI.H @@ -83,7 +83,7 @@ inline const Foam::SubList<T>& Foam::SubList<T>::null() template<class T> inline Foam::SubList<T>::operator const Foam::List<T>&() const { - return *reinterpret_cast<const List<T>* >(this); + return *reinterpret_cast<const List<T>*>(this); } diff --git a/src/OpenFOAM/containers/Lists/UIndirectList/UIndirectList.H b/src/OpenFOAM/containers/Lists/UIndirectList/UIndirectList.H index 99583b633c3aa43041ee56ea9793cd01d9a11485..377e6725024d74745a9901f032c2dfed92b77477 100644 --- a/src/OpenFOAM/containers/Lists/UIndirectList/UIndirectList.H +++ b/src/OpenFOAM/containers/Lists/UIndirectList/UIndirectList.H @@ -70,7 +70,11 @@ public: // Constructors //- Construct given the complete list and the addressing array - inline UIndirectList(const UList<T>&, const labelUList&); + inline UIndirectList + ( + const UList<T>& completeList, + const labelUList& addr + ); // Member Functions @@ -108,19 +112,19 @@ public: inline List<T> operator()() const; //- Return non-const access to an element - inline T& operator[](const label); + inline T& operator[](const label i); //- Return const access to an element - inline const T& operator[](const label) const; + inline const T& operator[](const label i) const; //- Assignment to UList of addressed elements - inline void operator=(const UList<T>&); + inline void operator=(const UList<T>& ae); //- Assignment to UIndirectList of addressed elements - inline void operator=(const UIndirectList<T>&); + inline void operator=(const UIndirectList<T>& ae); //- Assignment of all entries to the given value - inline void operator=(const T&); + inline void operator=(const T& t); // STL type definitions @@ -146,12 +150,11 @@ public: // Ostream operator - //- Write UIndirectList to Ostream - // Binary output is currently still a bit of a problem + //- Write List to Ostream, as per write() method with shortListLen=10 friend Ostream& operator<< <T> ( - Ostream&, - const UIndirectList<T>& + Ostream& os, + const UIndirectList<T>& L ); }; diff --git a/src/OpenFOAM/containers/Lists/UList/UList.H b/src/OpenFOAM/containers/Lists/UList/UList.H index fa3f7b5c19bb0e56c2b62ac9823ab6b506067c00..74c57a7deacff006390d2529ea96d3c5d3bd2a30 100644 --- a/src/OpenFOAM/containers/Lists/UList/UList.H +++ b/src/OpenFOAM/containers/Lists/UList/UList.H @@ -222,27 +222,27 @@ public: //- Copy the pointer held by the given UList - inline void shallowCopy(const UList<T>&); + inline void shallowCopy(const UList<T>& a); //- Copy elements of the given UList - void deepCopy(const UList<T>&); + void deepCopy(const UList<T>& a); // Member operators //- Return element of UList - inline T& operator[](const label); + inline T& operator[](const label i); //- Return element of constant UList // Note that the bool specialization adds lazy evaluation so reading // an out-of-range element returns false without any ill-effects - inline const T& operator[](const label) const; + inline const T& operator[](const label i) const; //- Allow cast to a const List<T>& inline operator const Foam::List<T>&() const; //- Assignment of all entries to the given value - void operator=(const T&); + void operator=(const T& t); //- Assignment of all entries to zero void operator=(const zero); @@ -341,7 +341,7 @@ public: inline bool empty() const; //- Swap two ULists of the same type in constant time - void swap(UList<T>&); + void swap(UList<T>& a); // STL member operators @@ -349,22 +349,22 @@ public: //- Equality operation on ULists of the same type. // Returns true when the ULists are element-wise equal // (using UList::value_type::operator==). Takes linear time - bool operator==(const UList<T>&) const; + bool operator==(const UList<T>& a) const; //- The opposite of the equality operation. Takes linear time - bool operator!=(const UList<T>&) const; + bool operator!=(const UList<T>& a) const; //- Compare two ULists lexicographically. Takes linear time - bool operator<(const UList<T>&) const; + bool operator<(const UList<T>& a) const; //- Compare two ULists lexicographically. Takes linear time - bool operator>(const UList<T>&) const; + bool operator>(const UList<T>& a) const; //- Return true if !(a > b). Takes linear time - bool operator<=(const UList<T>&) const; + bool operator<=(const UList<T>& a) const; //- Return true if !(a < b). Takes linear time - bool operator>=(const UList<T>&) const; + bool operator>=(const UList<T>& a) const; // Writing @@ -373,46 +373,47 @@ public: void writeEntry(const word& keyword, Ostream& os) const; - // Ostream operator - // Write UList to Ostream + // IOstream operators + + //- Write List to Ostream, as per write() method with shortListLen=10 friend Ostream& operator<< <T> ( - Ostream&, - const UList<T>& + Ostream& os, + const UList<T>& L ); - //- Read UList contents from Istream. Requires size to have been set - // before + //- Read List contents from Istream. + // Requires size to have been set before friend Istream& operator>> <T> ( - Istream&, - UList<T>& + Istream& os, + UList<T>& L ); }; template<class T> -void sort(UList<T>&); +void sort(UList<T>& a); template<class T, class Cmp> -void sort(UList<T>&, const Cmp&); +void sort(UList<T>& a, const Cmp& cmp); template<class T> -void stableSort(UList<T>&); +void stableSort(UList<T>& a); template<class T, class Cmp> -void stableSort(UList<T>&, const Cmp&); +void stableSort(UList<T>& a, const Cmp& cmp); template<class T> -void shuffle(UList<T>&); +void shuffle(UList<T>& a); // Reverse the first n elements of the list template<class T> -inline void reverse(UList<T>&, const label n); +inline void reverse(UList<T>& ul, const label n); // Reverse all the elements of the list template<class T> -inline void reverse(UList<T>&); +inline void reverse(UList<T>& ul); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/containers/Lists/UList/UListIO.C b/src/OpenFOAM/containers/Lists/UList/UListIO.C index d55860f2eaa76f5b0463ca8d01c70d904157cd4d..0cdf2f2dd5c692f67e6cf6b63358c9dc89912857 100644 --- a/src/OpenFOAM/containers/Lists/UList/UListIO.C +++ b/src/OpenFOAM/containers/Lists/UList/UListIO.C @@ -201,7 +201,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L) if (is.format() == IOstream::ASCII || !contiguous<T>()) { // Read beginning of contents - char delimiter = is.readBeginList("List"); + const char delimiter = is.readBeginList("List"); if (s) { diff --git a/src/OpenFOAM/fields/Fields/Field/SubFieldI.H b/src/OpenFOAM/fields/Fields/Field/SubFieldI.H index 67aa4c4adb7caad44f4d00ff0b3746b99f5b34f8..4919f78fe1cf0526d370ebcedf8f0e98559da0fd 100644 --- a/src/OpenFOAM/fields/Fields/Field/SubFieldI.H +++ b/src/OpenFOAM/fields/Fields/Field/SubFieldI.H @@ -139,7 +139,7 @@ inline void Foam::SubField<Type>::operator= template<class Type> inline Foam::SubField<Type>::operator const Foam::Field<Type>&() const { - return *reinterpret_cast<const Field<Type>* >(this); + return *reinterpret_cast<const Field<Type>*>(this); } diff --git a/src/mesh/blockMesh/blockMeshTools/blockMeshToolsTemplates.C b/src/mesh/blockMesh/blockMeshTools/blockMeshToolsTemplates.C index 1df2dcc975a77f5498c66b46eb4db6a51f694404..c46fef2fc30510680e8ef37f396f67d948f64015 100644 --- a/src/mesh/blockMesh/blockMeshTools/blockMeshToolsTemplates.C +++ b/src/mesh/blockMesh/blockMeshTools/blockMeshToolsTemplates.C @@ -37,21 +37,19 @@ void Foam::blockMeshTools::read if (firstToken.isLabel()) { - label s = firstToken.labelToken(); + const label s = firstToken.labelToken(); // Set list length to that read L.setSize(s); - // Read list contents depending on data format - // Read beginning of contents - char delimiter = is.readBeginList("List"); + const char delimiter = is.readBeginList("List"); if (s) { if (delimiter == token::BEGIN_LIST) { - for (label i=0; i<s; i++) + for (label i=0; i<s; ++i) { read(is, L[i], dict); }