added edge/triFace to the hashing tests

This commit is contained in:
Mark Olesen
2009-03-05 12:39:22 +01:00
parent 7544164d53
commit 9ce984d1dc
3 changed files with 71 additions and 7 deletions

View File

@ -36,5 +36,24 @@ labelListList
(0 1 100 1000)
)
// edges are hashed commutatively
edgeList
(
(0 1)
(1 0)
(45 100)
(100 45)
(128 1000)
(1000 128)
)
// triFaces are also hashed commutatively (via multiply/add)
triFaceList
(
(10 20 30)
(30 20 10)
(20 10 30)
)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -36,6 +36,8 @@ Description
#include "stringList.H"
#include "labelList.H"
#include "labelPair.H"
#include "edgeList.H"
#include "triFaceList.H"
#include "Hash.H"
@ -117,6 +119,44 @@ int main(int argc, char *argv[])
}
}
else if (listType == "edgeList")
{
Info<<"contiguous = " << contiguous<edge>() << endl << endl;
edgeList lst(is);
forAll(lst, i)
{
unsigned hash1 = Hash<edge>()(lst[i]);
// as FixedList
unsigned hash2 = labelPair::Hash<>()(lst[i]);
Info<< hex << hash1 << " (as FixedList: " << hash2
<< "): " << dec << lst[i] << endl;
}
}
else if (listType == "triFaceList")
{
Info<<"contiguous = " << contiguous<triFace>() << endl << endl;
triFaceList lst(is);
forAll(lst, i)
{
// direct value
unsigned hash1 = Hash<triFace>()(lst[i]);
unsigned hash2 = FixedList<label, 3>::Hash<>()(lst[i]);
Info<< hex << hash1 << " (as FixedList: " << hash2
<< "): " << dec << lst[i] << endl;
}
}
else
{
Info<< "unknown type: " << listType << endl;
}
}
return 0;