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