/[escript]/branches/domexper/dudley/src/ElementFile_jacobeans.c
ViewVC logotype

Contents of /branches/domexper/dudley/src/ElementFile_jacobeans.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3220 - (show annotations)
Wed Sep 29 00:33:16 2010 UTC (8 years, 6 months ago) by jfenwick
File MIME type: text/plain
File size: 6262 byte(s)
Removing references to Quadrature.? and ShapeFns

1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2010 by University of Queensland
5 * Earth Systems Science Computational Center (ESSCC)
6 * http://www.uq.edu.au/esscc
7 *
8 * Primary Business: Queensland, Australia
9 * Licensed under the Open Software License version 3.0
10 * http://www.opensource.org/licenses/osl-3.0.php
11 *
12 *******************************************************/
13
14
15 #include "ElementFile.h"
16 #include "Assemble.h"
17 #ifdef _OPENMP
18 #include <omp.h>
19 #endif
20
21 #include "ShapeTable.h"
22
23 /**************************************************************/
24
25 Dudley_ElementFile_Jacobeans* Dudley_ElementFile_Jacobeans_alloc(void)
26 {
27 Dudley_ElementFile_Jacobeans* out=MEMALLOC(1,Dudley_ElementFile_Jacobeans);
28 if (Dudley_checkPtr(out)) {
29 return NULL;
30 } else {
31 out->status=DUDLEY_INITIAL_STATUS-1;
32 // out->BasisFunctions=Dudley_ShapeFunction_reference(BasisFunctions);
33 out->numDim=0;
34 out->numQuad=0;
35 out->numElements=0;
36 out->absD=NULL;
37 out->quadweight=0;
38 out->DSDX=NULL;
39 return out;
40 }
41 }
42
43 /**************************************************************/
44
45 void Dudley_ElementFile_Jacobeans_dealloc(Dudley_ElementFile_Jacobeans* in)
46 {
47 if (in!=NULL) {
48 // Dudley_ShapeFunction_dealloc(in->BasisFunctions);
49 MEMFREE(in->DSDX);
50 MEMFREE(in->absD);
51 MEMFREE(in);
52 }
53 }
54
55 /**************************************************************/
56
57
58 Dudley_ElementFile_Jacobeans* Dudley_ElementFile_borrowJacobeans(Dudley_ElementFile* self, Dudley_NodeFile* nodes,
59 bool_t reducedIntegrationOrder) {
60 Dudley_ElementFile_Jacobeans *out = NULL;
61 // Dudley_ShapeFunction /* *shape=NULL, */ *basis;
62 // Dudley_ReferenceElement* refElement=NULL;
63 // double *dBdv;
64
65 dim_t numNodes=self->numNodes;
66
67 if (reducedIntegrationOrder)
68 {
69 out=self->jacobeans_reducedQ;
70 }
71 else
72 {
73 out=self->jacobeans;
74 }
75 if (out->status < nodes->status)
76 {
77 // basis=out->BasisFunctions;
78 // refElement= Dudley_ReferenceElementSet_borrowReferenceElement(self->referenceElementSet, reducedIntegrationOrder);
79
80 out->numDim=nodes->numDim;
81 out->numQuad=QuadNums[self->numDim][!reducedIntegrationOrder];
82 // out->numShapes=basis->Type->numShapes;
83 out->numShapes=self->numDim+1;
84 out->numElements=self->numElements;
85
86 // if (reducedShapefunction) {
87 // dBdv=basis->dSdv;
88 // } else {
89 // dBdv=refElement->DBasisFunctionDv;
90 // }
91
92 // if (out->numQuad != basis->numQuadNodes) {
93 // Dudley_setError(SYSTEM_ERROR,"Dudley_ElementFile_borrowJacobeans: Incorrect total number of quadrature points.");
94 // return NULL;
95 // }
96 // if (refElement->numNodes> numNodes) {
97 // Dudley_setError(SYSTEM_ERROR,"Dudley_ElementFile_borrowJacobeans: Too many nodes expected.");
98 // return NULL;
99 // }
100
101 if (out->DSDX==NULL) out->DSDX=MEMALLOC((out->numElements)
102 *(out->numShapes)
103 *(out->numDim)
104 *(out->numQuad),double);
105 if (out->absD==NULL) out->absD=MEMALLOC(out->numElements,double);
106 if (! (Dudley_checkPtr(out->DSDX) || Dudley_checkPtr(out->absD)) ) {
107 /*========================== dim = 1 ============================================== */
108 if (out->numDim==1) {
109 Dudley_setError(SYSTEM_ERROR, "Dudley does not support 1D domains.");
110 /*========================== dim = 2 ============================================== */
111 } else if (out->numDim==2) {
112 if (self->numLocalDim==0) {
113 Dudley_setError(SYSTEM_ERROR,"Dudley_ElementFile_borrowJacobeans: 2D does not support local dimension 0.");
114 } else if (self->numLocalDim==1) {
115 // if (out->BasisFunctions->Type->numDim==1) {
116
117 Assemble_jacobeans_2D_M1D_E1D(nodes->Coordinates, out->numQuad, self->numElements, numNodes,self->Nodes, out->DSDX,out->absD, &(out->quadweight), self->Id);
118 // } else {
119 // Dudley_setError(SYSTEM_ERROR,"Dudley_ElementFile_borrowJacobeans: element dimension for local dimenion 1 in a 2D domain has to be 1.");
120 // }
121 } else if (self->numLocalDim==2) {
122 Assemble_jacobeans_2D(nodes->Coordinates,out->numQuad, self->numElements,numNodes,self->Nodes,
123 out->DSDX, out->absD, &(out->quadweight), self->Id);
124 } else {
125 Dudley_setError(SYSTEM_ERROR,"Dudley_ElementFile_borrowJacobeans: local dimenion in a 2D domain has to be 1 or 2.");
126 }
127 /*========================== dim = 3 ============================================== */
128 } else if (out->numDim==3) {
129 if (self->numLocalDim==0) {
130 Dudley_setError(SYSTEM_ERROR,"Dudley_ElementFile_borrowJacobeans: 3D does not support local dimension 0.");
131 } else if (self->numLocalDim==2) {
132 // if (out->BasisFunctions->Type->numDim==2) {
133 Assemble_jacobeans_3D_M2D_E2D(nodes->Coordinates,out->numQuad,self->numElements,numNodes,self->Nodes,
134 out->DSDX,out->absD, &(out->quadweight), self->Id);
135 // } else {
136 // Dudley_setError(SYSTEM_ERROR,"Dudley_ElementFile_borrowJacobeans: element dimension for local dimenion 2 in a 3D domain has to be 2.");
137 // }
138 } else if (self->numLocalDim==3) {
139 Assemble_jacobeans_3D(nodes->Coordinates,out->numQuad,self->numElements,numNodes,self->Nodes,
140 out->DSDX,out->absD, &(out->quadweight), self->Id);
141 } else {
142 Dudley_setError(SYSTEM_ERROR,"Dudley_ElementFile_borrowJacobeans: local dimenion in a 3D domain has to be 2 or 3.");
143 }
144 } else {
145 Dudley_setError(SYSTEM_ERROR,"Dudley_ElementFile_borrowJacobeans: spatial dimension has to be 1, 2 or 3.");
146 }
147 }
148 if (Dudley_noError()) {
149 out->status = nodes->status;
150 } else {
151 out=NULL;
152 }
153
154 }
155
156 return out;
157 }

  ViewVC Help
Powered by ViewVC 1.1.26