File: BF_Volume.cpp

package info (click to toggle)
getdp 2.9.2+dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,384 kB
  • ctags: 8,206
  • sloc: cpp: 55,135; fortran: 13,955; yacc: 8,493; lex: 746; sh: 56; ansic: 34; awk: 33; makefile: 24
file content (102 lines) | stat: -rw-r--r-- 2,361 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// GetDP - Copyright (C) 1997-2016 P. Dular and C. Geuzaine, University of Liege
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to the public mailing list <getdp@onelab.info>.

#include "ProData.h"
#include "Message.h"

/* ------------------------------------------------------------------------ */
/*  B F _ V o l u m e                                                       */
/* ------------------------------------------------------------------------ */

#define WrongNumVolume   Message::Error("Wrong Volume number in 'BF_Volume'")

void BF_Volume(struct Element * Element, int NumVolume,
	       double u, double v, double w,  double *s)
{
  switch (Element->Type) {
  case POINT :
    switch(NumVolume) {
    case 1  : *s = 1. ; break ;
    default : WrongNumVolume ;
    }
    break ;

  case LINE :
    switch(NumVolume) {
    case 1  : *s = 0.5 ; break ;
    default : WrongNumVolume ;
    }
    break ;

  case TRIANGLE :
    switch(NumVolume) {
    case 1  : *s = 2. ; break ;
    default : WrongNumVolume ;
    }
    break ;

  case QUADRANGLE :
    switch(NumVolume) {
    case 1  : *s = 0.25 ; break ;
    default : WrongNumVolume ;
    }
    break ;

  case TETRAHEDRON :
    switch(NumVolume) {
    case 1  : *s = 6. ; break ;
    default : WrongNumVolume ;
    }
    break ;

  case HEXAHEDRON :
    switch(NumVolume) {
    case 1  : *s = 0.125 ; break ;
    default : WrongNumVolume ;
    }
    break ;

  case PRISM :
    switch(NumVolume) {
    case 1  : *s = 1. ; break ;
    default : WrongNumVolume ;
    }
    break ;

  case PYRAMID :
    switch(NumVolume) {
    case 1  : *s = 3./4. ; break ;
    default : WrongNumVolume ;
    }
    break ;

  default :
    Message::Error("Unknown type of Element in BF_Volume");
    break ;
  }
}

#undef WrongNumVolume

void BF_VolumeX(struct Element * Element, int NumVolume,
		double u, double v, double w,  double *s)
{
  s[1] = s[2] = 0.;
  BF_Volume (Element, NumVolume, u, v, w, &s[0]) ;
}

void BF_VolumeY(struct Element * Element, int NumVolume,
		double u, double v, double w,  double *s)
{
  s[0] = s[2] = 0.;
  BF_Volume (Element, NumVolume, u, v, w, &s[1]) ;
}

void BF_VolumeZ(struct Element * Element, int NumVolume,
		double u, double v, double w,  double *s)
{
  s[0] = s[1] = 0.;
  BF_Volume (Element, NumVolume, u, v, w, &s[2]) ;
}