31 #include "rheolef/point.h"
39 static const size_t max_size_t = size_t(-1);
40 static const size_t max_variant = 7;
41 static const char* table_name [max_variant] = {
"p",
"e",
"t",
"q",
"T",
"P",
"H" };
47 static const size_t max_face = 8;
48 static const size_t max_face_vertex = 4;
70 size_t ne,
const size_t e[][2],
Float meas) {
73 template <
size_t NEdgePerFaceMax>
75 size_t nfac,
const size_t f[][NEdgePerFaceMax],
76 size_t nedg,
const size_t e[][2],
82 for (
size_t ifac = 0; ifac < nfac; ifac++) {
84 while (nv_on_fac < NEdgePerFaceMax &&
f[ifac][nv_on_fac] !=
size_t(-1)) {
89 for (
size_t iv = 0; iv < nv_on_fac; iv++) {
90 size_t iv2 = (iv+1) % nv_on_fac;
92 for (
size_t iedg = 0; iedg < nedg; iedg++) {
93 if (
f[ifac][iv] == e[iedg][0] &&
f[ifac][iv2] == e[iedg][1]) {
97 }
else if (
f[ifac][iv] == e[iedg][1] &&
f[ifac][iv2] == e[iedg][0]) {
138 cout <<
"// file automaticaly generated by \"cxx_reference_element.cc\"" << endl
141 <<
"/// This file is part of Rheolef." << endl
143 <<
"/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>" << endl
145 <<
"/// Rheolef is free software; you can redistribute it and/or modify" << endl
146 <<
"/// it under the terms of the GNU General Public License as published by" << endl
147 <<
"/// the Free Software Foundation; either version 2 of the License, or" << endl
148 <<
"/// (at your option) any later version." << endl
150 <<
"/// Rheolef is distributed in the hope that it will be useful," << endl
151 <<
"/// but WITHOUT ANY WARRANTY; without even the implied warranty of" << endl
152 <<
"/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" << endl
153 <<
"/// GNU General Public License for more details." << endl
155 <<
"/// You should have received a copy of the GNU General Public License" << endl
156 <<
"/// along with Rheolef; if not, write to the Free Software" << endl
157 <<
"/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA" << endl
159 <<
"/// =========================================================================" << endl
160 <<
"// file automaticaly generated by \"cxx_reference_element.cc\"" << endl
166 cout <<
"static const variant_type" << endl;
167 for (
size_t i = 0; i < max_variant; i++) {
168 cout <<
"\t" << table_name[i] <<
" = " << i <<
"," << endl;
170 cout <<
"\tmax_variant = " << max_variant <<
";" << endl;
176 cout <<
"const char" << endl
177 <<
"reference_element::_name [reference_element::max_variant] = {" << endl
179 for (
size_t E = 0; E < max_variant; E++) {
180 cout <<
"\t'" << table_name[E] <<
"'";
181 if (E+1 != max_variant) cout <<
",";
184 cout <<
"};" << endl;
187 cout <<
"const reference_element::size_type" << endl
188 <<
"reference_element::_dimension [reference_element::max_variant] = {" << endl
190 for (
size_t E = 0; E < max_variant; E++) {
192 if (E+1 != max_variant) cout <<
",";
195 cout <<
"};" << endl;
198 cout <<
"const reference_element::size_type" << endl
199 <<
"reference_element::_first_variant_by_dimension [5] = {" << endl
201 for (
size_t E = 0, prev_dim =
size_t(-1); E < max_variant; E++) {
204 cout <<
"\treference_element::" << table_name[E] <<
"," << endl;
206 cout <<
"\treference_element::max_variant" << endl
210 cout <<
"const reference_element::size_type" << endl
211 <<
"reference_element::_n_vertex [reference_element::max_variant] = {" << endl
213 for (
size_t E = 0; E < max_variant; E++) {
215 if (E+1 != max_variant) cout <<
",";
218 cout <<
"};" << endl;
221 cout <<
"const reference_element::size_type" << endl
222 <<
"reference_element::_n_subgeo_by_variant [reference_element::max_variant] [reference_element::max_variant] = {" << endl
224 for (
size_t E = 0; E < max_variant; E++) {
225 cout <<
" " << table_name[E];
228 for (
size_t E = 0; E < max_variant; E++) {
230 for (
size_t F = 0; F < max_variant; F++) {
245 for (
size_t ifac = 0; ifac <
table_n_face [E]; ++ifac) {
253 if (F+1 != max_variant) cout <<
",";
256 { 1, 0, 0, 0, 0, 0, 0},
257 { 2, 1, 0, 0, 0, 0, 0},
258 { 3, 3, 1, 0, 0, 0, 0},
259 { 4, 4, 0, 1, 0, 0, 0},
260 { 4, 6, 4, 0, 1, 0, 0},
261 { 6, 9, 2, 3, 0, 1, 0},
262 { 8,12, 0, 6, 0, 0, 1}
264 cout <<
"}" << ((E+1 != max_variant) ?
"," :
" ") <<
" // " << table_name[E] << endl;
266 cout <<
"};" << endl;
268 cout <<
"static const Float" << endl
269 <<
"hat_K_measure [reference_element::max_variant] = {" << endl
270 << setprecision(std::numeric_limits<Float>::digits10)
272 for (
size_t E = 0; E < max_variant; E++) {
274 if (E+1 != max_variant) cout <<
",";
277 cout <<
"};" << endl;
280 for (
size_t E = 0; E < max_variant; E++) {
283 cout <<
"const reference_element::size_type" << endl
284 <<
"geo_element_" << table_name[E] <<
"_fac2edg_idx ["
287 for (
size_t ifac = 0; ifac < nfac; ifac++) {
290 for (
size_t iedg = 0; iedg < nedg; iedg++) {
292 if (iedg+1 == nedg) cout <<
"}";
else cout <<
",";
294 if (ifac+1 == nfac) cout <<
" };";
else cout <<
",";
301 for (
size_t E = 0; E < max_variant; E++) {
304 cout <<
"const int" << endl
305 <<
"geo_element_" << table_name[E] <<
"_fac2edg_orient ["
308 for (
size_t ifac = 0; ifac < nfac; ifac++) {
311 for (
size_t iedg = 0; iedg < nedg; iedg++) {
313 if (iedg+1 == nedg) cout <<
"}";
else cout <<
",";
315 if (ifac+1 == nfac) cout <<
" };";
else cout <<
",";
322 int main(
int argc,
char**argv) {
332 if (argc > 1 && argv[1] ==
string(
"-h")) {