1
/*******************************************************
3
* Copyright (c) 2003-2010 by University of Queensland
4
* Earth Systems Science Computational Center (ESSCC)
5
* http://www.uq.edu.au/esscc
7
* Primary Business: Queensland, Australia
8
* Licensed under the Open Software License version 3.0
9
* http://www.opensource.org/licenses/osl-3.0.php
11
*******************************************************/
13
#include "ShapeTable.h"
14
#include "esysUtils/mem.h"
17
/* Joel Fenwick - derived from info in Finley's Quadrature and shape files
19
This method is not threadsafe unless the initial call has completed
20
Evaluates the shape functions at nodes (This is the S value from the finley ShapeFunctions
21
The dim argument is the dimension of the element not the dimension of the embedding space.
22
the reduced arg is whether the elements are reduced or not
24
bool_t getQuadShape(dim_t dim, bool_t reduced, const double **shapearr)
26
#define _dudley_s_alpha 0.58541019662496852
27
#define _dudley_s_beta 0.1381966011250105
29
/* {Line, TRI, TET} X {single_quad_point, more} X max number of quadpoints */
30
static const double _dudley_V[3 * 2][12] = {
31
{0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* Line single */
32
{(1. - .577350269189626) / 2., (1. + .577350269189626) / 2., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* Line 2 points */
33
{1 / 3., 1 / 3., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* Tri single */
34
{0.5, 0, 0, 0.5, 0.5, 0.5, 0, 0, 0, 0, 0, 0}, /* Tri 3 points */
35
{0.25, 0.25, 0.25, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* Tet single */
36
{_dudley_s_beta, _dudley_s_beta, _dudley_s_beta,
37
_dudley_s_alpha, _dudley_s_beta, _dudley_s_beta,
38
_dudley_s_beta, _dudley_s_alpha, _dudley_s_beta,
39
_dudley_s_beta, _dudley_s_beta, _dudley_s_alpha} /* Tet 4 points */
42
#undef _dudley_s_alpha
45
static double **arr = 0;
50
arr = MEMALLOC(8,double*); /* point occupies two slots to make things simpler */
51
arr[0] = MEMALLOC(1,double);
52
arr[0][0] = 1.; /* point */
54
arr[2] = MEMALLOC(4,double); /* Line Single */
55
arr[3] = MEMALLOC(4,double); /* Line 2 */
57
for (i = 0; i < 2; ++i)
59
arr[2][2 * i] = 1 - _dudley_V[0][i];
60
arr[3][2 * i] = 1 - _dudley_V[1][i];
62
arr[2][2 * i + 1] = _dudley_V[0][i];
63
arr[3][2 * i + 1] = _dudley_V[1][i];
66
arr[4] = MEMALLOC(3,double); /* Tri single */
67
arr[4][0] = 1. - _dudley_V[2][0] - _dudley_V[2][1];
68
arr[4][1] = _dudley_V[2][0];
69
arr[4][2] = _dudley_V[2][1];
71
arr[5] = MEMALLOC(9,double); /* Tri 3 */
72
for (i = 0; i < 3; ++i)
74
arr[5][3 * i] = 1 - _dudley_V[3][2 * i] - _dudley_V[3][2 * i + 1];
75
arr[5][3 * i + 1] = _dudley_V[3][2 * i];
76
arr[5][3 * i + 2] = _dudley_V[3][2 * i + 1];
78
arr[6] = MEMALLOC(4, double); /* Tet single */
79
arr[6][0] = 1 - _dudley_V[4][0] - _dudley_V[4][1] - _dudley_V[4][2];
80
arr[6][1] = _dudley_V[4][0];
81
arr[6][2] = _dudley_V[4][1];
82
arr[6][3] = _dudley_V[4][2];
84
arr[7] = MEMALLOC(16,double); /* Tet 4 */
85
for (i = 0; i < 4; ++i)
87
double x = _dudley_V[5][3 * i];
88
double y = _dudley_V[5][3 * i + 1];
89
double z = _dudley_V[5][3 * i + 2];
90
arr[7][4 * i] = 1 - x - y - z;
91
arr[7][4 * i + 1] = x;
92
arr[7][4 * i + 2] = y;
93
arr[7][4 * i + 3] = z;
97
if ((dim > -1) && (dim < 4))
99
*shapearr = arr[(!reduced) ? (2 * dim + 1) : (2 * dim)];
106
const char *getElementName(Dudley_ElementTypeId id)
118
case Dudley_Line2Face:
120
case Dudley_Tri3Face:
122
case Dudley_Tet4Face: