mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: not incrementing when reading via singly-linked list
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -42,7 +42,11 @@ See also
|
||||
#include "vector.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
#include<list>
|
||||
#include "labelRange.H"
|
||||
#include "ListOps.H"
|
||||
#include "SubList.H"
|
||||
|
||||
#include <list>
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -61,6 +65,19 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
if (false)
|
||||
{
|
||||
labelList intlist(IStringStream("(0 1 2)")());
|
||||
Info<<"construct from Istream: " << intlist << endl;
|
||||
|
||||
IStringStream("(3 4 5)")() >> static_cast<labelUList&>(intlist);
|
||||
Info<<"is >>: " << intlist << endl;
|
||||
|
||||
IStringStream("(6 7 8)")() >> intlist;
|
||||
Info<<"is >>: " << intlist << endl;
|
||||
}
|
||||
|
||||
|
||||
List<vector> list1(IStringStream("1 ((0 1 2))")());
|
||||
Info<< "list1: " << list1 << endl;
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ Foam::Istream& Foam::operator>>(Istream& is, List<T>& L)
|
||||
}
|
||||
else if (firstToken.isLabel())
|
||||
{
|
||||
label s = firstToken.labelToken();
|
||||
const label s = firstToken.labelToken();
|
||||
|
||||
// Set list length to that read
|
||||
L.setSize(s);
|
||||
|
||||
@ -183,7 +183,7 @@ bool Foam::UList<T>::operator<(const UList<T>& a) const
|
||||
(
|
||||
const_iterator vi = begin(), ai = a.begin();
|
||||
vi < end() && ai < a.end();
|
||||
vi++, ai++
|
||||
++vi, ++ai
|
||||
)
|
||||
{
|
||||
if (*vi < *ai)
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -165,7 +165,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
|
||||
)
|
||||
);
|
||||
// Check list length
|
||||
label s = elems.size();
|
||||
const label s = elems.size();
|
||||
|
||||
if (s != L.size())
|
||||
{
|
||||
@ -174,14 +174,14 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
|
||||
<< " expected " << L.size()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
for (label i=0; i<s; i++)
|
||||
for (label i=0; i<s; ++i)
|
||||
{
|
||||
L[i] = elems[i];
|
||||
}
|
||||
}
|
||||
else if (firstToken.isLabel())
|
||||
{
|
||||
label s = firstToken.labelToken();
|
||||
const label s = firstToken.labelToken();
|
||||
|
||||
// Set list length to that read
|
||||
if (s != L.size())
|
||||
@ -203,7 +203,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
|
||||
{
|
||||
if (delimiter == token::BEGIN_LIST)
|
||||
{
|
||||
for (label i=0; i<s; i++)
|
||||
for (label i=0; i<s; ++i)
|
||||
{
|
||||
is >> L[i];
|
||||
|
||||
@ -226,7 +226,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
|
||||
"reading the single entry"
|
||||
);
|
||||
|
||||
for (label i=0; i<s; i++)
|
||||
for (label i=0; i<s; ++i)
|
||||
{
|
||||
L[i] = element;
|
||||
}
|
||||
@ -281,7 +281,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
|
||||
(
|
||||
typename SLList<T>::const_iterator iter = sll.begin();
|
||||
iter != sll.end();
|
||||
++iter
|
||||
++iter, ++i
|
||||
)
|
||||
{
|
||||
L[i] = iter();
|
||||
|
||||
Reference in New Issue
Block a user