1 // GetDP - Copyright (C) 1997-2021 P. Dular and C. Geuzaine, University of Liege
2 //
3 // See the LICENSE.txt file for license information. Please report all
4 // issues on https://gitlab.onelab.info/getdp/getdp/issues.
5
6 #include "ProData.h"
7 #include "Message.h"
8
9 /* ------------------------------------------------------------------------ */
10 /* B F _ E d g e _ 4 */
11 /* ------------------------------------------------------------------------ */
12
13 /* ------- */
14 /* Edges */
15 /* ------- */
16
17 #define WrongNumEntity Message::Error("Wrong Edge number in 'BF_Edge_4E'")
18
BF_Edge_4E(struct Element * Element,int NumEntity,double u,double v,double w,double s[])19 void BF_Edge_4E(struct Element * Element, int NumEntity,
20 double u, double v, double w, double s[])
21 {
22 switch (Element->Type) {
23 case LINE : case LINE_2 :
24 case LINE_3 : case LINE_4 :
25 switch(NumEntity) {
26 case 1 : s[0] = u*u ; s[1] = 0. ; s[2] = 0. ; break ;
27 default : WrongNumEntity ;
28 }
29 break ;
30
31 case TRIANGLE : case TRIANGLE_2 :
32 case TRIANGLE_3 : case TRIANGLE_4 :
33 switch(NumEntity) {
34 case 1 : s[0] = -6.0*u+1.0-2.0*v+6.0*u*u+6.0*u*v+v*v ;
35 s[1] = -2.0*u+3.0*u*u+2.0*u*v ;
36 s[2] = 0. ;
37 break ;
38 case 2 : s[0] = -2.0*v+3.0*v*v+2.0*u*v ;
39 s[1] = -6.0*v+1.0-2.0*u+6.0*u*v+u*u+6.0*v*v ;
40 s[2] = 0. ;
41 break ;
42 case 3 : s[0] = 2.0*u*v-v*v ;
43 s[1] = u*u-2.0*u*v ;
44 s[2] = 0. ;
45 break ;
46 default : WrongNumEntity ;
47 }
48 break ;
49
50 case QUADRANGLE : case QUADRANGLE_2 : case QUADRANGLE_2_8N :
51 case QUADRANGLE_3 : case QUADRANGLE_4 :
52 switch(NumEntity) {
53 default : Message::Error("BF_Edge_4E not ready for QUADRANGLE");
54 }
55 break ;
56
57 case TETRAHEDRON : case TETRAHEDRON_2 :
58 case TETRAHEDRON_3 : case TETRAHEDRON_4 :
59 switch(NumEntity) {
60 case 1 : s[0] = -6.0*u+1.0-2.0*v-2.0*w+6.0*u*u+6.0*u*v+6.0*u*w+v*v+2.0*v*w+w*w;
61 s[1] = -2.0*u+3.0*u*u+2.0*u*v+2.0*u*w;
62 s[2] = -2.0*u+3.0*u*u+2.0*u*v+2.0*u*w;
63 break ;
64 case 2 : s[0] = -2.0*v+3.0*v*v+2.0*u*v+2.0*v*w;
65 s[1] = -6.0*v+1.0-2.0*u-2.0*w+6.0*u*v+u*u+2.0*u*w+6.0*v*v+6.0*v*w+w*w;
66 s[2] = -2.0*v+3.0*v*v+2.0*u*v+2.0*v*w;
67 break ;
68 case 3 : s[0] = -2.0*w+3.0*w*w+2.0*u*w+2.0*v*w;
69 s[1] = -2.0*w+3.0*w*w+2.0*u*w+2.0*v*w;
70 s[2] = -6.0*w+1.0-2.0*u-2.0*v+6.0*u*w+u*u+2.0*u*v+6.0*v*w+v*v+6.0*w*w;
71 break ;
72 case 4 : s[0] = 2.0*u*v-v*v;
73 s[1] = u*u-2.0*u*v;
74 s[2] = 0.0;
75 break ;
76 case 5 : s[0] = 2.0*u*w-w*w;
77 s[1] = 0.0;
78 s[2] = u*u-2.0*u*w;
79 break ;
80 case 6 : s[0] = 0.0;
81 s[1] = 2.0*v*w-w*w;
82 s[2] = v*v-2.0*v*w;
83 break ;
84 default : WrongNumEntity ;
85 }
86 break ;
87
88 case HEXAHEDRON : case HEXAHEDRON_2 : case HEXAHEDRON_2_20N :
89 case HEXAHEDRON_3 : case HEXAHEDRON_4 :
90 switch(NumEntity) {
91 default : Message::Error("BF_Edge_4E not ready for HEXAHEDRON");
92 }
93 break ;
94
95 case PRISM : case PRISM_2 : case PRISM_2_15N :
96 case PRISM_3 : case PRISM_4 :
97 switch(NumEntity) {
98 default : Message::Error("BF_Edge_4E not ready for PRISM");
99 }
100 break ;
101
102 case PYRAMID : case PYRAMID_2 : case PYRAMID_2_13N :
103 case PYRAMID_3 : // case PYRAMID_4
104 switch(NumEntity) {
105 default : Message::Error("BF_Edge_4E not ready for PYRAMID");
106 }
107 break ;
108
109 default :
110 Message::Error("Unknown type of Element in BF_Edge_4E");
111 break ;
112 }
113
114 if (Element->GeoElement->NumEdges[NumEntity-1] < 0) {
115 s[0] = - s[0] ; s[1] = - s[1] ; s[2] = - s[2] ;
116 }
117 }
118
119 #undef WrongNumEntity
120
121 /* -------- */
122 /* Facets */
123 /* -------- */
124
125 #define WrongNumEntity Message::Error("Wrong Face number in 'BF_Edge_4F'")
126
BF_Edge_4F(struct Element * Element,int NumEntity,double u,double v,double w,double s[])127 void BF_Edge_4F(struct Element * Element, int NumEntity,
128 double u, double v, double w, double s[])
129 {
130 switch (Element->Type) {
131
132 case LINE : case LINE_2 :
133 case LINE_3 : case LINE_4 :
134 Message::Error("You should never end up here!") ;
135 break;
136
137 case TRIANGLE : case TRIANGLE_2 :
138 case TRIANGLE_3 : case TRIANGLE_4 :
139 switch(NumEntity) {
140 case 1 : s[0] = v-2.0*u*v-v*v ; s[1] = u-u*u-2.0*u*v ; s[2] = 0. ; break ;
141 default : WrongNumEntity ;
142 }
143 break ;
144
145 case QUADRANGLE : case QUADRANGLE_2 : case QUADRANGLE_2_8N :
146 case QUADRANGLE_3 : case QUADRANGLE_4 :
147 switch(NumEntity) {
148 default : Message::Error("BF_Edge_4F not ready for QUADRANGLE");
149 }
150 break ;
151
152 case TETRAHEDRON : case TETRAHEDRON_2 :
153 case TETRAHEDRON_3 : case TETRAHEDRON_4 :
154 switch(NumEntity) {
155 case 1 : s[0] = w-2.0*u*w-v*w-w*w ;
156 s[1] = -u*w ;
157 s[2] = u-u*u-u*v-2.0*u*w ;
158 break ;
159 case 2 : s[0] = v-2.0*u*v-v*v-v*w ;
160 s[1] = u-u*u-2.0*u*v-u*w ;
161 s[2] = -u*v ;
162 break ;
163 case 3 : s[0] = -v*w ;
164 s[1] = w-u*w-2.0*v*w-w*w ;
165 s[2] = v-u*v-v*v-2.0*v*w ;
166 break ;
167 case 4 : s[0] = v*w ;
168 s[1] = u*w ;
169 s[2] = u*v ;
170 break ;
171 default : WrongNumEntity ;
172 }
173 break ;
174
175 case HEXAHEDRON : case HEXAHEDRON_2 : case HEXAHEDRON_2_20N :
176 case HEXAHEDRON_3 : case HEXAHEDRON_4 :
177 switch(NumEntity) {
178 default : Message::Error("BF_Edge_4F not ready for QUADRANGLE");
179 }
180 break ;
181
182 case PRISM : case PRISM_2 : case PRISM_2_15N :
183 case PRISM_3 : case PRISM_4 :
184 switch(NumEntity) {
185 default : Message::Error("BF_Edge_4F not ready for PRISM");
186 }
187 break ;
188
189 default :
190 Message::Error("Unknown type of Element in BF_Edge_4F");
191 break ;
192
193 }
194 }
195
196 #undef WrongNumEntity
197
198 /* -------- */
199 /* Volume */
200 /* -------- */
201
BF_Edge_4V(struct Element * Element,int NumEntity,double u,double v,double w,double s[])202 void BF_Edge_4V(struct Element * Element, int NumEntity,
203 double u, double v, double w, double s[])
204 {
205 Message::Error("You should never end up here!") ;
206 }
207
208
209 /* ------------------------------------------------------------------------ */
210 /* B F _ C u r l E d g e _ 4 */
211 /* ------------------------------------------------------------------------ */
212
213 /* ------- */
214 /* Edges */
215 /* ------- */
216
BF_CurlEdge_4E(struct Element * Element,int NumEntity,double u,double v,double w,double s[])217 void BF_CurlEdge_4E(struct Element * Element, int NumEntity,
218 double u, double v, double w, double s[])
219 {
220 s[0] = 0. ; s[1] = 0. ; s[2] = 0. ;
221 }
222
223 /* -------- */
224 /* Facets */
225 /* -------- */
226
BF_CurlEdge_4F(struct Element * Element,int NumEntity,double u,double v,double w,double s[])227 void BF_CurlEdge_4F(struct Element * Element, int NumEntity,
228 double u, double v, double w, double s[])
229 {
230 s[0] = 0. ; s[1] = 0. ; s[2] = 0. ;
231 }
232
233 /* -------- */
234 /* Volume */
235 /* -------- */
236
BF_CurlEdge_4V(struct Element * Element,int NumEntity,double u,double v,double w,double s[])237 void BF_CurlEdge_4V(struct Element * Element, int NumEntity,
238 double u, double v, double w, double s[])
239 {
240 s[0] = 0. ; s[1] = 0. ; s[2] = 0. ;
241 }
242