mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add edgeHashes.H with some useful hash types for edges.
This commit is contained in:
@ -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
|
||||
//- Inherit constructors from HashTable
|
||||
using HashTable<T, edge, Hash<edge>>::HashTable;
|
||||
|
||||
//- 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)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
|
||||
57
src/OpenFOAM/meshes/meshShapes/edge/edgeHashes.H
Normal file
57
src/OpenFOAM/meshes/meshShapes/edge/edgeHashes.H
Normal file
@ -0,0 +1,57 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user