/[escript]/trunk/finley/src/ElementFile_jacobians.cpp
ViewVC logotype

Contents of /trunk/finley/src/ElementFile_jacobians.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4492 - (show annotations)
Tue Jul 2 01:44:11 2013 UTC (5 years, 9 months ago) by caltinay
File size: 11644 byte(s)
Finley changes that were held back while in release mode - moved more stuff
into finley namespace.

1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2013 by University of Queensland
5 * http://www.uq.edu.au
6 *
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
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15
16 #include "ElementFile.h"
17 #include "Assemble.h"
18
19 namespace finley {
20
21 ElementFile_Jacobians::ElementFile_Jacobians(ShapeFunction* basis)
22 {
23 status=FINLEY_INITIAL_STATUS-1;
24 BasisFunctions=ShapeFunction_reference(basis);
25 numDim=0;
26 numQuadTotal=0;
27 numElements=0;
28 volume=NULL;
29 DSDX=NULL;
30 }
31
32 ElementFile_Jacobians::~ElementFile_Jacobians()
33 {
34 ShapeFunction_dealloc(BasisFunctions);
35 delete[] volume;
36 delete[] DSDX;
37 }
38
39
40 ElementFile_Jacobians* ElementFile::borrowJacobians(const NodeFile* nodefile,
41 bool reducedShapefunction, bool reducedIntegrationOrder) const
42 {
43 ElementFile_Jacobians *out = NULL;
44
45 if (reducedShapefunction) {
46 if (reducedIntegrationOrder) {
47 out=jacobians_reducedS_reducedQ;
48 } else {
49 out=jacobians_reducedS;
50 }
51 } else {
52 if (reducedIntegrationOrder) {
53 out=jacobians_reducedQ;
54 } else {
55 out=jacobians;
56 }
57 }
58
59 if (out->status < nodefile->status) {
60 ShapeFunction *basis = out->BasisFunctions;
61 ShapeFunction *shape =
62 ReferenceElementSet_borrowParametrization(referenceElementSet, reducedIntegrationOrder);
63 ReferenceElement *refElement =
64 ReferenceElementSet_borrowReferenceElement(referenceElementSet, reducedIntegrationOrder);
65
66 out->numDim=nodefile->numDim;
67 out->numQuadTotal=shape->numQuadNodes;
68 out->numSides=refElement->Type->numSides;
69 out->numShapesTotal=basis->Type->numShapes * out->numSides;
70 out->numElements=numElements;
71 double *dBdv;
72
73 if (reducedShapefunction) {
74 out->numSub=1;
75 out->node_selection=refElement->Type->linearNodes;
76 out->offsets=refElement->LinearType->offsets;
77 dBdv=basis->dSdv;
78 } else {
79 out->numSub=refElement->Type->numSubElements;
80 out->node_selection=refElement->Type->subElementNodes;
81 out->offsets=refElement->Type->offsets;
82 dBdv=refElement->DBasisFunctionDv;
83 }
84
85 if (out->numQuadTotal != out->numSub*basis->numQuadNodes) {
86 Finley_setError(SYSTEM_ERROR, "ElementFile::borrowJacobians: Incorrect total number of quadrature points.");
87 return NULL;
88 }
89 if (refElement->numNodes > numNodes) {
90 Finley_setError(SYSTEM_ERROR, "ElementFile::borrowJacobians: Too many nodes expected.");
91 return NULL;
92 }
93
94 if (out->volume==NULL)
95 out->volume=new double[(out->numElements)*(out->numQuadTotal)];
96 if (out->DSDX==NULL)
97 out->DSDX=new double[(out->numElements)
98 *(out->numShapesTotal)
99 *(out->numDim)
100 *(out->numQuadTotal)];
101
102 /*========================== dim = 1 ============================== */
103 if (out->numDim==1) {
104 if (refElement->numLocalDim==0) {
105 // nothing to be done
106 } else if (refElement->numLocalDim==1) {
107 if (out->numSides==1) {
108 Assemble_jacobians_1D(nodefile->Coordinates,
109 out->numQuadTotal, shape->QuadWeights,
110 shape->Type->numShapes, numElements, numNodes,
111 Nodes, shape->dSdv, basis->Type->numShapes, dBdv,
112 out->DSDX, out->volume, Id);
113 } else {
114 Finley_setError(SYSTEM_ERROR, "ElementFile::borrowJacobians: only one-sided elements supported in 1D.");
115 }
116 } else {
117 Finley_setError(SYSTEM_ERROR, "ElementFile::borrowJacobians: local dimension in a 1D domain has to be 0 or 1.");
118 }
119 /*========================== dim = 2 ============================== */
120 } else if (out->numDim==2) {
121 if (refElement->numLocalDim==0) {
122 // nothing to be done
123 } else if (refElement->numLocalDim==1) {
124 if (out->BasisFunctions->Type->numDim==2) {
125 if (out->numSides==1) {
126 Assemble_jacobians_2D_M1D_E2D(
127 nodefile->Coordinates, out->numQuadTotal,
128 shape->QuadWeights, shape->Type->numShapes,
129 numElements, numNodes, Nodes, shape->dSdv,
130 basis->Type->numShapes, dBdv, out->DSDX,
131 out->volume, Id);
132 } else if (out->numSides==2) {
133 Assemble_jacobians_2D_M1D_E2D_C(
134 nodefile->Coordinates, out->numQuadTotal,
135 shape->QuadWeights, shape->Type->numShapes,
136 numElements, numNodes, Nodes, shape->dSdv,
137 basis->Type->numShapes, dBdv, out->DSDX,
138 out->volume, Id);
139 } else {
140 Finley_setError(SYSTEM_ERROR, "ElementFile::borrowJacobians: elements must be one- or two-sided.");
141 }
142 } else if (out->BasisFunctions->Type->numDim==1) {
143 if (out->numSides==1) {
144 Assemble_jacobians_2D_M1D_E1D(
145 nodefile->Coordinates, out->numQuadTotal,
146 shape->QuadWeights, shape->Type->numShapes,
147 numElements, numNodes, Nodes, shape->dSdv,
148 basis->Type->numShapes, dBdv, out->DSDX,
149 out->volume, Id);
150 } else if (out->numSides==2) {
151 Assemble_jacobians_2D_M1D_E1D_C(
152 nodefile->Coordinates, out->numQuadTotal,
153 shape->QuadWeights, shape->Type->numShapes,
154 numElements, numNodes, Nodes, shape->dSdv,
155 basis->Type->numShapes, dBdv, out->DSDX,
156 out->volume, Id);
157 } else {
158 Finley_setError(SYSTEM_ERROR, "ElementFile::borrowJacobians: elements must be one- or two-sided.");
159 }
160 } else {
161 Finley_setError(SYSTEM_ERROR, "ElementFile::borrowJacobians: element dimension for local dimension 1 in a 2D domain has to be 1 or 2.");
162 }
163 } else if (refElement->numLocalDim==2) {
164 if (out->numSides==1) {
165 Assemble_jacobians_2D(nodefile->Coordinates,
166 out->numQuadTotal, shape->QuadWeights,
167 shape->Type->numShapes, numElements, numNodes,
168 Nodes, shape->dSdv, basis->Type->numShapes, dBdv,
169 out->DSDX, out->volume, Id);
170 } else {
171 Finley_setError(SYSTEM_ERROR, "ElementFile::borrowJacobians: 2D volume supports one-sided elements only.");
172 }
173 } else {
174 Finley_setError(SYSTEM_ERROR, "ElementFile::borrowJacobians: local dimension in a 2D domain has to be 1 or 2.");
175 }
176 /*========================== dim = 3 ============================== */
177 } else if (out->numDim==3) {
178 if (refElement->numLocalDim==0) {
179 // nothing to be done
180 } else if (refElement->numLocalDim==2) {
181 if (out->BasisFunctions->Type->numDim==3) {
182 if (out->numSides==1) {
183 Assemble_jacobians_3D_M2D_E3D(
184 nodefile->Coordinates, out->numQuadTotal,
185 shape->QuadWeights, shape->Type->numShapes,
186 numElements, numNodes, Nodes, shape->dSdv,
187 basis->Type->numShapes, dBdv, out->DSDX,
188 out->volume, Id);
189 } else if (out->numSides==2) {
190 Assemble_jacobians_3D_M2D_E3D_C(
191 nodefile->Coordinates, out->numQuadTotal,
192 shape->QuadWeights, shape->Type->numShapes,
193 numElements, numNodes, Nodes, shape->dSdv,
194 basis->Type->numShapes, dBdv, out->DSDX,
195 out->volume, Id);
196 } else {
197 Finley_setError(SYSTEM_ERROR, "ElementFile::borrowJacobians: elements must be one- or two-sided.");
198 }
199 } else if (out->BasisFunctions->Type->numDim==2) {
200 if (out->numSides==1) {
201 Assemble_jacobians_3D_M2D_E2D(
202 nodefile->Coordinates, out->numQuadTotal,
203 shape->QuadWeights, shape->Type->numShapes,
204 numElements, numNodes, Nodes, shape->dSdv,
205 basis->Type->numShapes, dBdv, out->DSDX,
206 out->volume, Id);
207 } else if (out->numSides==2) {
208 Assemble_jacobians_3D_M2D_E2D_C(
209 nodefile->Coordinates, out->numQuadTotal,
210 shape->QuadWeights, shape->Type->numShapes,
211 numElements, numNodes, Nodes, shape->dSdv,
212 basis->Type->numShapes, dBdv, out->DSDX,
213 out->volume, Id);
214 } else {
215 Finley_setError(SYSTEM_ERROR,"ElementFile::borrowJacobians: elements must be one- or two-sided.");
216 }
217 } else {
218 Finley_setError(SYSTEM_ERROR, "ElementFile::borrowJacobians: element dimension for local dimension 2 in a 3D domain has to be 2 or 3.");
219 }
220 } else if (refElement->numLocalDim==3) {
221 if (out->numSides==1) {
222 Assemble_jacobians_3D(nodefile->Coordinates,
223 out->numQuadTotal, shape->QuadWeights,
224 shape->Type->numShapes, numElements, numNodes,
225 Nodes, shape->dSdv, basis->Type->numShapes, dBdv,
226 out->DSDX, out->volume, Id);
227 } else {
228 Finley_setError(SYSTEM_ERROR, "ElementFile::borrowJacobians: 3D volume supports one sided elements only..");
229 }
230 } else {
231 Finley_setError(SYSTEM_ERROR, "ElementFile::borrowJacobians: local dimension in a 3D domain has to be 2 or 3.");
232 }
233 } else {
234 Finley_setError(SYSTEM_ERROR, "ElementFile::borrowJacobians: number of spatial dimensions has to be 1, 2 or 3.");
235 }
236
237 if (Finley_noError()) {
238 out->status = nodefile->status;
239 } else {
240 out=NULL;
241 }
242 }
243 return out;
244 }
245
246 } // namespace
247

Properties

Name Value
svn:mergeinfo /branches/lapack2681/finley/src/ElementFile_jacobeans.cpp:2682-2741 /branches/pasowrap/finley/src/ElementFile_jacobeans.cpp:3661-3674 /branches/py3_attempt2/finley/src/ElementFile_jacobeans.cpp:3871-3891 /branches/restext/finley/src/ElementFile_jacobeans.cpp:2610-2624 /branches/ripleygmg_from_3668/finley/src/ElementFile_jacobeans.cpp:3669-3791 /branches/stage3.0/finley/src/ElementFile_jacobeans.cpp:2569-2590 /branches/symbolic_from_3470/finley/src/ElementFile_jacobeans.cpp:3471-3974 /release/3.0/finley/src/ElementFile_jacobeans.cpp:2591-2601 /trunk/finley/src/ElementFile_jacobeans.cpp:4257-4344

  ViewVC Help
Powered by ViewVC 1.1.26