v0.14.0
quad-permu.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-permu.h,v 1.2 2014/11/17 08:04:35 zlb Exp $ */
22 
23 #ifndef PHG_QUAD_PERMU_H
24 
25 /*-------------------------- Permutation macros ----------------------------*/
26 
27 /* 0D */
28 #define Perm1(a) _F(1.0)
29 #define Dup1(w) _F(w)
30 
31 #define Cons1(a) Perm1(a)
32 
33 /* unsymmetric, single point orbit */
34 #define Dup0 Dup1
35 #define Dup10 Dup0
36 #define Perm10 Perm1
37 
38 /* 1D */
39 #define Perm2(a) _F(0.5),_F(0.5)
40 #define Dup2(w) _F(w)
41 #define Perm11(a) _F(a),_F(1.)-(_F(a)), _F(1.)-(_F(a)),_F(a)
42 #define Dup11(w) _F(w),_F(w)
43 
44 #define Cons2(a) Perm2(a)
45 #define Cons11(a) Perm11(a)
46 
47 /* unsymmetric, single point orbit */
48 #define Dup20 Dup0
49 #define Perm20(a) _F(a),_F(1.)-(_F(a))
50 
51 /* 2D */
52 #define Perm3(a) _F(1.)/_F(3.),_F(1.)/_F(3.),_F(1.)/_F(3.)
53 #define Dup3(w) _F(w)
54 #define Perm21(a) _F(1.)-(_F(a))-(_F(a)),_F(a),_F(a), \
55  _F(a),_F(1.)-(_F(a))-(_F(a)),_F(a), \
56  _F(a),_F(a),_F(1.)-(_F(a))-(_F(a))
57 #define Dup21(w) _F(w),_F(w),_F(w)
58 #define Perm111(a,b) _F(a),_F(b),_F(1.)-(_F(a))-(_F(b)), \
59  _F(a),_F(1.)-(_F(a))-(_F(b)),_F(b), \
60  _F(b),_F(a),_F(1.)-(_F(a))-(_F(b)), \
61  _F(b),_F(1.)-(_F(a))-(_F(b)),_F(a), \
62  _F(1.)-(_F(a))-(_F(b)),_F(a),_F(b), \
63  _F(1.)-(_F(a))-(_F(b)),_F(b),_F(a)
64 #define Dup111(w) _F(w),_F(w),_F(w),_F(w),_F(w),_F(w)
65 
66 #define Cons3(a) Perm3(a)
67 #define Cons21(a) Perm21(a)
68 #define Cons111(a,b) Perm111(a,b)
69 
70 /* unsymmetric, single point orbit */
71 #define Dup30 Dup0
72 #define Perm30(a,b) _F(a),_F(b),_F(1.)-(_F(a))-(_F(b))
73 
74 /* 3D */
75 #define Perm4(a) _F(0.25),_F(0.25),_F(0.25),_F(0.25)
76 #define Dup4(w) _F(w)
77 #define Perm31(a) _F(1.)-_F(3.)*(_F(a)),_F(a),_F(a),_F(a), \
78  _F(a),_F(1.)-_F(3.)*(_F(a)),_F(a),_F(a), \
79  _F(a),_F(a),_F(1.)-_F(3.)*(_F(a)),_F(a), \
80  _F(a),_F(a),_F(a),_F(1.)-_F(3.)*(_F(a))
81 #define Dup31(w) _F(w),_F(w),_F(w),_F(w)
82 #define Perm22(a) _F(a),_F(a),_F(.5)-(_F(a)),_F(.5)-(_F(a)), \
83  _F(a),_F(.5)-(_F(a)),_F(a),_F(.5)-(_F(a)), \
84  _F(a),_F(.5)-(_F(a)),_F(.5)-(_F(a)),_F(a), \
85  _F(.5)-(_F(a)),_F(a),_F(.5)-(_F(a)),_F(a), \
86  _F(.5)-(_F(a)),_F(a),_F(a),_F(.5)-(_F(a)), \
87  _F(.5)-(_F(a)),_F(.5)-(_F(a)),_F(a),_F(a)
88 #define Dup22(w) _F(w),_F(w),_F(w),_F(w),_F(w),_F(w)
89 #define Perm211(a,b) _F(a),_F(a),_F(b),_F(1.)-(_F(a))-(_F(a))-(_F(b)), \
90  _F(a),_F(a),_F(1.)-(_F(a))-(_F(a))-(_F(b)),_F(b), \
91  _F(a),_F(b),_F(a),_F(1.)-(_F(a))-(_F(a))-(_F(b)), \
92  _F(a),_F(b),_F(1.)-(_F(a))-(_F(a))-(_F(b)),_F(a), \
93  _F(a),_F(1.)-(_F(a))-(_F(a))-(_F(b)),_F(a),_F(b), \
94  _F(a),_F(1.)-(_F(a))-(_F(a))-(_F(b)),_F(b),_F(a), \
95  _F(b),_F(a),_F(a),_F(1.)-(_F(a))-(_F(a))-(_F(b)), \
96  _F(b),_F(a),_F(1.)-(_F(a))-(_F(a))-(_F(b)),_F(a), \
97  _F(b),_F(1.)-(_F(a))-(_F(a))-(_F(b)),_F(a),_F(a), \
98  _F(1.)-(_F(a))-(_F(a))-(_F(b)),_F(a),_F(a),_F(b), \
99  _F(1.)-(_F(a))-(_F(a))-(_F(b)),_F(a),_F(b),_F(a), \
100  _F(1.)-(_F(a))-(_F(a))-(_F(b)),_F(b),_F(a),_F(a)
101 #define Dup211(w) _F(w),_F(w),_F(w),_F(w),_F(w),_F(w),\
102  _F(w),_F(w),_F(w),_F(w),_F(w),_F(w)
103 #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
104 #define Perm1111(a,b,c) \
105  Perm0111(_F(a),_F(b),_F(c),_F(1.)-(_F(a))-(_F(b))-(_F(c))), \
106  Perm0111(_F(b),_F(a),_F(c),_F(1.)-(_F(a))-(_F(b))-(_F(c))), \
107  Perm0111(_F(c),_F(a),_F(b),_F(1.)-(_F(a))-(_F(b))-(_F(c))), \
108  Perm0111(_F(1.)-(_F(a))-(_F(b))-(_F(c)),_F(a),_F(b),_F(c))
109 #define Dup1111(w) Dup111(w), Dup111(w), Dup111(w), Dup111(w)
110 
111 #define Cons4(a) Perm4(a)
112 #define Cons31(a) Perm31(a)
113 #define Cons22(a) Perm22(a)
114 #define Cons211(a,b) Perm211(a,b)
115 #define Cons1111(a,b,c) Perm111(a,b,c)
116 
117 /* unsymmetric, single point orbit */
118 #define Dup40 Dup0
119 #define Perm40(a,b,c) _F(a),_F(b),_F(c),_F(1.)-(_F(a))-(_F(b))-(_F(c))
120 
121 #define PHG_QUAD_PERMU_H
122 #endif