mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: linked-lists accept more familiar STL method names
- ie, front(), back(), push_front(), push_back(), pop_front() ENH: add CircularBuffer flattening operator() and list() method - useful if assigning content to a List etc BUG: CircularBuffer find() did not return logical index
This commit is contained in:
committed by
Andrew Heather
parent
9f9b8fb662
commit
f3ba6c6da0
@ -88,7 +88,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
while (buf1.size() > 2)
|
||||
{
|
||||
(void) buf1.pop_front();
|
||||
buf1.pop_front();
|
||||
}
|
||||
report(buf1);
|
||||
|
||||
@ -123,6 +123,8 @@ int main(int argc, char *argv[])
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
Info<< nl << "list: " << flatOutput(buf2.list()) << nl;
|
||||
|
||||
Info<< "normal: " << flatOutput(buf2) << nl;
|
||||
buf2.reverse();
|
||||
Info<< "reverse: " << flatOutput(buf2) << nl;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -152,15 +152,15 @@ int main(int argc, char *argv[])
|
||||
Info<< " => " << flatOutput(myList) << nl;
|
||||
|
||||
{
|
||||
myList.swapUp(myList.DLListBase::first());
|
||||
myList.swapUp(myList.DLListBase::last());
|
||||
myList.swapUp(myList.DLListBase::front());
|
||||
myList.swapUp(myList.DLListBase::back());
|
||||
|
||||
Info<< nl << "swapUp => " << flatOutput(myList) << nl;
|
||||
}
|
||||
|
||||
{
|
||||
myList.swapDown(myList.DLListBase::first());
|
||||
myList.swapDown(myList.DLListBase::last());
|
||||
myList.swapDown(myList.DLListBase::front());
|
||||
myList.swapDown(myList.DLListBase::back());
|
||||
|
||||
Info<< nl << "swapDown => " << flatOutput(myList) << nl;
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ Ostream& printAddr
|
||||
|
||||
for (label i=0; i < len; ++i)
|
||||
{
|
||||
os << "addr=" << name(list(i)) << nl;
|
||||
os << "addr=" << Foam::name(list.get(i)) << nl;
|
||||
}
|
||||
|
||||
// End delimiter
|
||||
@ -140,7 +140,7 @@ Ostream& print
|
||||
|
||||
for (label i=0; i < len; ++i)
|
||||
{
|
||||
const T* ptr = list(i);
|
||||
const T* ptr = list.get(i);
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
@ -174,7 +174,7 @@ Ostream& print
|
||||
|
||||
for (label i=0; i < len; ++i)
|
||||
{
|
||||
const T* ptr = list(i);
|
||||
const T* ptr = list.get(i);
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
@ -192,7 +192,7 @@ Ostream& print
|
||||
|
||||
for (label i=len; i < cap; ++i)
|
||||
{
|
||||
const T* ptr = list(i);
|
||||
const T* ptr = list.get(i);
|
||||
|
||||
os << "unused " << name(ptr) << nl;
|
||||
}
|
||||
@ -274,9 +274,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
{
|
||||
DLPtrList<Scalar> llist1;
|
||||
llist1.prepend(new Scalar(100));
|
||||
llist1.prepend(new Scalar(200));
|
||||
llist1.prepend(new Scalar(300));
|
||||
llist1.push_front(new Scalar(100));
|
||||
llist1.push_front(new Scalar(200));
|
||||
llist1.push_front(new Scalar(300));
|
||||
|
||||
auto citer = llist1.begin();
|
||||
|
||||
@ -305,9 +305,9 @@ int main(int argc, char *argv[])
|
||||
// Same but as SLPtrList
|
||||
{
|
||||
SLPtrList<Scalar> llist1;
|
||||
llist1.prepend(new Scalar(100));
|
||||
llist1.prepend(new Scalar(200));
|
||||
llist1.prepend(new Scalar(300));
|
||||
llist1.push_front(new Scalar(100));
|
||||
llist1.push_front(new Scalar(200));
|
||||
llist1.push_front(new Scalar(300));
|
||||
|
||||
for (const auto& it : llist1)
|
||||
{
|
||||
@ -633,7 +633,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
forAll(dynPlanes, i)
|
||||
{
|
||||
const plane* pln = dynPlanes.set(i);
|
||||
const plane* pln = dynPlanes.get(i);
|
||||
if (pln)
|
||||
{
|
||||
stdPlanes.set(i, new plane(*pln));
|
||||
|
||||
Reference in New Issue
Block a user