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())
|
if (tok.good())
|
||||||
{
|
{
|
||||||
append(tok);
|
tokens().push_back(tok);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ Foam::Ostream& Foam::OTstream::write(const char c)
|
|||||||
if (!std::isspace(c) && std::isprint(c))
|
if (!std::isspace(c) && std::isprint(c))
|
||||||
{
|
{
|
||||||
// Should generally work, but need to verify corner cases
|
// Should generally work, but need to verify corner cases
|
||||||
append(token(token::punctuationToken(c)));
|
tokens().push_back(token(token::punctuationToken(c)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
@ -76,7 +76,7 @@ Foam::Ostream& Foam::OTstream::write(const char* str)
|
|||||||
|
|
||||||
Foam::Ostream& Foam::OTstream::write(const word& str)
|
Foam::Ostream& Foam::OTstream::write(const word& str)
|
||||||
{
|
{
|
||||||
append(token(str)); // tokenType::WORD
|
tokens().push_back(token(str)); // tokenType::WORD
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ Foam::Ostream& Foam::OTstream::write(const word& str)
|
|||||||
|
|
||||||
Foam::Ostream& Foam::OTstream::write(const string& str)
|
Foam::Ostream& Foam::OTstream::write(const string& str)
|
||||||
{
|
{
|
||||||
append(token(str)); // tokenType::STRING
|
tokens().push_back(token(str)); // tokenType::STRING
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -98,11 +98,11 @@ Foam::Ostream& Foam::OTstream::writeQuoted
|
|||||||
{
|
{
|
||||||
if (quoted)
|
if (quoted)
|
||||||
{
|
{
|
||||||
append(token(string(str))); // tokenType::STRING
|
tokens().push_back(token(string(str))); // tokenType::STRING
|
||||||
}
|
}
|
||||||
else if (!str.empty())
|
else if (!str.empty())
|
||||||
{
|
{
|
||||||
append(token(word(str, false))); // tokenType::WORD
|
tokens().push_back(token(word(str, false))); // tokenType::WORD
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
@ -111,7 +111,7 @@ Foam::Ostream& Foam::OTstream::writeQuoted
|
|||||||
|
|
||||||
Foam::Ostream& Foam::OTstream::write(const int32_t val)
|
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;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ Foam::Ostream& Foam::OTstream::write(const int32_t val)
|
|||||||
|
|
||||||
Foam::Ostream& Foam::OTstream::write(const int64_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;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -127,7 +127,7 @@ Foam::Ostream& Foam::OTstream::write(const int64_t val)
|
|||||||
|
|
||||||
Foam::Ostream& Foam::OTstream::write(const float val)
|
Foam::Ostream& Foam::OTstream::write(const float val)
|
||||||
{
|
{
|
||||||
append(token(val)); // tokenType::FLOAT
|
tokens().push_back(token(val)); // tokenType::FLOAT
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -135,7 +135,7 @@ Foam::Ostream& Foam::OTstream::write(const float val)
|
|||||||
|
|
||||||
Foam::Ostream& Foam::OTstream::write(const double val)
|
Foam::Ostream& Foam::OTstream::write(const double val)
|
||||||
{
|
{
|
||||||
append(token(val)); // tokenType::DOUBLE
|
tokens().push_back(token(val)); // tokenType::DOUBLE
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -101,13 +101,13 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- The tokens
|
//- The tokens
|
||||||
const DynamicList<token>& tokens() const
|
const DynamicList<token>& tokens() const noexcept
|
||||||
{
|
{
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- The tokens
|
//- The tokens
|
||||||
DynamicList<token>& tokens()
|
DynamicList<token>& tokens() noexcept
|
||||||
{
|
{
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2022 OpenCFD Ltd.
|
Copyright (C) 2022-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -137,8 +137,8 @@ Foam::labelList cuthill_mckee_algorithm
|
|||||||
if (unvisited.test(nbr))
|
if (unvisited.test(nbr))
|
||||||
{
|
{
|
||||||
// Not visited (or removed), add to the list
|
// Not visited (or removed), add to the list
|
||||||
nbrCells.append(nbr);
|
nbrCells.push_back(nbr);
|
||||||
weights.append(nbrCount);
|
weights.push_back(nbrCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,8 +284,8 @@ Foam::labelList Foam::meshTools::bandCompression
|
|||||||
if (unvisited.test(nbr))
|
if (unvisited.test(nbr))
|
||||||
{
|
{
|
||||||
// Not visited (or removed), add to the list
|
// Not visited (or removed), add to the list
|
||||||
nbrCells.append(nbr);
|
nbrCells.push_back(nbr);
|
||||||
weights.append(nbrCount);
|
weights.push_back(nbrCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef SubStrings_H
|
#ifndef Foam_SubStrings_H
|
||||||
#define SubStrings_H
|
#define Foam_SubStrings_H
|
||||||
|
|
||||||
#include <regex> // For std::sub_match
|
#include <regex> // For std::sub_match
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -88,6 +88,12 @@ public:
|
|||||||
return len;
|
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
|
//- Append sub-string defined by begin/end iterators
|
||||||
void append
|
void append
|
||||||
(
|
(
|
||||||
@ -116,12 +122,6 @@ public:
|
|||||||
{
|
{
|
||||||
return this->back();
|
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))
|
if (unvisited.test(nbr))
|
||||||
{
|
{
|
||||||
// Not visited (or removed), add to the list
|
// Not visited (or removed), add to the list
|
||||||
nbrCells.append(nbr);
|
nbrCells.push_back(nbr);
|
||||||
weights.append(nbrCount);
|
weights.push_back(nbrCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user