DUNE-FEM (unstable)

pointmapper.hh
1#ifndef DUNE_FEM_POINTMAPPER_HH
2#define DUNE_FEM_POINTMAPPER_HH
3
4//- system includes
5#include <vector>
6
7//- Dune includes
9#include <dune/fem/quadrature/quadrature.hh>
10#include <dune/common/hash.hh>
11
12namespace Dune
13{
14
15 namespace Fem
16 {
17
18 struct QuadratureKey
19 {
20 QuadratureKey ( const GeometryType &geoType, const size_t id )
21 : id_( ((topologyId( geoType ) >> 1) << 16) + id )
22 {
23 assert( id < (1 << 16) );
24 }
25
26 bool operator< ( const QuadratureKey &other ) const
27 {
28 return (id_ < other.id_);
29 }
30
31 bool operator> ( const QuadratureKey &other ) const
32 {
33 return (id_ > other.id_);
34 }
35
36 bool operator== ( const QuadratureKey &other ) const
37 {
38 return (id_ == other.id_);
39 }
40
41 friend std::ostream &operator<< ( std::ostream &out, const QuadratureKey &key )
42 {
43 return out << "(topologyId " << ((key.id_ >> 16) << 1) << ", quadId " << (key.id_ & ((1u << 16)-1)) << ")";
44 }
45
46 inline friend std::size_t hash_value(const QuadratureKey& arg)
47 {
48 std::size_t seed = 0;
49 hash_combine(seed,arg.id_);
50 return seed;
51 }
52
53 protected:
54 static unsigned int topologyId ( const GeometryType &type )
55 {
56 return type.id();
57 }
58
59 const size_t id_;
60 };
61
62
63
64 template <class ct, int dim>
65 struct CachingTraits {
67 typedef IntegrationPointListImp<ct, dim> QuadratureType;
69 typedef typename QuadratureType::CoordinateType PointType;
70 typedef std::vector<PointType> PointVectorType;
71 typedef std::vector<size_t> MapperType;
72 typedef std::pair< MapperType, MapperType > MapperPairType;
73 typedef std::vector<MapperType> MapperVectorType;
74
75 typedef QuadratureKey QuadratureKeyType;
76
77 // minimal twist is -4 for hexahedrons
78 // so we add 4 to start from zero
79 enum { twistOffset_ = 4 };
80
81 };
82
83 } // namespace Fem
84
85} // namespace Dune
86
88
89#endif // #ifndef DUNE_FEM_POINTMAPPER_HH
FieldVector< FieldType, dim > CoordinateType
type of local coordinates
Definition: quadratureimp.hh:46
Various macros to work with Dune module version numbers.
EnableIfInterOperable< T1, T2, bool >::type operator<(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition: iteratorfacades.hh:638
EnableIfInterOperable< T1, T2, bool >::type operator>(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition: iteratorfacades.hh:684
EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for equality.
Definition: iteratorfacades.hh:238
Support for calculating hash values of objects.
#define DUNE_DEFINE_HASH(template_args, type)
Defines the required struct specialization to make type hashable via Dune::hash.
Definition: hash.hh:100
#define DUNE_HASH_TYPE(...)
Wrapper macro for the type to be hashed in DUNE_DEFINE_HASH.
Definition: hash.hh:117
#define DUNE_HASH_TEMPLATE_ARGS(...)
Wrapper macro for the template arguments in DUNE_DEFINE_HASH.
Definition: hash.hh:109
Dune namespace.
Definition: alignedallocator.hh:13
void hash_combine(std::size_t &seed, const T &arg)
Calculates the hash value of arg and combines it in-place with seed.
Definition: hash.hh:307
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 27, 22:29, 2024)