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 _ V o l u m e                                                       */
11 /* ------------------------------------------------------------------------ */
12 
13 #define WrongNumVolume   Message::Error("Wrong Volume number in 'BF_Volume'")
14 
BF_Volume(struct Element * Element,int NumVolume,double u,double v,double w,double * s)15 void BF_Volume(struct Element * Element, int NumVolume,
16 	       double u, double v, double w,  double *s)
17 {
18   switch (Element->Type) {
19   case POINT_ELEMENT :
20     switch(NumVolume) {
21     case 1  : *s = 1. ; break ;
22     default : WrongNumVolume ;
23     }
24     break ;
25 
26   case LINE :
27     switch(NumVolume) {
28     case 1  : *s = 0.5 ; break ;
29     default : WrongNumVolume ;
30     }
31     break ;
32 
33   case TRIANGLE :
34     switch(NumVolume) {
35     case 1  : *s = 2. ; break ;
36     default : WrongNumVolume ;
37     }
38     break ;
39 
40   case QUADRANGLE :
41     switch(NumVolume) {
42     case 1  : *s = 0.25 ; break ;
43     default : WrongNumVolume ;
44     }
45     break ;
46 
47   case TETRAHEDRON :
48     switch(NumVolume) {
49     case 1  : *s = 6. ; break ;
50     default : WrongNumVolume ;
51     }
52     break ;
53 
54   case HEXAHEDRON :
55     switch(NumVolume) {
56     case 1  : *s = 0.125 ; break ;
57     default : WrongNumVolume ;
58     }
59     break ;
60 
61   case PRISM :
62     switch(NumVolume) {
63     case 1  : *s = 1. ; break ;
64     default : WrongNumVolume ;
65     }
66     break ;
67 
68   case PYRAMID :
69     switch(NumVolume) {
70     case 1  : *s = 3./4. ; break ;
71     default : WrongNumVolume ;
72     }
73     break ;
74 
75   default :
76     Message::Error("Unknown type of Element in BF_Volume");
77     break ;
78   }
79 }
80 
81 #undef WrongNumVolume
82 
BF_VolumeX(struct Element * Element,int NumVolume,double u,double v,double w,double * s)83 void BF_VolumeX(struct Element * Element, int NumVolume,
84 		double u, double v, double w,  double *s)
85 {
86   s[1] = s[2] = 0.;
87   BF_Volume (Element, NumVolume, u, v, w, &s[0]) ;
88 }
89 
BF_VolumeY(struct Element * Element,int NumVolume,double u,double v,double w,double * s)90 void BF_VolumeY(struct Element * Element, int NumVolume,
91 		double u, double v, double w,  double *s)
92 {
93   s[0] = s[2] = 0.;
94   BF_Volume (Element, NumVolume, u, v, w, &s[1]) ;
95 }
96 
BF_VolumeZ(struct Element * Element,int NumVolume,double u,double v,double w,double * s)97 void BF_VolumeZ(struct Element * Element, int NumVolume,
98 		double u, double v, double w,  double *s)
99 {
100   s[0] = s[1] = 0.;
101   BF_Volume (Element, NumVolume, u, v, w, &s[2]) ;
102 }
103