57
57
const size_type* mesh_n_geo,
58
58
const size_type* mesh_n_element,
59
59
const geo_element& K,
60
size_type i_dof_local) const
60
size_type loc_idof) const
62
62
// all vertices-based dof are numbered first
63
63
// then all edge-based dof
64
64
// and then all dof based on interior nodes (e.g. quadrangles)
66
66
// for mixed triangle-quadrangle mesh : assume triangle are numbered first
67
switch (K.variant()) {
68
68
case reference_element::p:
70
70
case reference_element::e:
71
if (i_dof_local < 2) {
72
return K [i_dof_local];
74
74
return mesh_n_geo[0] + K.index();
76
case reference_element::t:
77
if (i_dof_local < 3) {
78
return K [i_dof_local];
80
return mesh_n_geo[0] + K.edge(i_dof_local - 3);
82
case reference_element::q:
83
if (i_dof_local < 4) {
84
return K [i_dof_local];
85
} else if (i_dof_local < 8) {
86
return mesh_n_geo[0] + K.edge(i_dof_local - 4);
88
return mesh_n_geo[0] + mesh_n_geo[1]
89
+ K.index() - mesh_n_element[reference_element::t];
76
case reference_element::t: {
80
size_type nv = mesh_n_geo[0];
81
size_type loc_iedg = loc_idof - 3;
82
size_type iedg = K.edge(loc_iedg);
85
case reference_element::q: {
90
return mesh_n_geo[0] + K.edge(loc_idof - 4);
92
size_type iqua = K.index() - mesh_n_element[reference_element::t];
93
return mesh_n_geo[0] + mesh_n_geo[1] + iqua;
91
95
case reference_element::T:
92
if (i_dof_local < 4) {
93
return K [i_dof_local];
95
return mesh_n_geo[0] + K.edge(i_dof_local - 4);
97
case reference_element::P:
98
case reference_element::H:
99
return mesh_n_geo[0] + K.edge(loc_idof - 4);
101
case reference_element::P: {
102
if (loc_idof < 6) { // 6 vertex dofs
105
size_type nv = mesh_n_geo[0];
106
if (loc_idof < 6+9) { // 9 edge face dofs
107
return nv + K.edge(loc_idof - 6);
110
size_type nedg = mesh_n_geo[1];
111
size_type ntri = mesh_n_element[reference_element::t];
112
size_type iqua = K.face(loc_idof - 6 - 9) - ntri;
113
return nv + nedg + iqua;
115
case reference_element::H: {
116
if (loc_idof < 8) { // 8 vertex dofs
119
size_type nv = mesh_n_geo[0];
120
if (loc_idof < 8+12) { // 12 edge face dofs
121
return nv + K.edge(loc_idof - 8);
123
size_type nedg = mesh_n_geo[1];
124
size_type ntri = mesh_n_element[reference_element::t];
125
if (loc_idof < 8+12+6) { // 6 face dofs
126
size_type iqua = K.face(loc_idof - 8 - 12) - ntri;
127
return nv + nedg + iqua;
129
// else: 1 volume dof
130
assert_macro (loc_idof < 27, "invalid loc_idof="<<loc_idof);
131
size_type nqua = mesh_n_element[reference_element::q];
132
size_type ntet = mesh_n_element[reference_element::T];
133
size_type npri = mesh_n_element[reference_element::P];
134
size_type ihex = K.index() - ntet - npri;
135
return nv + nedg + nqua + ihex;
100
138
error_macro ("unsupported P2 element on `" << K.name() << "'");
106
144
const size_type* mesh_n_geo,
107
145
const size_type* mesh_n_element,
108
146
const geo_element& K,
109
vector<size_type>& i_dof) const
147
vector<size_type>& idof) const
111
for (size_type i_dof_local = 0; i_dof_local < K.size(); i_dof_local++)
113
= numbering_P2::idof (mesh_n_geo, mesh_n_element, K, i_dof_local);
149
for (size_type loc_idof = 0; loc_idof < K.size(); loc_idof++)
151
= numbering_P2::idof (mesh_n_geo, mesh_n_element, K, loc_idof);
115
153
numbering_P2::size_type
116
154
numbering_P2::ndof (
129
167
return mesh_n_geo[0]
131
169
+ mesh_n_element[reference_element::q];
171
// number of vertices + nb of edges in the mesh
172
// + number of quadrangle (extra interior node)
173
// + number of hexaedra (extra interior node)
133
174
return mesh_n_geo[0]
135
+ mesh_n_element[reference_element::P]
176
+ mesh_n_element[reference_element::q]
136
177
+ mesh_n_element[reference_element::H];
138
180
fatal_macro ("unsupported P2 approximation in `" << mesh_map_dimension << "'");