Flow123d  JS_before_hm-2-g912b55d
quad.h
Go to the documentation of this file.
1 /* Parallel Hierarchical Grid -- an adaptive finite element library.
2  *
3  * Copyright (C) 2005-2010 State Key Laboratory of Scientific and
4  * Engineering Computing, Chinese Academy of Sciences. */
5 
6 /* This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301 USA */
20 
21 /* $Id: quad.h,v 1.46 2011/04/15 08:10:07 zlb Exp $ */
22 
23 /*
24  * The parts of this file which are unnecessary for Flow123d have been commented out.
25  */
26 
27 #ifndef PHG_QUAD_H
28 
29 typedef struct QUAD_ {
30  const char *name; /* name of the quadrature formulae */
31  int dim; /* dimension, 1: edge, 2: face, 3: tetra */
32  int order; /* exact for polynomials of order 'order' */
33  int npoints; /* number of points */
34  FLOAT *points; /* barycentric coordinates of quad. points */
35  FLOAT *weights; /* weights */
36  SHORT id; /* id (for use with reference count) */
37 } QUAD;
38 
39 #define QUAD_DEFAULT -1
40 
41 /* 1D quadrature rules */
42 extern QUAD QUAD_1D_P1_;
43 #define QUAD_1D_P1 (&QUAD_1D_P1_)
44 extern QUAD QUAD_1D_P3_;
45 #define QUAD_1D_P2 (&QUAD_1D_P3_)
46 #define QUAD_1D_P3 (&QUAD_1D_P3_)
47 extern QUAD QUAD_1D_P5_;
48 #define QUAD_1D_P4 (&QUAD_1D_P5_)
49 #define QUAD_1D_P5 (&QUAD_1D_P5_)
50 extern QUAD QUAD_1D_P7_;
51 #define QUAD_1D_P6 (&QUAD_1D_P7_)
52 #define QUAD_1D_P7 (&QUAD_1D_P7_)
53 extern QUAD QUAD_1D_P9_;
54 #define QUAD_1D_P8 (&QUAD_1D_P9_)
55 #define QUAD_1D_P9 (&QUAD_1D_P9_)
56 extern QUAD QUAD_1D_P11_;
57 #define QUAD_1D_P10 (&QUAD_1D_P11_)
58 #define QUAD_1D_P11 (&QUAD_1D_P11_)
59 extern QUAD QUAD_1D_P13_;
60 #define QUAD_1D_P12 (&QUAD_1D_P13_)
61 #define QUAD_1D_P13 (&QUAD_1D_P13_)
62 extern QUAD QUAD_1D_P15_;
63 #define QUAD_1D_P14 (&QUAD_1D_P15_)
64 #define QUAD_1D_P15 (&QUAD_1D_P15_)
65 extern QUAD QUAD_1D_P17_;
66 #define QUAD_1D_P16 (&QUAD_1D_P17_)
67 #define QUAD_1D_P17 (&QUAD_1D_P17_)
68 extern QUAD QUAD_1D_P19_;
69 #define QUAD_1D_P18 (&QUAD_1D_P19_)
70 #define QUAD_1D_P19 (&QUAD_1D_P19_)
71 extern QUAD QUAD_1D_P21_;
72 #define QUAD_1D_P20 (&QUAD_1D_P21_)
73 #define QUAD_1D_P21 (&QUAD_1D_P21_)
74 
75 /* 2D quadrature rules */
76 extern QUAD QUAD_2D_P1_;
77 #define QUAD_2D_P1 (&QUAD_2D_P1_)
78 extern QUAD QUAD_2D_P2_;
79 #define QUAD_2D_P2 (&QUAD_2D_P2_)
80 extern QUAD QUAD_2D_P3_;
81 #define QUAD_2D_P3 (&QUAD_2D_P3_)
82 extern QUAD QUAD_2D_P4_;
83 #define QUAD_2D_P4 (&QUAD_2D_P4_)
84 extern QUAD QUAD_2D_P5_;
85 #define QUAD_2D_P5 (&QUAD_2D_P5_)
86 extern QUAD QUAD_2D_P6_;
87 #define QUAD_2D_P6 (&QUAD_2D_P6_)
88 extern QUAD QUAD_2D_P7_;
89 #define QUAD_2D_P7 (&QUAD_2D_P7_)
90 extern QUAD QUAD_2D_P8_;
91 #define QUAD_2D_P8 (&QUAD_2D_P8_)
92 extern QUAD QUAD_2D_P9_;
93 #define QUAD_2D_P9 (&QUAD_2D_P9_)
94 extern QUAD QUAD_2D_P10_;
95 #define QUAD_2D_P10 (&QUAD_2D_P10_)
96 extern QUAD QUAD_2D_P11_;
97 #define QUAD_2D_P11 (&QUAD_2D_P11_)
98 extern QUAD QUAD_2D_P12_;
99 #define QUAD_2D_P12 (&QUAD_2D_P12_)
100 extern QUAD QUAD_2D_P13_;
101 #define QUAD_2D_P13 (&QUAD_2D_P13_)
102 extern QUAD QUAD_2D_P14_;
103 #define QUAD_2D_P14 (&QUAD_2D_P14_)
104 extern QUAD QUAD_2D_P15_;
105 #define QUAD_2D_P15 (&QUAD_2D_P15_)
106 extern QUAD QUAD_2D_P16_;
107 #define QUAD_2D_P16 (&QUAD_2D_P16_)
108 extern QUAD QUAD_2D_P17_;
109 #define QUAD_2D_P17 (&QUAD_2D_P17_)
110 extern QUAD QUAD_2D_P18_;
111 #define QUAD_2D_P18 (&QUAD_2D_P18_)
112 extern QUAD QUAD_2D_P19_;
113 #define QUAD_2D_P19 (&QUAD_2D_P19_)
114 extern QUAD QUAD_2D_P20_;
115 #define QUAD_2D_P20 (&QUAD_2D_P20_)
116 extern QUAD QUAD_2D_P21_;
117 #define QUAD_2D_P21 (&QUAD_2D_P21_)
118 
119 /* 3D quadrature rules */
120 extern QUAD QUAD_3D_P1_;
121 #define QUAD_3D_P1 (&QUAD_3D_P1_)
122 extern QUAD QUAD_3D_P2_;
123 #define QUAD_3D_P2 (&QUAD_3D_P2_)
124 extern QUAD QUAD_3D_P3_;
125 #define QUAD_3D_P3 (&QUAD_3D_P3_)
126 extern QUAD QUAD_3D_P4_;
127 #define QUAD_3D_P4 (&QUAD_3D_P4_)
128 extern QUAD QUAD_3D_P5_;
129 #define QUAD_3D_P5 (&QUAD_3D_P5_)
130 extern QUAD QUAD_3D_P6_;
131 #define QUAD_3D_P6 (&QUAD_3D_P6_)
132 extern QUAD QUAD_3D_P7_;
133 #define QUAD_3D_P7 (&QUAD_3D_P7_)
134 extern QUAD QUAD_3D_P8_;
135 #define QUAD_3D_P8 (&QUAD_3D_P8_)
136 extern QUAD QUAD_3D_P9_;
137 #define QUAD_3D_P9 (&QUAD_3D_P9_)
138 extern QUAD QUAD_3D_P10_;
139 #define QUAD_3D_P10 (&QUAD_3D_P10_)
140 extern QUAD QUAD_3D_P11_;
141 #define QUAD_3D_P11 (&QUAD_3D_P11_)
142 extern QUAD QUAD_3D_P12_;
143 #define QUAD_3D_P12 (&QUAD_3D_P12_)
144 extern QUAD QUAD_3D_P13_;
145 #define QUAD_3D_P13 (&QUAD_3D_P13_)
146 extern QUAD QUAD_3D_P14_;
147 #define QUAD_3D_P14 (&QUAD_3D_P14_)
148 
149 /*-------------------------- Permutation macros ----------------------------*/
150 
151 /* 1D */
152 #define Perm2(a) _F(a),_F(a)
153 #define Dup2(w) _F(w)
154 #define Perm11(a) _F(a),_F(1.)-(_F(a)), _F(1.)-(_F(a)),_F(a)
155 #define Dup11(w) _F(w),_F(w)
156 
157 /* 2D */
158 #define Perm3(a) _F(a),_F(a),_F(a)
159 #define Dup3(w) _F(w)
160 #define Perm21(a) _F(a),_F(a),_F(1.)-(_F(a))-(_F(a)), \
161  _F(a),_F(1.)-(_F(a))-(_F(a)),_F(a), \
162  _F(1.)-(_F(a))-(_F(a)),_F(a),_F(a)
163 #define Dup21(w) _F(w),_F(w),_F(w)
164 #define Perm111(a,b) _F(a),_F(b),_F(1.)-(_F(a))-(_F(b)), \
165  _F(a),_F(1.)-(_F(a))-(_F(b)),_F(b), \
166  _F(b),_F(a),_F(1.)-(_F(a))-(_F(b)), \
167  _F(b),_F(1.)-(_F(a))-(_F(b)),_F(a), \
168  _F(1.)-(_F(a))-(_F(b)),_F(a),_F(b), \
169  _F(1.)-(_F(a))-(_F(b)),_F(b),_F(a)
170 #define Dup111(w) _F(w),_F(w),_F(w),_F(w),_F(w),_F(w)
171 
172 /* 3D */
173 #define Perm4(a) _F(a),_F(a),_F(a),_F(a)
174 #define Dup4(w) _F(w)
175 #define Perm31(a) _F(a),_F(a),_F(a),_F(1.)-_F(3.)*(_F(a)), \
176  _F(a),_F(a),_F(1.)-_F(3.)*(_F(a)),_F(a), \
177  _F(a),_F(1.)-_F(3.)*(_F(a)),_F(a),_F(a), \
178  _F(1.)-_F(3.)*(_F(a)),_F(a),_F(a),_F(a)
179 #define Dup31(w) _F(w),_F(w),_F(w),_F(w)
180 #define Perm22(a) _F(a),_F(a),_F(.5)-(_F(a)),_F(.5)-(_F(a)), \
181  _F(a),_F(.5)-(_F(a)),_F(a),_F(.5)-(_F(a)), \
182  _F(a),_F(.5)-(_F(a)),_F(.5)-(_F(a)),_F(a), \
183  _F(.5)-(_F(a)),_F(a),_F(.5)-(_F(a)),_F(a), \
184  _F(.5)-(_F(a)),_F(a),_F(a),_F(.5)-(_F(a)), \
185  _F(.5)-(_F(a)),_F(.5)-(_F(a)),_F(a),_F(a)
186 #define Dup22(w) _F(w),_F(w),_F(w),_F(w),_F(w),_F(w)
187 #define Perm211(a,b) _F(a),_F(a),_F(b),_F(1.)-(_F(a))-(_F(a))-(_F(b)), \
188  _F(a),_F(a),_F(1.)-(_F(a))-(_F(a))-(_F(b)),_F(b), \
189  _F(a),_F(b),_F(a),_F(1.)-(_F(a))-(_F(a))-(_F(b)), \
190  _F(a),_F(b),_F(1.)-(_F(a))-(_F(a))-(_F(b)),_F(a), \
191  _F(a),_F(1.)-(_F(a))-(_F(a))-(_F(b)),_F(a),_F(b), \
192  _F(a),_F(1.)-(_F(a))-(_F(a))-(_F(b)),_F(b),_F(a), \
193  _F(b),_F(a),_F(a),_F(1.)-(_F(a))-(_F(a))-(_F(b)), \
194  _F(b),_F(a),_F(1.)-(_F(a))-(_F(a))-(_F(b)),_F(a), \
195  _F(b),_F(1.)-(_F(a))-(_F(a))-(_F(b)),_F(a),_F(a), \
196  _F(1.)-(_F(a))-(_F(a))-(_F(b)),_F(a),_F(a),_F(b), \
197  _F(1.)-(_F(a))-(_F(a))-(_F(b)),_F(a),_F(b),_F(a), \
198  _F(1.)-(_F(a))-(_F(a))-(_F(b)),_F(b),_F(a),_F(a)
199 #define Dup211(w) _F(w),_F(w),_F(w),_F(w),_F(w),_F(w),\
200  _F(w),_F(w),_F(w),_F(w),_F(w),_F(w)
201 #define Perm0111(p,a,b,c) p,a,b,c, p,a,c,b, p,b,a,c, p,b,c,a, p,c,a,b, p,c,b,a
202 #define Perm1111(a,b,c) \
203  Perm0111(_F(a),_F(b),_F(c),_F(1.)-(_F(a))-(_F(b))-(_F(c))), \
204  Perm0111(_F(b),_F(a),_F(c),_F(1.)-(_F(a))-(_F(b))-(_F(c))), \
205  Perm0111(_F(c),_F(a),_F(b),_F(1.)-(_F(a))-(_F(b))-(_F(c))), \
206  Perm0111(_F(1.)-(_F(a))-(_F(b))-(_F(c)),_F(a),_F(b),_F(c))
207 #define Dup1111(w) Dup111(w), Dup111(w), Dup111(w), Dup111(w)
208 
209 
210 #define PHG_QUAD_H
211 #endif
QUAD QUAD_2D_P8_
Definition: quad.c:459
struct QUAD_ QUAD
SHORT id
Definition: quad.h:36
QUAD QUAD_1D_P3_
Definition: quad.c:59
QUAD QUAD_3D_P4_
Definition: quad.c:1172
QUAD QUAD_3D_P12_
Definition: quad.c:1471
QUAD QUAD_3D_P8_
Definition: quad.c:1304
QUAD QUAD_1D_P19_
Definition: quad.c:232
QUAD QUAD_2D_P2_
Definition: quad.c:292
QUAD QUAD_3D_P14_
Definition: quad.c:1591
QUAD QUAD_2D_P6_
Definition: quad.c:396
#define SHORT
int order
Definition: quad.h:32
QUAD QUAD_2D_P15_
Definition: quad.c:730
QUAD QUAD_3D_P5_
Definition: quad.c:1223
Definition: quad.h:29
QUAD QUAD_1D_P5_
Definition: quad.c:78
FLOAT * points
Definition: quad.h:34
QUAD QUAD_2D_P18_
Definition: quad.c:877
int dim
Definition: quad.h:31
QUAD QUAD_1D_P1_
Definition: quad.c:42
QUAD QUAD_2D_P16_
Definition: quad.c:776
QUAD QUAD_3D_P1_
Definition: quad.c:1081
QUAD QUAD_2D_P1_
Definition: quad.c:276
QUAD QUAD_2D_P14_
Definition: quad.c:685
QUAD QUAD_1D_P7_
Definition: quad.c:98
QUAD QUAD_3D_P7_
Definition: quad.c:1274
QUAD QUAD_2D_P11_
Definition: quad.c:574
QUAD QUAD_1D_P11_
Definition: quad.c:140
QUAD QUAD_2D_P3_
Definition: quad.c:323
QUAD QUAD_3D_P10_
Definition: quad.c:1376
QUAD QUAD_3D_P6_
Definition: quad.c:1248
int npoints
Definition: quad.h:33
QUAD QUAD_2D_P7_
Definition: quad.c:434
QUAD QUAD_2D_P21_
Definition: quad.c:1063
QUAD QUAD_2D_P20_
Definition: quad.c:999
QUAD QUAD_1D_P13_
Definition: quad.c:162
QUAD QUAD_2D_P17_
Definition: quad.c:825
QUAD QUAD_2D_P4_
Definition: quad.c:345
QUAD QUAD_2D_P9_
Definition: quad.c:511
QUAD QUAD_2D_P13_
Definition: quad.c:643
QUAD QUAD_3D_P3_
Definition: quad.c:1131
QUAD QUAD_3D_P9_
Definition: quad.c:1338
QUAD QUAD_2D_P12_
Definition: quad.c:607
QUAD QUAD_3D_P13_
Definition: quad.c:1527
QUAD QUAD_1D_P17_
Definition: quad.c:208
QUAD QUAD_2D_P19_
Definition: quad.c:937
QUAD QUAD_3D_P11_
Definition: quad.c:1420
QUAD QUAD_1D_P9_
Definition: quad.c:120
const char * name
Definition: quad.h:30
QUAD QUAD_2D_P10_
Definition: quad.c:542
QUAD QUAD_2D_P5_
Definition: quad.c:370
#define FLOAT
QUAD QUAD_3D_P2_
Definition: quad.c:1098
QUAD QUAD_1D_P15_
Definition: quad.c:184
FLOAT * weights
Definition: quad.h:35
QUAD QUAD_1D_P21_
Definition: quad.c:258