diff --git a/src/OpenFOAM/db/IOstreams/Tstreams/OTstream.C b/src/OpenFOAM/db/IOstreams/Tstreams/OTstream.C index c1134f44e1..030090d3d5 100644 --- a/src/OpenFOAM/db/IOstreams/Tstreams/OTstream.C +++ b/src/OpenFOAM/db/IOstreams/Tstreams/OTstream.C @@ -35,7 +35,7 @@ bool Foam::OTstream::write(const token& tok) { if (tok.good()) { - append(tok); + tokens().push_back(tok); return true; } @@ -48,7 +48,7 @@ Foam::Ostream& Foam::OTstream::write(const char c) if (!std::isspace(c) && std::isprint(c)) { // Should generally work, but need to verify corner cases - append(token(token::punctuationToken(c))); + tokens().push_back(token(token::punctuationToken(c))); } return *this; @@ -76,7 +76,7 @@ Foam::Ostream& Foam::OTstream::write(const char* str) Foam::Ostream& Foam::OTstream::write(const word& str) { - append(token(str)); // tokenType::WORD + tokens().push_back(token(str)); // tokenType::WORD return *this; } @@ -84,7 +84,7 @@ Foam::Ostream& Foam::OTstream::write(const word& str) Foam::Ostream& Foam::OTstream::write(const string& str) { - append(token(str)); // tokenType::STRING + tokens().push_back(token(str)); // tokenType::STRING return *this; } @@ -98,11 +98,11 @@ Foam::Ostream& Foam::OTstream::writeQuoted { if (quoted) { - append(token(string(str))); // tokenType::STRING + tokens().push_back(token(string(str))); // tokenType::STRING } else if (!str.empty()) { - append(token(word(str, false))); // tokenType::WORD + tokens().push_back(token(word(str, false))); // tokenType::WORD } return *this; @@ -111,7 +111,7 @@ Foam::Ostream& Foam::OTstream::writeQuoted Foam::Ostream& Foam::OTstream::write(const int32_t val) { - append(token(label(val))); // tokenType::LABEL + tokens().push_back(token(label(val))); // tokenType::LABEL return *this; } @@ -119,7 +119,7 @@ Foam::Ostream& Foam::OTstream::write(const int32_t val) Foam::Ostream& Foam::OTstream::write(const int64_t val) { - append(token(label(val))); // tokenType::LABEL + tokens().push_back(token(label(val))); // tokenType::LABEL return *this; } @@ -127,7 +127,7 @@ Foam::Ostream& Foam::OTstream::write(const int64_t val) Foam::Ostream& Foam::OTstream::write(const float val) { - append(token(val)); // tokenType::FLOAT + tokens().push_back(token(val)); // tokenType::FLOAT return *this; } @@ -135,7 +135,7 @@ Foam::Ostream& Foam::OTstream::write(const float val) Foam::Ostream& Foam::OTstream::write(const double val) { - append(token(val)); // tokenType::DOUBLE + tokens().push_back(token(val)); // tokenType::DOUBLE return *this; } diff --git a/src/OpenFOAM/db/IOstreams/Tstreams/OTstream.H b/src/OpenFOAM/db/IOstreams/Tstreams/OTstream.H index 856ba2eab4..bd6076c043 100644 --- a/src/OpenFOAM/db/IOstreams/Tstreams/OTstream.H +++ b/src/OpenFOAM/db/IOstreams/Tstreams/OTstream.H @@ -101,13 +101,13 @@ public: // Member Functions //- The tokens - const DynamicList& tokens() const + const DynamicList& tokens() const noexcept { return *this; } //- The tokens - DynamicList& tokens() + DynamicList& tokens() noexcept { return *this; } diff --git a/src/OpenFOAM/meshes/bandCompression/bandCompression.C b/src/OpenFOAM/meshes/bandCompression/bandCompression.C index 428421d4c0..ffcb574f48 100644 --- a/src/OpenFOAM/meshes/bandCompression/bandCompression.C +++ b/src/OpenFOAM/meshes/bandCompression/bandCompression.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2022 OpenCFD Ltd. + Copyright (C) 2022-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -137,8 +137,8 @@ Foam::labelList cuthill_mckee_algorithm if (unvisited.test(nbr)) { // Not visited (or removed), add to the list - nbrCells.append(nbr); - weights.append(nbrCount); + nbrCells.push_back(nbr); + weights.push_back(nbrCount); } } @@ -284,8 +284,8 @@ Foam::labelList Foam::meshTools::bandCompression if (unvisited.test(nbr)) { // Not visited (or removed), add to the list - nbrCells.append(nbr); - weights.append(nbrCount); + nbrCells.push_back(nbr); + weights.push_back(nbrCount); } } diff --git a/src/OpenFOAM/primitives/strings/lists/SubStrings.H b/src/OpenFOAM/primitives/strings/lists/SubStrings.H index 79d38b947e..8279d2d10d 100644 --- a/src/OpenFOAM/primitives/strings/lists/SubStrings.H +++ b/src/OpenFOAM/primitives/strings/lists/SubStrings.H @@ -32,8 +32,8 @@ Description \*---------------------------------------------------------------------------*/ -#ifndef SubStrings_H -#define SubStrings_H +#ifndef Foam_SubStrings_H +#define Foam_SubStrings_H #include // For std::sub_match #include @@ -88,6 +88,12 @@ public: return len; } + //- Retrieve element at pos, converted to a string type. + StringType str(size_t pos) const + { + return (*this)[pos].str(); + } + //- Append sub-string defined by begin/end iterators void append ( @@ -116,12 +122,6 @@ public: { return this->back(); } - - //- Get element at pos, converted to a string type. - StringType str(size_t pos) const - { - return (*this)[pos].str(); - } }; diff --git a/src/meshTools/polyTopoChange/polyTopoChange.C b/src/meshTools/polyTopoChange/polyTopoChange.C index a2558d09ad..60b0cc76a9 100644 --- a/src/meshTools/polyTopoChange/polyTopoChange.C +++ b/src/meshTools/polyTopoChange/polyTopoChange.C @@ -687,8 +687,8 @@ Foam::label Foam::polyTopoChange::getCellOrder if (unvisited.test(nbr)) { // Not visited (or removed), add to the list - nbrCells.append(nbr); - weights.append(nbrCount); + nbrCells.push_back(nbr); + weights.push_back(nbrCount); } }