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 "GetDPConfig.h"
7 #include "ProData.h"
8 #include "BF.h"
9 #include "Message.h"
10 
11 #if defined(HAVE_KERNEL)
12 #include "Get_Geometry.h"
13 #endif
14 
15 #define ARGS					\
16   struct Element * Element, int NumNode,	\
17   double u, double v, double w,  double s[]
18 
19 /* ------------------------------------------------------------------------ */
20 /*  B F _ N o d e X ,  Y ,  Z                                               */
21 /* ------------------------------------------------------------------------ */
22 
23 #define BF(BF_NodeX_, BF_Node_, use_, dum1_, dum2_)	\
24   s[dum1_] = s[dum2_] = 0. ;				\
25   (BF_Node_)(Element, NumNode, u, v, w, &s[use_]);
26 
BF_NodeX(ARGS)27 void BF_NodeX(ARGS)    { BF("BF_NodeX", BF_Node, 0, 1, 2) ; }
BF_NodeX_2E(ARGS)28 void BF_NodeX_2E(ARGS) { BF("BF_NodeX_2E", BF_Node_2E, 0, 1, 2) ; }
BF_NodeX_2F(ARGS)29 void BF_NodeX_2F(ARGS) { BF("BF_NodeX_2F", BF_Node_2F, 0, 1, 2) ; }
BF_NodeX_2V(ARGS)30 void BF_NodeX_2V(ARGS) { BF("BF_NodeX_2V", BF_Node_2V, 0, 1, 2) ; }
BF_NodeX_3E(ARGS)31 void BF_NodeX_3E(ARGS) { BF("BF_NodeX_3E", BF_Node_3E, 0, 1, 2) ; }
BF_NodeX_3F(ARGS)32 void BF_NodeX_3F(ARGS) { BF("BF_NodeX_3F", BF_Node_3F, 0, 1, 2) ; }
BF_NodeX_3V(ARGS)33 void BF_NodeX_3V(ARGS) { BF("BF_NodeX_3V", BF_Node_3V, 0, 1, 2) ; }
34 
BF_NodeY(ARGS)35 void BF_NodeY(ARGS)    { BF("BF_NodeY", BF_Node, 1, 0, 2) ; }
BF_NodeY_2E(ARGS)36 void BF_NodeY_2E(ARGS) { BF("BF_NodeY_2E", BF_Node_2E, 1, 0, 2) ; }
BF_NodeY_2F(ARGS)37 void BF_NodeY_2F(ARGS) { BF("BF_NodeY_2F", BF_Node_2F, 1, 0, 2) ; }
BF_NodeY_2V(ARGS)38 void BF_NodeY_2V(ARGS) { BF("BF_NodeY_2V", BF_Node_2V, 1, 0, 2) ; }
BF_NodeY_3E(ARGS)39 void BF_NodeY_3E(ARGS) { BF("BF_NodeY_3E", BF_Node_3E, 1, 0, 2) ; }
BF_NodeY_3F(ARGS)40 void BF_NodeY_3F(ARGS) { BF("BF_NodeY_3F", BF_Node_3F, 1, 0, 2) ; }
BF_NodeY_3V(ARGS)41 void BF_NodeY_3V(ARGS) { BF("BF_NodeY_3V", BF_Node_3V, 1, 0, 2) ; }
42 
BF_NodeZ(ARGS)43 void BF_NodeZ(ARGS)    { BF("BF_NodeZ", BF_Node, 2, 0, 1) ; }
BF_NodeZ_2E(ARGS)44 void BF_NodeZ_2E(ARGS) { BF("BF_NodeZ_2E", BF_Node_2E, 2, 0, 1) ; }
BF_NodeZ_2F(ARGS)45 void BF_NodeZ_2F(ARGS) { BF("BF_NodeZ_2F", BF_Node_2F, 2, 0, 1) ; }
BF_NodeZ_2V(ARGS)46 void BF_NodeZ_2V(ARGS) { BF("BF_NodeZ_2V", BF_Node_2V, 2, 0, 1) ; }
BF_NodeZ_3E(ARGS)47 void BF_NodeZ_3E(ARGS) { BF("BF_NodeZ_3E", BF_Node_3E, 2, 0, 1) ; }
BF_NodeZ_3F(ARGS)48 void BF_NodeZ_3F(ARGS) { BF("BF_NodeZ_3F", BF_Node_3F, 2, 0, 1) ; }
BF_NodeZ_3V(ARGS)49 void BF_NodeZ_3V(ARGS) { BF("BF_NodeZ_3V", BF_Node_3V, 2, 0, 1) ; }
50 
51 #undef BF
52 
53 /* ------------------------------------------------------------------------ */
54 /*  B F _ N o d e X ,  Y ,  Z _ D . . .                                     */
55 /* ------------------------------------------------------------------------ */
56 
57 #if !defined(HAVE_KERNEL)
58 #define ChangeOfCoord_Form1(Element, su, s) \
59   Message::Error("ChangeOfCoord_Form1 requires Kernel");
60 #endif
61 
BF_NodeX_D12(struct Element * Element,int NumNode,double u,double v,double w,double s[])62 void BF_NodeX_D12(struct Element * Element, int NumNode,
63 		  double u, double v, double w,  double s[])
64 {
65   double su[3] ;
66 
67   BF_GradNode(Element, NumNode, u, v, w, su) ;
68   ChangeOfCoord_Form1(Element, su, s) ;
69 
70   s[2] = s[1] ;
71   s[1] = 0. ;
72 }
73 
BF_NodeY_D12(struct Element * Element,int NumNode,double u,double v,double w,double s[])74 void BF_NodeY_D12(struct Element * Element, int NumNode,
75 		  double u, double v, double w,  double s[])
76 {
77   double su[3] ;
78 
79   BF_GradNode(Element, NumNode, u, v, w, su) ;
80   ChangeOfCoord_Form1(Element, su, s) ;
81 
82   s[2] = s[0] ;
83   s[0] = 0. ;
84 }
85 
BF_NodeZ_D12(struct Element * Element,int NumNode,double u,double v,double w,double s[])86 void BF_NodeZ_D12(struct Element * Element, int NumNode,
87 		   double u, double v, double w,  double s[])
88 {
89   s[0] = s[1] = s[2] = 0. ;
90 }
91 
BF_NodeX_D12_2E(struct Element * Element,int NumEdge,double u,double v,double w,double s[])92 void BF_NodeX_D12_2E(struct Element * Element, int NumEdge,
93 		     double u, double v, double w,  double s[])
94 {
95   double su[3] ;
96 
97   BF_GradNode_2E(Element, NumEdge, u, v, w, su) ;
98   ChangeOfCoord_Form1(Element, su, s) ;
99 
100   s[2] = s[1] ;
101   s[1] = 0. ;
102 }
103 
BF_NodeY_D12_2E(struct Element * Element,int NumEdge,double u,double v,double w,double s[])104 void BF_NodeY_D12_2E(struct Element * Element, int NumEdge,
105 		     double u, double v, double w,  double s[])
106 {
107   double su[3] ;
108 
109   BF_GradNode_2E(Element, NumEdge, u, v, w, su) ;
110   ChangeOfCoord_Form1(Element, su, s) ;
111 
112   s[2] = s[0] ;
113   s[0] = 0. ;
114 }
115 
BF_NodeZ_D12_2E(struct Element * Element,int NumEdge,double u,double v,double w,double s[])116 void BF_NodeZ_D12_2E(struct Element * Element, int NumEdge,
117 		     double u, double v, double w,  double s[])
118 {
119   s[0] = s[1] = s[2] = 0. ;
120 }
121 
BF_GradNodeRealCoord(struct Element * Element,int NumNode,double u,double v,double w,double s[])122 void BF_GradNodeRealCoord(struct Element * Element, int NumNode,
123                           double u, double v, double w,  double s[])
124 {
125   double su[3] ;
126 
127   BF_GradNode(Element, NumNode, u, v, w, su) ;
128   ChangeOfCoord_Form1(Element, su, s) ;
129 }
130 
131 /* ------------------------------------------------------------------------ */
132 
133 #define BF(BF_NodeX_D1_, BF_GradNode_, zero1_, zero2_)	\
134   double su[3] ;					\
135   (BF_GradNode_)(Element, NumNode, u, v, w, su) ;	\
136   ChangeOfCoord_Form1(Element, su, s) ;			\
137   s[zero1_] = s[zero2_] = 0;
138 
BF_NodeX_D1(ARGS)139 void BF_NodeX_D1(ARGS)    { BF("BF_NodeX_D1", BF_GradNode, 1, 2) ; }
BF_NodeX_D1_2E(ARGS)140 void BF_NodeX_D1_2E(ARGS) { BF("BF_NodeX_D1_2E", BF_GradNode_2E, 1, 2) ; }
BF_NodeX_D1_2F(ARGS)141 void BF_NodeX_D1_2F(ARGS) { BF("BF_NodeX_D1_2F", BF_GradNode_2F, 1, 2) ; }
BF_NodeX_D1_2V(ARGS)142 void BF_NodeX_D1_2V(ARGS) { BF("BF_NodeX_D1_2V", BF_GradNode_2V, 1, 2) ; }
BF_NodeX_D1_3E(ARGS)143 void BF_NodeX_D1_3E(ARGS) { BF("BF_NodeX_D1_3E", BF_GradNode_3E, 1, 2) ; }
BF_NodeX_D1_3F(ARGS)144 void BF_NodeX_D1_3F(ARGS) { BF("BF_NodeX_D1_3F", BF_GradNode_3F, 1, 2) ; }
BF_NodeX_D1_3V(ARGS)145 void BF_NodeX_D1_3V(ARGS) { BF("BF_NodeX_D1_3V", BF_GradNode_3V, 1, 2) ; }
146 
BF_NodeY_D1(ARGS)147 void BF_NodeY_D1(ARGS)    { BF("BF_NodeY_D1", BF_GradNode, 0, 2) ; }
BF_NodeY_D1_2E(ARGS)148 void BF_NodeY_D1_2E(ARGS) { BF("BF_NodeY_D1_2E", BF_GradNode_2E, 0, 2) ; }
BF_NodeY_D1_2F(ARGS)149 void BF_NodeY_D1_2F(ARGS) { BF("BF_NodeY_D1_2F", BF_GradNode_2F, 0, 2) ; }
BF_NodeY_D1_2V(ARGS)150 void BF_NodeY_D1_2V(ARGS) { BF("BF_NodeY_D1_2V", BF_GradNode_2V, 0, 2) ; }
BF_NodeY_D1_3E(ARGS)151 void BF_NodeY_D1_3E(ARGS) { BF("BF_NodeY_D1_3E", BF_GradNode_3E, 0, 2) ; }
BF_NodeY_D1_3F(ARGS)152 void BF_NodeY_D1_3F(ARGS) { BF("BF_NodeY_D1_3F", BF_GradNode_3F, 0, 2) ; }
BF_NodeY_D1_3V(ARGS)153 void BF_NodeY_D1_3V(ARGS) { BF("BF_NodeY_D1_3V", BF_GradNode_3V, 0, 2) ; }
154 
BF_NodeZ_D1(ARGS)155 void BF_NodeZ_D1(ARGS)    { BF("BF_NodeZ_D1", BF_GradNode, 0, 1) ; }
BF_NodeZ_D1_2E(ARGS)156 void BF_NodeZ_D1_2E(ARGS) { BF("BF_NodeZ_D1_2E", BF_GradNode_2E, 0, 1) ; }
BF_NodeZ_D1_2F(ARGS)157 void BF_NodeZ_D1_2F(ARGS) { BF("BF_NodeZ_D1_2F", BF_GradNode_2F, 0, 1) ; }
BF_NodeZ_D1_2V(ARGS)158 void BF_NodeZ_D1_2V(ARGS) { BF("BF_NodeZ_D1_2V", BF_GradNode_2V, 0, 1) ; }
BF_NodeZ_D1_3E(ARGS)159 void BF_NodeZ_D1_3E(ARGS) { BF("BF_NodeZ_D1_3E", BF_GradNode_3E, 0, 1) ; }
BF_NodeZ_D1_3F(ARGS)160 void BF_NodeZ_D1_3F(ARGS) { BF("BF_NodeZ_D1_3F", BF_GradNode_3F, 0, 1) ; }
BF_NodeZ_D1_3V(ARGS)161 void BF_NodeZ_D1_3V(ARGS) { BF("BF_NodeZ_D1_3V", BF_GradNode_3V, 0, 1) ; }
162 
163 #undef BF
164 
165 /* ------------------------------------------------------------------------ */
166 
167 #define BF(BF_NodeX_D2_, BF_GradNode_, idx1_, idx2_)	\
168   double su[3] ;					\
169   (BF_GradNode_)(Element, NumNode, u, v, w, su) ;	\
170   ChangeOfCoord_Form1(Element, su, s) ;			\
171   s[idx1_] = s[idx2_] ; s[idx2_] = 0 ;
172 
BF_NodeX_D2(ARGS)173 void BF_NodeX_D2(ARGS)    { BF("BF_NodeX_D2", BF_GradNode, 0, 1) ; }
BF_NodeX_D2_2E(ARGS)174 void BF_NodeX_D2_2E(ARGS) { BF("BF_NodeX_D2_2E", BF_GradNode_2E, 0, 1) ; }
BF_NodeX_D2_2F(ARGS)175 void BF_NodeX_D2_2F(ARGS) { BF("BF_NodeX_D2_2F", BF_GradNode_2F, 0, 1) ; }
BF_NodeX_D2_2V(ARGS)176 void BF_NodeX_D2_2V(ARGS) { BF("BF_NodeX_D2_2V", BF_GradNode_2V, 0, 1) ; }
BF_NodeX_D2_3E(ARGS)177 void BF_NodeX_D2_3E(ARGS) { BF("BF_NodeX_D2_3E", BF_GradNode_3E, 0, 1) ; }
BF_NodeX_D2_3F(ARGS)178 void BF_NodeX_D2_3F(ARGS) { BF("BF_NodeX_D2_3F", BF_GradNode_3F, 0, 1) ; }
BF_NodeX_D2_3V(ARGS)179 void BF_NodeX_D2_3V(ARGS) { BF("BF_NodeX_D2_3V", BF_GradNode_3V, 0, 1) ; }
180 
BF_NodeY_D2(ARGS)181 void BF_NodeY_D2(ARGS)    { BF("BF_NodeY_D2", BF_GradNode, 1, 2) ; }
BF_NodeY_D2_2E(ARGS)182 void BF_NodeY_D2_2E(ARGS) { BF("BF_NodeY_D2_2E", BF_GradNode_2E, 1, 2) ; }
BF_NodeY_D2_2F(ARGS)183 void BF_NodeY_D2_2F(ARGS) { BF("BF_NodeY_D2_2F", BF_GradNode_2F, 1, 2) ; }
BF_NodeY_D2_2V(ARGS)184 void BF_NodeY_D2_2V(ARGS) { BF("BF_NodeY_D2_2V", BF_GradNode_2V, 1, 2) ; }
BF_NodeY_D2_3E(ARGS)185 void BF_NodeY_D2_3E(ARGS) { BF("BF_NodeY_D2_3E", BF_GradNode_3E, 1, 2) ; }
BF_NodeY_D2_3F(ARGS)186 void BF_NodeY_D2_3F(ARGS) { BF("BF_NodeY_D2_3F", BF_GradNode_3F, 1, 2) ; }
BF_NodeY_D2_3V(ARGS)187 void BF_NodeY_D2_3V(ARGS) { BF("BF_NodeY_D2_3V", BF_GradNode_3V, 1, 2) ; }
188 
BF_NodeZ_D2(ARGS)189 void BF_NodeZ_D2(ARGS)    { BF("BF_NodeZ_D2", BF_GradNode, 2, 0) ; }
BF_NodeZ_D2_2E(ARGS)190 void BF_NodeZ_D2_2E(ARGS) { BF("BF_NodeZ_D2_2E", BF_GradNode_2E, 2, 0) ; }
BF_NodeZ_D2_2F(ARGS)191 void BF_NodeZ_D2_2F(ARGS) { BF("BF_NodeZ_D2_2F", BF_GradNode_2F, 2, 0) ; }
BF_NodeZ_D2_2V(ARGS)192 void BF_NodeZ_D2_2V(ARGS) { BF("BF_NodeZ_D2_2V", BF_GradNode_2V, 2, 0) ; }
BF_NodeZ_D2_3E(ARGS)193 void BF_NodeZ_D2_3E(ARGS) { BF("BF_NodeZ_D2_3E", BF_GradNode_3E, 2, 0) ; }
BF_NodeZ_D2_3F(ARGS)194 void BF_NodeZ_D2_3F(ARGS) { BF("BF_NodeZ_D2_3F", BF_GradNode_3F, 2, 0) ; }
BF_NodeZ_D2_3V(ARGS)195 void BF_NodeZ_D2_3V(ARGS) { BF("BF_NodeZ_D2_3V", BF_GradNode_3V, 2, 0) ; }
196 
197 #undef BF
198