dune-grid 2.8.0
Loading...
Searching...
No Matches
entitykey.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_DGFEnTITYKEY_HH
4#define DUNE_DGFEnTITYKEY_HH
5
6#include <iostream>
7#include <vector>
8
10
11namespace Dune
12{
13
14 // DGFEntityKey
15 // ------------
16
17 template< class A >
19 {
20 DGFEntityKey ( const std :: vector< A > &key, bool setOrigKey = true );
21 DGFEntityKey ( const std::vector< A > &key,
22 int N, int offset, bool setOrigKey = true );
24
26
27 inline const A &operator[] ( int i ) const;
28 inline bool operator < ( const DGFEntityKey< A > &k ) const;
29
30 void orientation ( int base, std :: vector< std :: vector< double > > &vtx );
31 void print( std :: ostream &out = std :: cerr ) const;
32
33 inline bool origKeySet () const;
34 inline const A &origKey ( int i ) const;
35 inline int size () const;
36
37 private:
38 std :: vector< A > key_, origKey_;
39 bool origKeySet_;
40 };
41
42
43 template< class A >
44 inline const A &DGFEntityKey< A > :: operator[] ( int i ) const
45 {
46 return key_[ i ];
47 }
48
49
50 template< class A >
52 {
53 // assert(k.key_.size()==key_.size());
54 return key_ < k.key_;
55 }
56
57
58 template< class A >
60 {
61 return origKeySet_;
62 }
63
64
65 template< class A >
66 inline const A &DGFEntityKey< A > :: origKey ( int i ) const
67 {
68 return origKey_[ i ];
69 }
70
71
72 template< class A >
73 inline int DGFEntityKey< A > :: size () const
74 {
75 return key_.size();
76 }
77
78
79
80 // ElementFaceUtil
81 // ---------------
82
84 {
85 inline static int nofFaces ( int dim, const std::vector< unsigned int > &element );
86 inline static int faceSize ( int dim, bool simpl );
87
89 generateFace ( int dim, const std::vector< unsigned int > &element, int f );
90
91 private:
92 template< int dim >
94 generateCubeFace( const std::vector< unsigned int > &element, int f );
95
96 template< int dim >
98 generateSimplexFace ( const std::vector< unsigned int > &element, int f );
99 };
100
101
102 inline int ElementFaceUtil::nofFaces ( int dim, const std::vector< unsigned int > &element )
103 {
104 switch( dim )
105 {
106 case 1 :
107 return 2;
108 case 2 :
109 switch( element.size() )
110 {
111 case 3 :
112 return 3;
113 case 4 :
114 return 4;
115 default :
116 return -1;
117 }
118 case 3 :
119 switch( element.size() )
120 {
121 case 4 :
122 return 4;
123 case 8 :
124 return 6;
125 default :
126 return -1;
127 }
128 default :
129 return -1;
130 }
131 }
132
133
134 inline int ElementFaceUtil::faceSize( int dim, bool simpl )
135 {
136 switch( dim )
137 {
138 case 1 :
139 return 1;
140 case 2 :
141 return 2;
142 case 3 :
143 return (simpl ? 3 : 4);
144 default :
145 return -1;
146 }
147 }
148
149} //end namespace Dune
150
151// inlcude inline implementation
152#include "entitykey_inline.hh"
153#endif
Include standard header files.
Definition: agrid.hh:58
Definition: entitykey.hh:19
bool operator<(const DGFEntityKey< A > &k) const
Definition: entitykey.hh:51
DGFEntityKey< A > & operator=(const DGFEntityKey< A > &k)
Definition: entitykey_inline.hh:62
bool origKeySet() const
Definition: entitykey.hh:59
int size() const
Definition: entitykey.hh:73
void orientation(int base, std ::vector< std ::vector< double > > &vtx)
Definition: entitykey_inline.hh:76
const A & origKey(int i) const
Definition: entitykey.hh:66
DGFEntityKey(const std::vector< A > &key, int N, int offset, bool setOrigKey=true)
void print(std ::ostream &out=std ::cerr) const
Definition: entitykey_inline.hh:103
const A & operator[](int i) const
Definition: entitykey.hh:44
Definition: entitykey.hh:84
static DGFEntityKey< unsigned int > generateFace(int dim, const std::vector< unsigned int > &element, int f)
Definition: entitykey_inline.hh:143
static int faceSize(int dim, bool simpl)
Definition: entitykey.hh:134
static int nofFaces(int dim, const std::vector< unsigned int > &element)
Definition: entitykey.hh:102