mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
added edge/triFace to the hashing tests
This commit is contained in:
@ -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)
|
||||
)
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user