Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
cf7762c2
Commit
cf7762c2
authored
Nov 19, 2008
by
Mark Olesen
Browse files
Merge commit 'bundle/home' into olesenm
parents
4645e93f
c9373ba1
Changes
59
Hide whitespace changes
Inline
Side-by-side
applications/test/HashSet/hashSetTest.C
View file @
cf7762c2
...
...
@@ -26,7 +26,7 @@ Description
\*---------------------------------------------------------------------------*/
#include
"
label
HashSet.H"
#include
"HashSet.H"
using
namespace
Foam
;
...
...
@@ -35,19 +35,45 @@ using namespace Foam;
int
main
(
int
argc
,
char
*
argv
[])
{
HashSet
<
Foam
::
string
>
testS
et
(
0
);
HashSet
<
string
>
s
et
A
(
0
);
testS
et
.
insert
(
"kjhk"
);
testS
et
.
insert
(
"kjhk2"
);
s
et
A
.
insert
(
"kjhk"
);
s
et
A
.
insert
(
"kjhk2"
);
Info
<<
testS
et
<<
endl
;
Info
<<
s
et
A
<<
endl
;
labelHashSet
testLabelHashSet
(
1
);
labelHashSet
setB
(
1
);
setB
.
insert
(
11
);
setB
.
insert
(
42
);
testLabelHashSet
.
insert
(
11
);
testLabelHashSet
.
insert
(
42
);
Info
<<
"setB : "
<<
setB
<<
endl
;
Info
<<
testLabelHashSet
<<
endl
;
labelHashSet
setC
(
1
);
setC
.
insert
(
2008
);
setC
.
insert
(
1984
);
Info
<<
"setC : "
<<
setC
<<
endl
;
labelHashSet
setD
(
1
);
setD
.
insert
(
11
);
setD
.
insert
(
100
);
setD
.
insert
(
2008
);
Info
<<
"setD : "
<<
setD
<<
endl
;
Info
<<
"setB == setC: "
<<
(
setB
==
setC
)
<<
endl
;
Info
<<
"setC != setD: "
<<
(
setC
!=
setD
)
<<
endl
;
// test operations
setB
+=
setC
;
Info
<<
"setB += setC : "
<<
setB
<<
endl
;
setB
&=
setD
;
Info
<<
"setB &= setD : "
<<
setB
<<
endl
;
setB
+=
setC
;
setB
-=
setD
;
Info
<<
"setB += setC -= setD : "
<<
setB
<<
endl
;
return
0
;
}
...
...
applications/utilities/mesh/manipulation/splitMesh/regionSide.H
View file @
cf7762c2
...
...
@@ -45,7 +45,7 @@ SourceFiles
#ifndef regionSide_H
#define regionSide_H
#include
"
label
HashSet.H"
#include
"HashSet.H"
#include
"typeInfo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
src/OpenFOAM/containers/HashTables/HashSet/HashSet.C
View file @
cf7762c2
...
...
@@ -29,62 +29,81 @@ License
#include
"HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template
<
class
Key
,
class
Hash
>
bool
HashSet
<
Key
,
Hash
>::
operator
==
(
const
HashSet
<
Key
,
Hash
>&
ht
)
const
bool
Foam
::
HashSet
<
Key
,
Hash
>::
operator
==
(
const
HashSet
<
Key
,
Hash
>&
rhs
)
const
{
const
HashTable
<
empty
,
Key
,
Hash
>&
a
=
*
this
;
// Are all my elements in ht?
for
(
typename
HashTable
<
empty
,
Key
,
Hash
>::
const_iterator
iter
=
a
.
begin
();
iter
!=
a
.
end
();
++
iter
)
// Are all lhs elements in rhs?
for
(
const_iterator
iter
=
this
->
begin
();
iter
!=
this
->
end
();
++
iter
)
{
if
(
!
ht
.
found
(
iter
.
key
()))
if
(
!
rhs
.
found
(
iter
.
key
()))
{
return
false
;
}
}
// Are all ht elements in me?
for
(
typename
HashTable
<
empty
,
Key
,
Hash
>::
const_iterator
iter
=
ht
.
begin
();
iter
!=
ht
.
end
();
++
iter
)
// Are all rhs elements in lhs?
for
(
const_iterator
iter
=
rhs
.
begin
();
iter
!=
rhs
.
end
();
++
iter
)
{
if
(
!
found
(
iter
.
key
()))
{
return
false
;
}
}
return
true
;
}
template
<
class
Key
,
class
Hash
>
bool
HashSet
<
Key
,
Hash
>::
operator
!=
(
const
HashSet
<
Key
,
Hash
>&
ht
)
const
bool
Foam
::
HashSet
<
Key
,
Hash
>::
operator
!=
(
const
HashSet
<
Key
,
Hash
>&
rhs
)
const
{
return
!
(
operator
==
(
ht
));
return
!
(
operator
==
(
rhs
));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template
<
class
Key
,
class
Hash
>
void
Foam
::
HashSet
<
Key
,
Hash
>::
operator
+=
(
const
HashSet
<
Key
,
Hash
>&
rhs
)
{
// Add in rhs elements into lhs
for
(
const_iterator
iter
=
rhs
.
begin
();
iter
!=
rhs
.
end
();
++
iter
)
{
insert
(
iter
.
key
());
}
}
template
<
class
Key
,
class
Hash
>
void
Foam
::
HashSet
<
Key
,
Hash
>::
operator
-=
(
const
HashSet
<
Key
,
Hash
>&
rhs
)
{
// Remove rhs elements from lhs
for
(
const_iterator
iter
=
rhs
.
begin
();
iter
!=
rhs
.
end
();
++
iter
)
{
erase
(
iter
.
key
());
}
}
template
<
class
Key
,
class
Hash
>
void
Foam
::
HashSet
<
Key
,
Hash
>::
operator
&=
(
const
HashSet
<
Key
,
Hash
>&
rhs
)
{
// Remove elements not found in rhs as well
for
(
iterator
iter
=
this
->
begin
();
iter
!=
this
->
end
();
++
iter
)
{
if
(
!
rhs
.
found
(
iter
.
key
()))
{
erase
(
iter
);
}
}
}
}
// End namespace Foam
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
src/OpenFOAM/containers/HashTables/HashSet/HashSet.H
View file @
cf7762c2
...
...
@@ -26,7 +26,7 @@ Class
Foam::HashSet
Description
A HashTable with
word
keys but without contents.
A HashTable with keys but without contents.
Typedef
Foam::wordHashSet
...
...
@@ -34,6 +34,12 @@ Typedef
Description
A HashSet with (the default) word keys.
Typedef
Foam::labelHashSet
Description
A HashSet with label keys.
\*---------------------------------------------------------------------------*/
#ifndef HashSet_H
...
...
@@ -48,7 +54,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class HashSet Declaration
Class HashSet Declaration
\*---------------------------------------------------------------------------*/
template
<
class
Key
=
word
,
class
Hash
=
string
::
hash
>
...
...
@@ -59,9 +65,13 @@ class HashSet
public:
typedef
typename
HashTable
<
empty
,
Key
,
Hash
>::
iterator
iterator
;
typedef
typename
HashTable
<
empty
,
Key
,
Hash
>::
const_iterator
const_iterator
;
// Constructors
//- Construct given initial
map
size
//- Construct given initial size
HashSet
(
label
size
=
100
)
:
HashTable
<
empty
,
Key
,
Hash
>
(
size
)
...
...
@@ -74,13 +84,13 @@ public:
{}
//- Construct from UList of Key
HashSet
(
const
UList
<
Key
>&
u
l
)
HashSet
(
const
UList
<
Key
>&
l
st
)
:
HashTable
<
empty
,
Key
,
Hash
>
(
2
*
u
l
.
size
())
HashTable
<
empty
,
Key
,
Hash
>
(
2
*
l
st
.
size
())
{
forAll
(
ul
,
i
)
forAll
(
lst
,
i
)
{
insert
(
u
l
[
i
]);
insert
(
l
st
[
i
]);
}
}
...
...
@@ -90,32 +100,58 @@ public:
HashTable
<
empty
,
Key
,
Hash
>
(
hs
)
{}
//- Construct by transferring the parameter contents
HashSet
(
const
xfer
<
HashSet
<
Key
,
Hash
>
>&
hs
)
:
HashTable
<
empty
,
Key
,
Hash
>
(
hs
)
{}
// Member Functions
// Edit
//- Insert a new
hashedE
ntry
//- Insert a new
e
ntry
bool
insert
(
const
Key
&
key
)
{
return
HashTable
<
empty
,
Key
,
Hash
>::
insert
(
key
,
empty
());
}
//- Same as insert (cannot overwrite empty content)
bool
set
(
const
Key
&
key
)
{
return
HashTable
<
empty
,
Key
,
Hash
>::
insert
(
key
,
empty
());
}
// Member Operators
//- Equality. Two hashtables are equal if all contents of first are
// also in second and vice versa. So does not depend on table size or
// order!
//- Equality. Two hashtables are equal when their contents are equal.
// Independent of table size or order.
bool
operator
==
(
const
HashSet
<
Key
,
Hash
>&
)
const
;
//- The opposite of the equality operation.
bool
operator
!=
(
const
HashSet
<
Key
,
Hash
>&
)
const
;
//- Add entries listed in the given HashSet to this HashSet
void
operator
+=
(
const
HashSet
<
Key
,
Hash
>&
);
//- Remove entries listed in the given HashSet from this HashSet
void
operator
-=
(
const
HashSet
<
Key
,
Hash
>&
);
//- Only retain entries found in both HashSets
void
operator
&=
(
const
HashSet
<
Key
,
Hash
>&
);
};
//- A HashSet with word keys.
typedef
HashSet
<>
wordHashSet
;
//- A HashSet with label keys.
typedef
HashSet
<
label
,
Hash
<
label
>
>
labelHashSet
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
src/OpenFOAM/containers/HashTables/Map/Map.H
View file @
cf7762c2
...
...
@@ -54,9 +54,15 @@ class Map
{
public:
typedef
typename
HashTable
<
T
,
label
,
Hash
<
label
>
>::
iterator
iterator
;
typedef
typename
HashTable
<
T
,
label
,
Hash
<
label
>
>::
const_iterator
const_iterator
;
// Constructors
//- Construct given initial
map
size
//- Construct given initial size
Map
(
label
size
=
100
)
:
HashTable
<
T
,
label
,
Hash
<
label
>
>
(
size
)
...
...
@@ -74,6 +80,12 @@ public:
HashTable
<
T
,
label
,
Hash
<
label
>
>
(
map
)
{}
//- Construct by transferring the parameter contents
Map
(
const
xfer
<
Map
<
T
>
>&
map
)
:
HashTable
<
T
,
label
,
Hash
<
label
>
>
(
map
)
{}
//- Return a null Map
static
const
Map
<
T
>&
null
()
...
...
src/OpenFOAM/containers/HashTables/labelHashSet/labelHashSet.H
deleted
100644 → 0
View file @
4645e93f
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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
Typedef
Foam::labelHashSet
Description
A HashSet with label keys.
See Also
wordHashSet
\*---------------------------------------------------------------------------*/
#ifndef labelHashSet_H
#define labelHashSet_H
#include
"HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
typedef
HashSet
<
label
,
Hash
<
label
>
>
labelHashSet
;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
src/OpenFOAM/meshes/polyMesh/mapPolyMesh/faceMapper/faceMapper.H
View file @
cf7762c2
...
...
@@ -39,7 +39,7 @@ SourceFiles
#define faceMapper_H
#include
"morphFieldMapper.H"
#include
"
label
HashSet.H"
#include
"HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.H
View file @
cf7762c2
...
...
@@ -143,7 +143,7 @@ SourceFiles
#include
"labelList.H"
#include
"objectMap.H"
#include
"pointField.H"
#include
"
label
HashSet.H"
#include
"HashSet.H"
#include
"Map.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H
View file @
cf7762c2
...
...
@@ -39,7 +39,7 @@ SourceFiles
#include
"List.H"
#include
"IndirectList.H"
#include
"regIOobject.H"
#include
"
label
HashSet.H"
#include
"HashSet.H"
#include
"pointFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H
View file @
cf7762c2
...
...
@@ -57,7 +57,7 @@ SourceFiles
#include
"edgeList.H"
#include
"point.H"
#include
"intersection.H"
#include
"
label
HashSet.H"
#include
"HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchBdryPoints.C
View file @
cf7762c2
...
...
@@ -27,7 +27,7 @@ Description
\*---------------------------------------------------------------------------*/
#include
"PrimitivePatch.H"
#include
"
label
HashSet.H"
#include
"HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H
View file @
cf7762c2
...
...
@@ -64,7 +64,7 @@ SourceFiles
#include
"cellShapeList.H"
#include
"labelList.H"
#include
"boolList.H"
#include
"
label
HashSet.H"
#include
"HashSet.H"
#include
"Map.H"
#include
"EdgeMap.H"
...
...
src/dynamicMesh/meshCut/cellLooper/geomCellLooper.C
View file @
cf7762c2
...
...
@@ -31,7 +31,7 @@ License
#include
"meshTools.H"
#include
"SortableList.H"
#include
"triSurfaceTools.H"
#include
"
label
HashSet.H"
#include
"HashSet.H"
#include
"ListOps.H"
#include
"transform.H"
...
...
src/dynamicMesh/motionSmoother/motionSmoother.H
View file @
cf7762c2
...
...
@@ -75,7 +75,7 @@ SourceFiles
#define motionSmoother_H
#include
"pointFields.H"
#include
"
label
HashSet.H"
#include
"HashSet.H"
#include
"PackedList.H"
#include
"indirectPrimitivePatch.H"
#include
"className.H"
...
...
src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.H
View file @
cf7762c2
...
...
@@ -40,7 +40,7 @@ SourceFiles
#define polyMeshGeometry_H
#include
"pointFields.H"
#include
"
label
HashSet.H"
#include
"HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
src/dynamicMesh/polyTopoChange/polyTopoChange/faceCollapser.H
View file @
cf7762c2
...
...
@@ -56,7 +56,7 @@ SourceFiles
#include
"labelList.H"
#include
"point.H"
#include
"Map.H"
#include
"
label
HashSet.H"
#include
"HashSet.H"
#include
"typeInfo.H"
#include
"edgeList.H"
...
...
src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.H
View file @
cf7762c2
...
...
@@ -38,7 +38,7 @@ SourceFiles
#include
"labelIOList.H"
#include
"face.H"
#include
"
label
HashSet.H"
#include
"HashSet.H"
#include
"DynamicList.H"
#include
"primitivePatch.H"
#include
"removeFaces.H"
...
...
src/dynamicMesh/polyTopoChange/polyTopoChange/localPointRegion.H
View file @
cf7762c2
...
...
@@ -46,7 +46,7 @@ SourceFiles
#include
"typeInfo.H"
#include
"Map.H"
#include
"labelList.H"
#include
"
label
HashSet.H"
#include
"HashSet.H"
#include
"faceList.H"
#include
"boolList.H"
...
...
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.H
View file @
cf7762c2
...
...
@@ -73,7 +73,7 @@ SourceFiles
#include
"PtrList.H"
#include
"cellList.H"
#include
"Map.H"
#include
"
label
HashSet.H"
#include
"HashSet.H"
#include
"mapPolyMesh.H"
#include
"CompactListList.H"
#include
"PackedList.H"
...
...
src/dynamicMesh/polyTopoChange/polyTopoChange/removeFaces.H
View file @
cf7762c2
...
...
@@ -40,7 +40,7 @@ SourceFiles
#define removeFaces_H
#include
"Pstream.H"
#include
"
label
HashSet.H"
#include
"HashSet.H"
#include
"Map.H"
#include
"boolList.H"
#include
"indirectPrimitivePatch.H"
...
...
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment