# Diff of /branches/trilinos_from_5897/dudley/src/ShapeTable.cpp

revision 6008 by caltinay, Mon Feb 22 06:59:27 2016 UTC revision 6009 by caltinay, Wed Mar 2 04:13:26 2016 UTC
# Line 14  Line 14
14  *****************************************************************************/  *****************************************************************************/
15
16  #include "ShapeTable.h"  #include "ShapeTable.h"
17
18  #include <cstdlib>  #include <cstdlib>
19
20    namespace dudley {
21
22  /* Joel Fenwick - derived from info in Finley's Quadrature and shape files  /* Joel Fenwick - derived from info in Finley's Quadrature and shape files
23
24  This method is not threadsafe unless the initial call has completed  This method is not threadsafe unless the initial call has completed
# Line 30  bool getQuadShape(dim_t dim, bool reduce Line 33  bool getQuadShape(dim_t dim, bool reduce
33
34  /* {Line, TRI, TET} X {single_quad_point, more} X max number of quadpoints */  /* {Line, TRI, TET} X {single_quad_point, more} X max number of quadpoints */
35      static const double _dudley_V[3 * 2][12] = {      static const double _dudley_V[3 * 2][12] = {
36      {0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* Line single */          {0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* Line single */
37      {(1. - .577350269189626) / 2., (1. + .577350269189626) / 2., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* Line 2 points */          {(1. - .577350269189626) / 2., (1. + .577350269189626) / 2., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},     /* Line 2 points */
38      {1 / 3., 1 / 3., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* Tri single */          {1 / 3., 1 / 3., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* Tri single */
39      {0.5, 0, 0, 0.5, 0.5, 0.5, 0, 0, 0, 0, 0, 0},   /* Tri 3 points */          {0.5, 0, 0, 0.5, 0.5, 0.5, 0, 0, 0, 0, 0, 0},   /* Tri 3 points */
40      {0.25, 0.25, 0.25, 0, 0, 0, 0, 0, 0, 0, 0, 0},  /* Tet single */          {0.25, 0.25, 0.25, 0, 0, 0, 0, 0, 0, 0, 0, 0},  /* Tet single */
41      {_dudley_s_beta, _dudley_s_beta, _dudley_s_beta,          {_dudley_s_beta, _dudley_s_beta, _dudley_s_beta,
42       _dudley_s_alpha, _dudley_s_beta, _dudley_s_beta,           _dudley_s_alpha, _dudley_s_beta, _dudley_s_beta,
43       _dudley_s_beta, _dudley_s_alpha, _dudley_s_beta,           _dudley_s_beta, _dudley_s_alpha, _dudley_s_beta,
44       _dudley_s_beta, _dudley_s_beta, _dudley_s_alpha}   /* Tet 4 points */           _dudley_s_beta, _dudley_s_beta, _dudley_s_alpha}       /* Tet 4 points */
45      };      };
46
47  #undef _dudley_s_alpha  #undef _dudley_s_alpha
# Line 48  bool getQuadShape(dim_t dim, bool reduce Line 51  bool getQuadShape(dim_t dim, bool reduce
51
52      if (arr == 0)      if (arr == 0)
53      {      {
54      int i;          int i;
55      arr = new double*[8];   /* point occupies two slots to make things simpler */          arr = new double*[8];   /* point occupies two slots to make things simpler */
56      arr[0] = new double[1];          arr[0] = new double[1];
57      arr[0][0] = 1.;     /* point */          arr[0][0] = 1.;         /* point */
58      arr[1] = arr[0];          arr[1] = arr[0];
59      arr[2] = new double[4]; /* Line Single */          arr[2] = new double[4]; /* Line Single */
60      arr[3] = new double[4]; /* Line 2 */          arr[3] = new double[4]; /* Line 2 */
61
62  /*  /*
63      for (i = 0; i < 2; ++i)          for (i = 0; i < 2; ++i)
64      {          {
65          arr[2][2 * i] = 1 - _dudley_V[0][i];              arr[2][2 * i] = 1 - _dudley_V[0][i];
66          arr[3][2 * i] = 1 - _dudley_V[1][i];              arr[3][2 * i] = 1 - _dudley_V[1][i];
67
68          arr[2][2 * i + 1] = _dudley_V[0][i];              arr[2][2 * i + 1] = _dudley_V[0][i];
69          arr[3][2 * i + 1] = _dudley_V[1][i];              arr[3][2 * i + 1] = _dudley_V[1][i];
70      }          }
71  */  */
72
73      for (i = 0; i < 2; ++i)          for (i = 0; i < 2; ++i)
74      {          {
75          arr[2][2 * i] = 1 - _dudley_V[0][i];              arr[2][2 * i] = 1 - _dudley_V[0][i];
76          arr[2][2 * i + 1] = _dudley_V[0][i];              arr[2][2 * i + 1] = _dudley_V[0][i];
77      }          }
78      for (i = 0; i < 2; ++i)          for (i = 0; i < 2; ++i)
79      {          {
80          arr[3][2 * i] = 1 - _dudley_V[1][i];              arr[3][2 * i] = 1 - _dudley_V[1][i];
81          arr[3][2 * i + 1] = _dudley_V[1][i];              arr[3][2 * i + 1] = _dudley_V[1][i];
82      }          }
83
84
85
86      arr[4] = new double[3]; /* Tri single */          arr[4] = new double[3]; /* Tri single */
87      arr[4][0] = 1. - _dudley_V[2][0] - _dudley_V[2][1];          arr[4][0] = 1. - _dudley_V[2][0] - _dudley_V[2][1];
88      arr[4][1] = _dudley_V[2][0];          arr[4][1] = _dudley_V[2][0];
89      arr[4][2] = _dudley_V[2][1];          arr[4][2] = _dudley_V[2][1];
90
91      arr[5] = new double[9]; /* Tri 3 */          arr[5] = new double[9]; /* Tri 3 */
92      for (i = 0; i < 3; ++i)          for (i = 0; i < 3; ++i)
93      {          {
94          arr[5][3 * i] = 1 - _dudley_V[3][2 * i] - _dudley_V[3][2 * i + 1];              arr[5][3 * i] = 1 - _dudley_V[3][2 * i] - _dudley_V[3][2 * i + 1];
95          arr[5][3 * i + 1] = _dudley_V[3][2 * i];              arr[5][3 * i + 1] = _dudley_V[3][2 * i];
96          arr[5][3 * i + 2] = _dudley_V[3][2 * i + 1];              arr[5][3 * i + 2] = _dudley_V[3][2 * i + 1];
97      }          }
98      arr[6] = new  double[4];    /* Tet single */          arr[6] = new  double[4];        /* Tet single */
99      arr[6][0] = 1 - _dudley_V[4][0] - _dudley_V[4][1] - _dudley_V[4][2];          arr[6][0] = 1 - _dudley_V[4][0] - _dudley_V[4][1] - _dudley_V[4][2];
100      arr[6][1] = _dudley_V[4][0];          arr[6][1] = _dudley_V[4][0];
101      arr[6][2] = _dudley_V[4][1];          arr[6][2] = _dudley_V[4][1];
102      arr[6][3] = _dudley_V[4][2];          arr[6][3] = _dudley_V[4][2];
103
104      arr[7] = new double[16];    /* Tet 4 */          arr[7] = new double[16];        /* Tet 4 */
105      for (i = 0; i < 4; ++i)          for (i = 0; i < 4; ++i)
106      {          {
107          double x = _dudley_V[5][3 * i];              double x = _dudley_V[5][3 * i];
108          double y = _dudley_V[5][3 * i + 1];              double y = _dudley_V[5][3 * i + 1];
109          double z = _dudley_V[5][3 * i + 2];              double z = _dudley_V[5][3 * i + 2];
110          arr[7][4 * i] = 1 - x - y - z;              arr[7][4 * i] = 1 - x - y - z;
111          arr[7][4 * i + 1] = x;              arr[7][4 * i + 1] = x;
112          arr[7][4 * i + 2] = y;              arr[7][4 * i + 2] = y;
113          arr[7][4 * i + 3] = z;              arr[7][4 * i + 3] = z;
114      }          }
115      }               /* end if */      }                           /* end if */
116
117      if ((dim > -1) && (dim < 4))      if ((dim > -1) && (dim < 4))
118      {      {
119      *shapearr = arr[(!reduced) ? (2 * dim + 1) : (2 * dim)];          *shapearr = arr[(!reduced) ? (2 * dim + 1) : (2 * dim)];
120      return 1;          return 1;
121      }      }
122      *shapearr = 0;      *shapearr = 0;
123      return 0;      return 0;
# Line 125  const char *getElementName(Dudley_Elemen Line 128  const char *getElementName(Dudley_Elemen
128      switch (id)      switch (id)
129      {      {
130      case Dudley_Point1:      case Dudley_Point1:
131      return "Point1";          return "Point1";
132      case Dudley_Line2:      case Dudley_Line2:
133      return "Line2";          return "Line2";
134      case Dudley_Tri3:      case Dudley_Tri3:
135      return "Tri3";          return "Tri3";
136      case Dudley_Tet4:      case Dudley_Tet4:
137      return "Tet4";          return "Tet4";
138      case Dudley_Line2Face:      case Dudley_Line2Face:
139      return "Line2Face";          return "Line2Face";
140      case Dudley_Tri3Face:      case Dudley_Tri3Face:
141      return "Tri3Face";          return "Tri3Face";
142      case Dudley_Tet4Face:      case Dudley_Tet4Face:
143      return "Tet4Face";          return "Tet4Face";
144      default:      default:
145      return "noElement";          return "noElement";
146      }      }
147  }  }
148
149    } // namespace dudley
150

Legend:
 Removed from v.6008 changed lines Added in v.6009