COMP: fixup test applications

This commit is contained in:
Mark Olesen 2022-11-30 11:36:40 +00:00
parent f9191b9377
commit 8d4e32da22
12 changed files with 59 additions and 60 deletions

View File

@ -64,23 +64,23 @@ inline Ostream& report
int main(int argc, char *argv[])
{
CircularBuffer<label> buf1(1); report(buf1);
buf1.append(10); report(buf1);
buf1.push_back(10); report(buf1);
Info<< buf1.range_one() << nl;
buf1.append(20); report(buf1);
buf1.append(30); report(buf1);
buf1.push_back(20); report(buf1);
buf1.push_back(30); report(buf1);
buf1.push_back(40); report(buf1);
buf1.push_front(-50); report(buf1);
buf1.append(60); report(buf1);
buf1.append(labelList({70,80,90})); report(buf1);
buf1.push_back(60); report(buf1);
buf1.push_back(labelList({70,80,90})); report(buf1);
Info<< nl << "access: " << buf1 << nl;
Info<< buf1[-12] << nl;
Info<< "found: " << buf1.found(40) << nl;
buf1.appendUniq(100); report(buf1);
buf1.push_uniq(100); report(buf1);
buf1 = Zero; report(buf1);
@ -92,7 +92,7 @@ int main(int argc, char *argv[])
}
report(buf1);
buf1.append(identity(5)); report(buf1);
buf1.push_back(identity(5)); report(buf1);
buf1.info(Info);
Info<< buf1 << nl;

View File

@ -67,11 +67,11 @@ int main(int argc, char *argv[])
for (int i = 0; i<10; i++)
{
myList.append(1.3*i);
myList.push_back(1.3*i);
}
myList.append(100.3);
myList.append(500.3);
myList.push_back(100.3);
myList.push_back(500.3);
Info<< "DLList<scalar>" << nl;
Info<< nl << "flat-output: " << flatOutput(myList) << nl;
@ -144,9 +144,9 @@ int main(int argc, char *argv[])
Info<< " => " << flatOutput(myList) << nl;
}
myList.append(500.3);
myList.append(200.3);
myList.append(100.3);
myList.push_back(500.3);
myList.push_back(200.3);
myList.push_back(100.3);
Info<< nl << "Testing swapUp and swapDown:" << nl;
Info<< " => " << flatOutput(myList) << nl;
@ -200,7 +200,7 @@ int main(int argc, char *argv[])
for (int i = 0; i<5; i++)
{
labList.append(identity(6));
labList.push_back(identity(6));
}
Info<< nl
@ -221,16 +221,16 @@ int main(int argc, char *argv[])
List<label> content1 = identity(10);
Info<< nl
<< " move append ";
<< " move push_back ";
printAddress(content1);
labList.append(std::move(content1));
labList.push_back(std::move(content1));
Info<< " content " << flatOutput(content1) << nl
<< " list" << labList << nl;
printAddresses(labList);
// labList.append(content1);
// labList.push_back(content1);
}
Info<< nl << "Done." << endl;

View File

@ -76,11 +76,11 @@ int main(int argc, char *argv[])
for (int i = 0; i<10; i++)
{
myList.append(new Scalar(1.3*i));
myList.push_back(new Scalar(1.3*i));
}
myList.append(new Scalar(100.3));
myList.append(new Scalar(500.3));
myList.push_back(new Scalar(100.3));
myList.push_back(new Scalar(500.3));
Info<< "ISLList<scalar>" << myList << nl;
Info<< nl << "flat-output: " << flatOutput(myList) << nl;

View File

@ -214,8 +214,8 @@ int main(int argc, char *argv[])
forAllReverseIters(list2, iter) { *iter *= 0.5; Info<< " " << *iter; }
Info<< endl;
list1.append(list2);
Info<< "list1.append(list2): " << list1 << endl;
list1.push_back(list2);
Info<< "list1.push_back(list2): " << list1 << endl;
for (const vector& val : { vector(3, 4, 5), vector(10,11, 12)} )
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2021 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -245,10 +245,10 @@ int main(int argc, char *argv[])
list1.resize(8);
report(list1);
Info<< "\ntest append() operation\n";
list1.append(2);
list1.append(3);
list1.append(4);
Info<< "\ntest push_back() operation\n";
list1.push_back(2);
list1.push_back(3);
list1.push_back(4);
report(list1);
Info<< "\ntest reserve() operation\n";
@ -326,9 +326,9 @@ int main(int argc, char *argv[])
report(list1);
Info<< "\ntest copy constructor + append\n";
Info<< "\ntest copy constructor + push_back\n";
PackedList<3> list2(list1);
list2.append(4);
list2.push_back(4);
Info<< "source list:\n";
report(list1);

View File

@ -67,11 +67,11 @@ int main(int argc, char *argv[])
for (int i = 0; i<10; i++)
{
myList.append(1.3*i);
myList.push_back(1.3*i);
}
myList.append(100.3);
myList.append(500.3);
myList.push_back(100.3);
myList.push_back(500.3);
Info<< "SLList<scalar>" << myList << nl;
Info<< nl << "flat-output: " << flatOutput(myList) << nl;
@ -103,11 +103,11 @@ int main(int argc, char *argv[])
for (int i = 0; i<10; i++)
{
myList.append(1.3*i);
myList.push_back(1.3*i);
}
myList.append(100.3);
myList.append(500.3);
myList.push_back(100.3);
myList.push_back(500.3);
Info<< nl << "Transfer: " << nl;
Info<< "original: " << flatOutput(myList) << endl;
@ -143,7 +143,7 @@ int main(int argc, char *argv[])
for (int i = 0; i<5; i++)
{
labList.append(identity(6));
labList.push_back(identity(6));
}
Info<< nl
@ -164,16 +164,16 @@ int main(int argc, char *argv[])
List<label> content1 = identity(10);
Info<< nl
<< " move append ";
<< " move push_back ";
printAddress(content1);
labList.append(std::move(content1));
labList.push_back(std::move(content1));
Info<< " content " << flatOutput(content1) << nl
<< " list" << labList << nl;
printAddresses(labList);
// labList.append(content1);
// labList.push_back(content1);
}
Info<< nl << "Done." << endl;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -165,24 +165,24 @@ int main(int argc, char *argv[])
// Use predicate, or test() method
if (list2(1))
if (list2.test(1))
{
Info<< "1 is on (original)" << nl;
}
if (!list2(2))
if (!list2.test(2))
{
Info<< "2 is off (original)" << nl;
}
if (!list2(100))
if (!list2.test(100))
{
Info<< "100 is off (original)" << nl;
}
if (wrapper(1))
if (wrapper.test(1))
{
Info<< "1 is on (wrapped)" << nl;
}
if (!wrapper(2))
if (!wrapper.test(2))
{
Info<< "2 is off (wrapped)" << nl;
}

View File

@ -72,13 +72,13 @@ public:
// Member Functions
//- Is empty
bool empty() const
bool empty() const noexcept
{
return bits_.empty() && bools_.empty();
}
//- Size
label size() const
label size() const noexcept
{
return bits_.size() + bools_.size();
}
@ -93,7 +93,7 @@ public:
bool operator()(const label i) const
{
// Can also use test(i) etc...
return bits_(i) || bools_(i);
return bits_.test(i) || bools_.test(i);
}
};

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2021 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -59,7 +59,7 @@ void basicTests(const coordinateSystem& cs)
{
cs.writeEntry(cs.name(), Info);
if ((const auto* cartptr = isA<coordSystem::cartesian>(cs)) != nullptr)
if (const auto* cartptr = isA<coordSystem::cartesian>(cs))
{
if (!cartptr->valid())
{

View File

@ -31,6 +31,8 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "rigidBodyMotion.H"
#include "masslessBody.H"
#include "sphere.H"
@ -46,10 +48,14 @@ using namespace RBD;
int main(int argc, char *argv[])
{
#include "setRootCase.H"
autoPtr<Time> dummyTimePtr(Time::New(args));
dictionary springDict(IFstream("spring")());
// Create the spring model from dictionary
rigidBodyMotion spring(springDict);
rigidBodyMotion spring(dummyTimePtr(), springDict);
label nIter(springDict.get<label>("nIter"));

View File

@ -103,7 +103,7 @@ public:
// Sizing
//- Size of the underlying storage.
inline label capacity() const noexcept;
label capacity() const noexcept { return capacity_; }
//- Reserve allocation space for at least this size.
inline void reserve(const label len);
@ -268,7 +268,7 @@ public:
template<int AnySizeMin>
void append(PtrDynList<T, AnySizeMin>&& other)
{
this->push_back(other);
this->push_back(std::move(other));
}
};

View File

@ -94,13 +94,6 @@ inline Foam::PtrDynList<T, SizeMin>::PtrDynList(UList<T*>& list)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T, int SizeMin>
inline Foam::label Foam::PtrDynList<T, SizeMin>::capacity() const noexcept
{
return capacity_;
}
template<class T, int SizeMin>
inline void Foam::PtrDynList<T, SizeMin>::reserve(const label len)
{