STYLE: use push_back when walking cell queues
STYLE: use push_back for OTstream
This commit is contained in:
parent
0767e21d8c
commit
fdd7e4d87f
@ -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;
|
||||
}
|
||||
|
@ -101,13 +101,13 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- The tokens
|
||||
const DynamicList<token>& tokens() const
|
||||
const DynamicList<token>& tokens() const noexcept
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
//- The tokens
|
||||
DynamicList<token>& tokens()
|
||||
DynamicList<token>& tokens() noexcept
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SubStrings_H
|
||||
#define SubStrings_H
|
||||
#ifndef Foam_SubStrings_H
|
||||
#define Foam_SubStrings_H
|
||||
|
||||
#include <regex> // For std::sub_match
|
||||
#include <string>
|
||||
@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user