/[escript]/branches/trilinos_from_5897/dudley/src/ShapeTable.cpp
ViewVC logotype

Contents of /branches/trilinos_from_5897/dudley/src/ShapeTable.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6079 - (show annotations)
Mon Mar 21 12:22:38 2016 UTC (2 years, 11 months ago) by caltinay
File size: 4409 byte(s)
Big commit - making dudley much more like finley to make it more
managable. Fixed quite a few issues that had been fixed in finley.
Disposed of all ReducedNode/ReducedDOF entities that dudley never supported.
Compiles and passes tests.

1 /*****************************************************************************
2 *
3 * Copyright (c) 2003-2016 by The University of Queensland
4 * http://www.uq.edu.au
5 *
6 * Primary Business: Queensland, Australia
7 * Licensed under the Open Software License version 3.0
8 * http://www.opensource.org/licenses/osl-3.0.php
9 *
10 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
11 * Development 2012-2013 by School of Earth Sciences
12 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
13 *
14 *****************************************************************************/
15
16 #include "ShapeTable.h"
17
18 namespace dudley {
19
20 // Joel Fenwick - derived from info in Finley's Quadrature and shape files
21
22 // This method is not thread-safe unless the initial call has completed.
23 // Evaluates the shape functions at nodes (This is the S value from the finley
24 // ShapeFunctions). The dim argument is the dimension of the element not the
25 // dimension of the embedding space. The reduced arg is whether the elements
26 // are reduced or not
27 bool getQuadShape(dim_t dim, bool reduced, const double **shapearr)
28 {
29 #define _dudley_s_alpha 0.58541019662496852
30 #define _dudley_s_beta 0.1381966011250105
31
32 // {Line, TRI, TET} X {single_quad_point, more} X max number of quadpoints
33 static const double _dudley_V[3 * 2][12] = {
34 {0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // Line single
35 {(1. - .577350269189626) / 2., (1. + .577350269189626) / 2., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // Line 2 points
36 {1 / 3., 1 / 3., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // Tri single
37 {0.5, 0, 0, 0.5, 0.5, 0.5, 0, 0, 0, 0, 0, 0}, // Tri 3 points
38 {0.25, 0.25, 0.25, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // Tet single
39 {_dudley_s_beta, _dudley_s_beta, _dudley_s_beta,
40 _dudley_s_alpha, _dudley_s_beta, _dudley_s_beta,
41 _dudley_s_beta, _dudley_s_alpha, _dudley_s_beta,
42 _dudley_s_beta, _dudley_s_beta, _dudley_s_alpha} // Tet 4 points
43 };
44
45 #undef _dudley_s_alpha
46 #undef _dudley_s_beta
47
48 static double **arr = NULL;
49
50 if (!arr) {
51 int i;
52 arr = new double*[8]; // point occupies two slots to make things simpler
53 arr[0] = new double[1];
54 arr[0][0] = 1.; // point
55 arr[1] = arr[0];
56 arr[2] = new double[4]; // Line Single
57 arr[3] = new double[4]; // Line 2
58
59 for (i = 0; i < 2; ++i) {
60 arr[2][2 * i] = 1 - _dudley_V[0][i];
61 arr[2][2 * i + 1] = _dudley_V[0][i];
62 arr[3][2 * i] = 1 - _dudley_V[1][i];
63 arr[3][2 * i + 1] = _dudley_V[1][i];
64 }
65
66 arr[4] = new double[3]; // 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];
70
71 arr[5] = new double[9]; // Tri 3
72 for (i = 0; i < 3; ++i) {
73 arr[5][3 * i] = 1 - _dudley_V[3][2 * i] - _dudley_V[3][2 * i + 1];
74 arr[5][3 * i + 1] = _dudley_V[3][2 * i];
75 arr[5][3 * i + 2] = _dudley_V[3][2 * i + 1];
76 }
77 arr[6] = new double[4]; // Tet single
78 arr[6][0] = 1 - _dudley_V[4][0] - _dudley_V[4][1] - _dudley_V[4][2];
79 arr[6][1] = _dudley_V[4][0];
80 arr[6][2] = _dudley_V[4][1];
81 arr[6][3] = _dudley_V[4][2];
82
83 arr[7] = new double[16]; // Tet 4
84 for (i = 0; i < 4; ++i) {
85 const double x = _dudley_V[5][3 * i];
86 const double y = _dudley_V[5][3 * i + 1];
87 const double z = _dudley_V[5][3 * i + 2];
88 arr[7][4 * i] = 1 - x - y - z;
89 arr[7][4 * i + 1] = x;
90 arr[7][4 * i + 2] = y;
91 arr[7][4 * i + 3] = z;
92 }
93 } // end if
94
95 if (dim > -1 && dim < 4) {
96 *shapearr = arr[(!reduced) ? (2 * dim + 1) : (2 * dim)];
97 return 1;
98 }
99 *shapearr = NULL;
100 return 0;
101 }
102
103 const char *getElementName(ElementTypeId id)
104 {
105 switch (id) {
106 case Dudley_Point1:
107 return "Point1";
108 case Dudley_Line2:
109 return "Line2";
110 case Dudley_Tri3:
111 return "Tri3";
112 case Dudley_Tet4:
113 return "Tet4";
114 case Dudley_Line2Face:
115 return "Line2Face";
116 case Dudley_Tri3Face:
117 return "Tri3Face";
118 case Dudley_Tet4Face:
119 return "Tet4Face";
120 default:
121 return "noElement";
122 }
123 }
124
125 } // namespace dudley
126

Properties

Name Value
svn:mergeinfo /branches/4.0fordebian/dudley/src/ShapeTable.cpp:5567-5588 /branches/lapack2681/finley/src/ShapeTable.cpp:2682-2741 /branches/pasowrap/dudley/src/ShapeTable.cpp:3661-3674 /branches/py3_attempt2/dudley/src/ShapeTable.cpp:3871-3891 /branches/restext/finley/src/ShapeTable.cpp:2610-2624 /branches/ripleygmg_from_3668/dudley/src/ShapeTable.cpp:3669-3791 /branches/stage3.0/finley/src/ShapeTable.cpp:2569-2590 /branches/symbolic_from_3470/dudley/src/ShapeTable.cpp:3471-3974 /branches/symbolic_from_3470/ripley/test/python/dudley/src/ShapeTable.cpp:3517-3974 /release/3.0/finley/src/ShapeTable.cpp:2591-2601 /release/4.0/dudley/src/ShapeTable.cpp:5380-5406 /trunk/dudley/src/ShapeTable.cpp:4257-4344,5898-6007 /trunk/ripley/test/python/dudley/src/ShapeTable.cpp:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26