mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: compilation of some unit tests
This commit is contained in:
@ -35,12 +35,20 @@ Description
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
template<class T>
|
||||
Ostream& printInfo(Ostream& os, const HashTable<T, T, Hash<T>>& ht)
|
||||
{
|
||||
os << " (size " << ht.size() << " capacity " << ht.capacity() << ") ";
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
const label nLoops = 30;
|
||||
const label nLoops = 300;
|
||||
const label nBase = 100000;
|
||||
const label nSize = nLoops * nBase;
|
||||
|
||||
@ -52,17 +60,18 @@ int main(int argc, char *argv[])
|
||||
// StaticHashTable<label, label, Hash<label>> map(2 * nSize);
|
||||
HashTable<label, label, Hash<label>> map(2 * nSize);
|
||||
|
||||
Info<< "Constructed map of size: " << nSize
|
||||
<< " (size " << map.size() << " capacity " << map.capacity() << ") "
|
||||
<< " " << timer.cpuTimeIncrement() << " s\n\n";
|
||||
Info<< "Constructed map of size: " << nSize;
|
||||
printInfo(Info, map);
|
||||
Info<< timer.cpuTimeIncrement() << " s\n\n";
|
||||
|
||||
for (label i = 0; i < nSize; i++)
|
||||
{
|
||||
map.insert(i, i);
|
||||
}
|
||||
Info<< "Inserted " << nSize << " elements"
|
||||
<< " (size " << map.size() << " capacity " << map.capacity() << ") "
|
||||
<< timer.cpuTimeIncrement() << " s\n";
|
||||
|
||||
Info<< "Inserted " << nSize << " elements";
|
||||
printInfo(Info, map);
|
||||
Info<< timer.cpuTimeIncrement() << " s\n\n";
|
||||
|
||||
label elemI = 0;
|
||||
for (label iLoop = 0; iLoop < nLoops; iLoop++)
|
||||
@ -72,12 +81,14 @@ int main(int argc, char *argv[])
|
||||
map.erase(elemI++);
|
||||
}
|
||||
|
||||
map.shrink();
|
||||
Info<< "loop " << iLoop << " - Erased " << nBase << " elements"
|
||||
<< " (size " << map.size() << " capacity " << map.capacity() << ") "
|
||||
<< timer.cpuTimeIncrement() << " s\n";
|
||||
// map.shrink();
|
||||
Info<< "loop " << iLoop << " - Erased " << nBase << " elements";
|
||||
printInfo(Info, map);
|
||||
Info << nl;
|
||||
}
|
||||
|
||||
Info<< timer.cpuTimeIncrement() << " s\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user