Skip to content
Snippets Groups Projects
Commit 799490a3 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

ENH: add edgeHashes.H with some useful hash types for edges.

parent 357c2c34
Branches
Tags
No related merge requests found
......@@ -25,7 +25,9 @@ Class
Foam::EdgeMap
Description
Map from edge (expressed as its endpoints) to value
Map from edge (expressed as its endpoints) to value.
For easier forward declaration it is currently implemented as a
separate class rather than a template alias.
\*---------------------------------------------------------------------------*/
......@@ -49,28 +51,11 @@ class EdgeMap
:
public HashTable<T, edge, Hash<edge>>
{
public:
// Constructors
//- Construct given initial map size
EdgeMap(const label size = 128)
:
HashTable<T, edge, Hash<edge>>(size)
{}
//- Construct from Istream
EdgeMap(Istream& is)
:
HashTable<T, edge, Hash<edge>>(is)
{}
//- Construct as copy
EdgeMap(const EdgeMap<T>& map)
:
HashTable<T, edge, Hash<edge>>(map)
{}
//- Inherit constructors from HashTable
using HashTable<T, edge, Hash<edge>>::HashTable;
};
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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 3 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, see <http://www.gnu.org/licenses/>.
Typedef
Foam::edgeHashSet
Description
A HashSet for an edge.
The hashing on an edge is commutative.
\*---------------------------------------------------------------------------*/
#ifndef edgeHashes_H
#define edgeHashes_H
#include "HashSet.H"
#include "edge.H"
#include "EdgeMap.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Alternative:
// template<class T>
// using EdgeMap = HashTable<T, edge, Hash<edge>>;
//- A HashSet with edge for its key.
typedef HashSet<edge, Hash<edge>> edgeHashSet;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment