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
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -42,6 +42,10 @@ See also
|
|||||||
#include "vector.H"
|
#include "vector.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
|
|
||||||
|
#include "labelRange.H"
|
||||||
|
#include "ListOps.H"
|
||||||
|
#include "SubList.H"
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
@ -61,6 +65,19 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#include "setRootCase.H"
|
#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))")());
|
List<vector> list1(IStringStream("1 ((0 1 2))")());
|
||||||
Info<< "list1: " << list1 << endl;
|
Info<< "list1: " << list1 << endl;
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,7 @@ Foam::Istream& Foam::operator>>(Istream& is, List<T>& L)
|
|||||||
}
|
}
|
||||||
else if (firstToken.isLabel())
|
else if (firstToken.isLabel())
|
||||||
{
|
{
|
||||||
label s = firstToken.labelToken();
|
const label s = firstToken.labelToken();
|
||||||
|
|
||||||
// Set list length to that read
|
// Set list length to that read
|
||||||
L.setSize(s);
|
L.setSize(s);
|
||||||
|
|||||||
@ -183,7 +183,7 @@ bool Foam::UList<T>::operator<(const UList<T>& a) const
|
|||||||
(
|
(
|
||||||
const_iterator vi = begin(), ai = a.begin();
|
const_iterator vi = begin(), ai = a.begin();
|
||||||
vi < end() && ai < a.end();
|
vi < end() && ai < a.end();
|
||||||
vi++, ai++
|
++vi, ++ai
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (*vi < *ai)
|
if (*vi < *ai)
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -165,7 +165,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
// Check list length
|
// Check list length
|
||||||
label s = elems.size();
|
const label s = elems.size();
|
||||||
|
|
||||||
if (s != L.size())
|
if (s != L.size())
|
||||||
{
|
{
|
||||||
@ -174,14 +174,14 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
|
|||||||
<< " expected " << L.size()
|
<< " expected " << L.size()
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
for (label i=0; i<s; i++)
|
for (label i=0; i<s; ++i)
|
||||||
{
|
{
|
||||||
L[i] = elems[i];
|
L[i] = elems[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (firstToken.isLabel())
|
else if (firstToken.isLabel())
|
||||||
{
|
{
|
||||||
label s = firstToken.labelToken();
|
const label s = firstToken.labelToken();
|
||||||
|
|
||||||
// Set list length to that read
|
// Set list length to that read
|
||||||
if (s != L.size())
|
if (s != L.size())
|
||||||
@ -203,7 +203,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
|
|||||||
{
|
{
|
||||||
if (delimiter == token::BEGIN_LIST)
|
if (delimiter == token::BEGIN_LIST)
|
||||||
{
|
{
|
||||||
for (label i=0; i<s; i++)
|
for (label i=0; i<s; ++i)
|
||||||
{
|
{
|
||||||
is >> L[i];
|
is >> L[i];
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
|
|||||||
"reading the single entry"
|
"reading the single entry"
|
||||||
);
|
);
|
||||||
|
|
||||||
for (label i=0; i<s; i++)
|
for (label i=0; i<s; ++i)
|
||||||
{
|
{
|
||||||
L[i] = element;
|
L[i] = element;
|
||||||
}
|
}
|
||||||
@ -281,7 +281,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
|
|||||||
(
|
(
|
||||||
typename SLList<T>::const_iterator iter = sll.begin();
|
typename SLList<T>::const_iterator iter = sll.begin();
|
||||||
iter != sll.end();
|
iter != sll.end();
|
||||||
++iter
|
++iter, ++i
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
L[i] = iter();
|
L[i] = iter();
|
||||||
|
|||||||
Reference in New Issue
Block a user