/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
Application
Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "boolList.H"
#include "bitSet.H"
#include "HashSet.H"
#include "cpuTime.H"
#include
#include
using namespace Foam;
#undef TEST_STD_BOOLLIST
#undef TEST_STD_UNORDERED_SET
template
void printInfo(const std::unordered_set>& ht)
{
Info<<"std::unordered_set elements:"
<< ht.size()
<< " buckets:" << ht.bucket_count()
<< " load_factor: " << ht.load_factor()
<< nl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
const label n = 1000000;
const label nIters = 1000;
unsigned long sum = 0;
bitSet packed(n, true);
boolList unpacked(n, true);
#ifdef TEST_STD_BOOLLIST
std::vector stdBoolList(n, true);
#endif
cpuTime timer;
labelHashSet emptyHash;
labelHashSet fullHash(1024);
for (label i = 0; i < n; i++)
{
fullHash.insert(i);
}
Info<< "populated labelHashSet in "
<< timer.cpuTimeIncrement() << " s\n\n";
#ifdef TEST_STD_UNORDERED_SET
std::unordered_set