/[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 6939 - (show annotations)
Mon Jan 20 03:37:18 2020 UTC (4 months, 1 week ago) by uqaeller
File size: 11631 byte(s)
Updated the copyright header.


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

Properties

Name Value
svn:mergeinfo /branches/4.0fordebian/finley/src/ElementFile_jacobians.cpp:5567-5588 /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 /branches/trilinos_from_5897/finley/src/ElementFile_jacobians.cpp:5898-6118 /release/3.0/finley/src/ElementFile_jacobeans.cpp:2591-2601 /release/4.0/finley/src/ElementFile_jacobians.cpp:5380-5406 /trunk/finley/src/ElementFile_jacobeans.cpp:4257-4344

  ViewVC Help
Powered by ViewVC 1.1.26