From 55a89e9db3d78dca419db5f10256b60a1306d076 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 30 Oct 2009 18:31:28 +0100 Subject: [PATCH] added HashTbl as development replacement for HashTable - rename to HashTable later when it is considered stable --- applications/test/HashTable3/Make/files | 3 + applications/test/HashTable3/Make/options | 2 + applications/test/HashTable3/hashTableTest3.C | 83 +++ src/OpenFOAM/Make/files | 1 + .../containers/HashTables/HashTbl/HashTbl.C | 665 ++++++++++++++++++ .../containers/HashTables/HashTbl/HashTbl.H | 466 ++++++++++++ .../containers/HashTables/HashTbl/HashTblI.H | 548 +++++++++++++++ .../containers/HashTables/HashTbl/HashTblIO.C | 246 +++++++ .../HashTables/HashTbl/HashTblName.C | 33 + 9 files changed, 2047 insertions(+) create mode 100644 applications/test/HashTable3/Make/files create mode 100644 applications/test/HashTable3/Make/options create mode 100644 applications/test/HashTable3/hashTableTest3.C create mode 100644 src/OpenFOAM/containers/HashTables/HashTbl/HashTbl.C create mode 100644 src/OpenFOAM/containers/HashTables/HashTbl/HashTbl.H create mode 100644 src/OpenFOAM/containers/HashTables/HashTbl/HashTblI.H create mode 100644 src/OpenFOAM/containers/HashTables/HashTbl/HashTblIO.C create mode 100644 src/OpenFOAM/containers/HashTables/HashTbl/HashTblName.C diff --git a/applications/test/HashTable3/Make/files b/applications/test/HashTable3/Make/files new file mode 100644 index 0000000000..e8ec193ffa --- /dev/null +++ b/applications/test/HashTable3/Make/files @@ -0,0 +1,3 @@ +hashTableTest3.C + +EXE = $(FOAM_USER_APPBIN)/hashTableTest3 diff --git a/applications/test/HashTable3/Make/options b/applications/test/HashTable3/Make/options new file mode 100644 index 0000000000..6a9e9810b3 --- /dev/null +++ b/applications/test/HashTable3/Make/options @@ -0,0 +1,2 @@ +/* EXE_INC = -I$(LIB_SRC)/cfdTools/include */ +/* EXE_LIBS = -lfiniteVolume */ diff --git a/applications/test/HashTable3/hashTableTest3.C b/applications/test/HashTable3/hashTableTest3.C new file mode 100644 index 0000000000..422e35696c --- /dev/null +++ b/applications/test/HashTable3/hashTableTest3.C @@ -0,0 +1,83 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + + Test speeds for some HashTable operations + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "HashTable.H" +#include "HashPtrTable.H" +#include "Map.H" +#include "StaticHashTable.H" +#include "HashTbl.H" +#include "cpuTime.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + const label nLoops = 30; + const label nBase = 100000; + const label nSize = nLoops * nBase; + + cpuTime timer; + + // ie, a + // Map