mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
consistency update
- DynamicList gets append methods as per List - misc cosmetic changes
This commit is contained in:
@ -160,18 +160,33 @@ int main(int argc, char *argv[])
|
||||
<< " " << lstB.size() << endl;
|
||||
Info<< "<dlD>" << dlD << "</dlD>" << nl << "sizes: "
|
||||
<< " " << dlD.size() << "/" << dlD.capacity() << endl;
|
||||
|
||||
|
||||
DynamicList<label,10> dlE1(10);
|
||||
DynamicList<label> dlE2(dlE1);
|
||||
DynamicList<label> dlE2(dlE1); // construct dissimilar
|
||||
|
||||
Info<< "<dlE1>" << dlE1 << "</dlE1>" << nl << "sizes: "
|
||||
<< " " << dlE1.size() << "/" << dlE1.capacity() << endl;
|
||||
Info<< "<dlE2>" << dlE2 << "</dlE2>" << nl << "sizes: "
|
||||
<< " " << dlE2.size() << "/" << dlE2.capacity() << endl;
|
||||
|
||||
dlE2.append(100);
|
||||
for (label elemI=0; elemI < 5; ++elemI)
|
||||
{
|
||||
dlE1.append(4 - elemI);
|
||||
dlE2.append(elemI);
|
||||
}
|
||||
|
||||
Info<< "<dlE2>" << dlE2 << "</dlE2>" << endl;
|
||||
|
||||
|
||||
DynamicList<label> dlE3(dlE2); // construct identical
|
||||
Info<< "<dlE3>" << dlE3 << "</dlE3>" << endl;
|
||||
|
||||
dlE3 = dlE1; // assign dissimilar
|
||||
Info<< "<dlE3>" << dlE3 << "</dlE3>" << endl;
|
||||
|
||||
dlE3 = dlE2; // assign identical
|
||||
Info<< "<dlE3>" << dlE3 << "</dlE3>" << endl;
|
||||
|
||||
|
||||
Info<< "\nEnd\n";
|
||||
|
||||
return 0;
|
||||
|
||||
@ -39,7 +39,7 @@ using namespace Foam;
|
||||
|
||||
int main()
|
||||
{
|
||||
HASHTABLE_CLASS<double> table1(100);
|
||||
HASHTABLE_CLASS<double> table1(13);
|
||||
|
||||
table1.insert("aaa", 1.0);
|
||||
table1.insert("aba", 2.0);
|
||||
@ -56,7 +56,8 @@ int main()
|
||||
table1.erase("abs");
|
||||
|
||||
Info<< "\ntable1 toc: " << table1.toc() << endl;
|
||||
Info<< "\ntable1 [" << table1.size() << "] " << endl;
|
||||
table1.printInfo(Info)
|
||||
<< "table1 [" << table1.size() << "] " << endl;
|
||||
forAllIter(HASHTABLE_CLASS<double>, table1, iter)
|
||||
{
|
||||
Info<< iter.key() << " => " << iter() << nl;
|
||||
@ -97,7 +98,7 @@ int main()
|
||||
<< "transfer table1 -> table3 via the xfer() method" << nl;
|
||||
|
||||
Info<< "\ntable1" << table1 << nl
|
||||
<< "\ntable2" << table1 << nl
|
||||
<< "\ntable2" << table2 << nl
|
||||
<< "\ntable3" << table3 << nl;
|
||||
|
||||
Info<< "\nerase table2 by iterator" << nl;
|
||||
@ -113,10 +114,14 @@ int main()
|
||||
<< "\ntable3" << table3 << nl;
|
||||
|
||||
table3.resize(1);
|
||||
Info<< "\nresize(1) table3" << table3 << nl;
|
||||
Info<< "\nresize(1) table3" << nl;
|
||||
table3.printInfo(Info)
|
||||
<< table3 << nl;
|
||||
|
||||
table3.resize(10000);
|
||||
Info<< "\nresize(10000) table3" << table3 << nl;
|
||||
Info<< "\nresize(10000) table3" << nl;
|
||||
table3.printInfo(Info)
|
||||
<< table3 << nl;
|
||||
|
||||
HASHTABLE_CLASS<double> table4;
|
||||
|
||||
@ -134,26 +139,27 @@ int main()
|
||||
table1.erase(table1.begin());
|
||||
Info<< "removed an element - test table1 != table3 : "
|
||||
<< (table1 != table3) << nl;
|
||||
|
||||
|
||||
// insert a few things into table2
|
||||
table2.set("ada", 14.0);
|
||||
table2.set("aeq", 15.0);
|
||||
table2.set("aaw", 16.0);
|
||||
table2.set("abs", 17.0);
|
||||
table2.set("adx", 20.0);
|
||||
|
||||
|
||||
Info<< "\ntable1" << table1 << nl
|
||||
<< "\ntable2" << table2 << nl;
|
||||
|
||||
label nErased = table1.erase(table2);
|
||||
|
||||
|
||||
Info<< "\nerase table2 keys from table1 (removed "
|
||||
<< nErased << " elements)" << nl
|
||||
<< "\ntable1" << table1 << nl
|
||||
<< "\ntable2" << table2 << nl;
|
||||
|
||||
|
||||
Info<< "\nclearStorage table3 ... ";
|
||||
Info<< "\ntable3" << table3
|
||||
<< "\nclearStorage table3 ... ";
|
||||
table3.clearStorage();
|
||||
Info<< table3 << nl;
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ using namespace Foam;
|
||||
|
||||
int main()
|
||||
{
|
||||
HASHTABLE_CLASS<double> table1(100);
|
||||
HASHTABLE_CLASS<double> table1(13);
|
||||
|
||||
table1.insert("aaa", 1.0);
|
||||
table1.insert("aba", 2.0);
|
||||
@ -56,7 +56,8 @@ int main()
|
||||
table1.erase("abs");
|
||||
|
||||
Info<< "\ntable1 toc: " << table1.toc() << endl;
|
||||
Info<< "\ntable1 [" << table1.size() << "] " << endl;
|
||||
table1.printInfo(Info)
|
||||
<< "table1 [" << table1.size() << "] " << endl;
|
||||
forAllIter(HASHTABLE_CLASS<double>, table1, iter)
|
||||
{
|
||||
Info<< iter.key() << " => " << iter() << nl;
|
||||
@ -97,7 +98,7 @@ int main()
|
||||
<< "transfer table1 -> table3 via the xfer() method" << nl;
|
||||
|
||||
Info<< "\ntable1" << table1 << nl
|
||||
<< "\ntable2" << table1 << nl
|
||||
<< "\ntable2" << table2 << nl
|
||||
<< "\ntable3" << table3 << nl;
|
||||
|
||||
Info<< "\nerase table2 by iterator" << nl;
|
||||
@ -113,10 +114,14 @@ int main()
|
||||
<< "\ntable3" << table3 << nl;
|
||||
|
||||
table3.resize(1);
|
||||
Info<< "\nresize(1) table3" << table3 << nl;
|
||||
Info<< "\nresize(1) table3" << nl;
|
||||
table3.printInfo(Info)
|
||||
<< table3 << nl;
|
||||
|
||||
table3.resize(10000);
|
||||
Info<< "\nresize(10000) table3" << table3 << nl;
|
||||
Info<< "\nresize(10000) table3" << nl;
|
||||
table3.printInfo(Info)
|
||||
<< table3 << nl;
|
||||
|
||||
HASHTABLE_CLASS<double> table4;
|
||||
|
||||
@ -134,26 +139,27 @@ int main()
|
||||
table1.erase(table1.begin());
|
||||
Info<< "removed an element - test table1 != table3 : "
|
||||
<< (table1 != table3) << nl;
|
||||
|
||||
|
||||
// insert a few things into table2
|
||||
table2.set("ada", 14.0);
|
||||
table2.set("aeq", 15.0);
|
||||
table2.set("aaw", 16.0);
|
||||
table2.set("abs", 17.0);
|
||||
table2.set("adx", 20.0);
|
||||
|
||||
|
||||
Info<< "\ntable1" << table1 << nl
|
||||
<< "\ntable2" << table2 << nl;
|
||||
|
||||
label nErased = table1.erase(table2);
|
||||
|
||||
|
||||
Info<< "\nerase table2 keys from table1 (removed "
|
||||
<< nErased << " elements)" << nl
|
||||
<< "\ntable1" << table1 << nl
|
||||
<< "\ntable2" << table2 << nl;
|
||||
|
||||
|
||||
Info<< "\nclearStorage table3 ... ";
|
||||
Info<< "\ntable3" << table3
|
||||
<< "\nclearStorage table3 ... ";
|
||||
table3.clearStorage();
|
||||
Info<< table3 << nl;
|
||||
|
||||
@ -162,4 +168,5 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -27,6 +27,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "UIndirectList.H"
|
||||
#include "DynamicList.H"
|
||||
#include "IOstreams.H"
|
||||
#include "ListOps.H"
|
||||
#include "OFstream.H"
|
||||
@ -58,11 +59,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
idl[1] = -666;
|
||||
|
||||
Info<< "idl[1] changed:" << idl << endl;
|
||||
Info<< "idl[1] changed: " << idl << endl;
|
||||
|
||||
idl = -999;
|
||||
|
||||
Info<< "idl changed:" << idl << endl;
|
||||
Info<< "idl changed: " << idl << endl;
|
||||
|
||||
UIndirectList<double> idl2(idl);
|
||||
|
||||
@ -79,17 +80,26 @@ int main(int argc, char *argv[])
|
||||
idl = ident;
|
||||
}
|
||||
|
||||
Info<< "idl assigned from UList:" << idl << endl;
|
||||
Info<< "idl assigned from UList: " << idl << endl;
|
||||
|
||||
List<double> realList = UIndirectList<double>(completeList, addresses);
|
||||
// test List operations
|
||||
|
||||
Info<< "realList:" << realList << endl;
|
||||
List<double> flatList = UIndirectList<double>(completeList, addresses);
|
||||
Info<< "List assigned from UIndirectList: " << flatList << endl;
|
||||
|
||||
List<double> realList2(UIndirectList<double>(completeList, addresses));
|
||||
List<double> flatList2(UIndirectList<double>(completeList, addresses));
|
||||
Info<< "List constructed from UIndirectList: " << flatList2 << endl;
|
||||
|
||||
Info<< "realList2:" << realList2 << endl;
|
||||
flatList.append(UIndirectList<double>(completeList, addresses));
|
||||
Info<< "List::append(UIndirectList): " << flatList << endl;
|
||||
|
||||
|
||||
DynamicList<double> dynList(UIndirectList<double>(completeList, addresses));
|
||||
Info<< "DynamicList constructed from UIndirectList: " << dynList << endl;
|
||||
|
||||
dynList.append(UIndirectList<double>(completeList, addresses));
|
||||
Info<< "DynamicList::append(UIndirectList): " << dynList << endl;
|
||||
|
||||
Info << "\nEnd\n" << endl;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user