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)
|
(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 "stringList.H"
|
||||||
#include "labelList.H"
|
#include "labelList.H"
|
||||||
#include "labelPair.H"
|
#include "labelPair.H"
|
||||||
|
#include "edgeList.H"
|
||||||
|
#include "triFaceList.H"
|
||||||
|
|
||||||
#include "Hash.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;
|
return 0;
|
||||||
|
|||||||
@ -26,26 +26,31 @@ Typedef
|
|||||||
Foam::labelPairLookup
|
Foam::labelPairLookup
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Hash for two labels to other label. Used for e.g. for face1, face2 to
|
A HashTable for two labels to another label.
|
||||||
shared edge.
|
Used for e.g. for face1, face2 to shared edge.
|
||||||
|
|
||||||
Note: do NOT use edge! Our two faces are non commutative, first face is
|
Note
|
||||||
from surface1, second face is from surface2.
|
The hash table is based on a FixedList and not edge, since an edge
|
||||||
|
hashes commutatively!
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef labelPairLookup_H
|
#ifndef labelPairLookup_H
|
||||||
#define labelPairLookup_H
|
#define labelPairLookup_H
|
||||||
|
|
||||||
|
#include "FixedList.H"
|
||||||
#include "HashTable.H"
|
#include "HashTable.H"
|
||||||
#include "edge.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
typedef HashTable<label, FixedList<label, 2>, FixedList<label, 2>::Hash<> >
|
typedef HashTable
|
||||||
labelPairLookup;
|
<
|
||||||
|
label,
|
||||||
|
FixedList<label, 2>,
|
||||||
|
FixedList<label, 2>::Hash<>
|
||||||
|
> labelPairLookup;
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
Reference in New Issue
Block a user