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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1312 - (hide annotations)
Mon Sep 24 06:18:44 2007 UTC (12 years, 5 months ago) by ksteube
Original Path: trunk/finley/src/ElementFile_jacobeans.c
File MIME type: text/plain
File size: 13882 byte(s)
The MPI branch is hereby closed. All future work should be in trunk.

Previously in revision 1295 I merged the latest changes to trunk into trunk-mpi-branch.
In this revision I copied all files from trunk-mpi-branch over the corresponding
trunk files. I did not use 'svn merge', it was a copy.

1 gross 552
2 ksteube 1312 /* $Id$ */
3 gross 552
4 ksteube 1312 /*******************************************************
5     *
6     * Copyright 2003-2007 by ACceSS MNRF
7     * Copyright 2007 by University of Queensland
8     *
9     * http://esscc.uq.edu.au
10     * Primary Business: Queensland, Australia
11     * Licensed under the Open Software License version 3.0
12     * http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15 gross 552
16 gross 777 #include "ElementFile.h"
17 gross 776 #include "Assemble.h"
18 gross 552 #ifdef _OPENMP
19     #include <omp.h>
20     #endif
21    
22    
23     /**************************************************************/
24    
25 gross 777 Finley_ElementFile_Jacobeans* Finley_ElementFile_Jacobeans_alloc(Finley_RefElement* ReferenceElement)
26 gross 776 {
27     Finley_ElementFile_Jacobeans* out=MEMALLOC(1,Finley_ElementFile_Jacobeans);
28     if (Finley_checkPtr(out)) {
29     return NULL;
30     } else {
31     out->status=FINLEY_INITIAL_STATUS-1;
32 gross 777 out->ReferenceElement=ReferenceElement;
33 gross 776 out->volume=NULL;
34     out->DSDX=NULL;
35     return out;
36     }
37 gross 552 }
38    
39 gross 776 /**************************************************************/
40 gross 552
41 gross 776 void Finley_ElementFile_Jacobeans_dealloc(Finley_ElementFile_Jacobeans* in)
42     {
43     if (in!=NULL) {
44     if (in->volume!=NULL) MEMFREE(in->volume);
45     if (in->DSDX!=NULL) MEMFREE(in->DSDX);
46     MEMFREE(in);
47     }
48 gross 552 }
49    
50 gross 776 /**************************************************************/
51 gross 552
52    
53 gross 776 /**************************************************************/
54 gross 552
55 gross 776 Finley_ElementFile_Jacobeans* Finley_ElementFile_borrowJacobeans(Finley_ElementFile* self, Finley_NodeFile* nodes,
56 gross 777 bool_t reducedShapefunction, bool_t reducedIntegrationOrder) {
57 gross 776 Finley_ElementFile_Jacobeans *out = NULL;
58 gross 1064 Finley_RefElement *shape=NULL;
59 gross 552
60 gross 776 if (reducedShapefunction) {
61     if (reducedIntegrationOrder) {
62     out=self->jacobeans_reducedS_reducedQ;
63 gross 1064 shape=self->ReferenceElement;
64 gross 776 } else {
65     out=self->jacobeans_reducedS;
66 gross 552 }
67 gross 776 } else {
68     if (reducedIntegrationOrder) {
69     out=self->jacobeans_reducedQ;
70     } else {
71     out=self->jacobeans;
72 gross 552 }
73 gross 776 }
74     if (out->status < nodes->status) {
75 gross 781 dim_t numNodes=self->ReferenceElement->Type->numNodes;
76 gross 777 if (reducedIntegrationOrder) {
77 gross 1064 shape=self->ReferenceElementReducedOrder;
78 gross 776 } else {
79     shape=self->ReferenceElement;
80     }
81 gross 781 out->numDim=nodes->numDim;
82 gross 777 if (out->volume==NULL) out->volume=MEMALLOC((self->numElements)*(out->ReferenceElement->numQuadNodes),double);
83     if (out->DSDX==NULL) out->DSDX=MEMALLOC((self->numElements)
84 gross 781 *(out->ReferenceElement->Type->numNodes)
85     *(out->numDim)
86 gross 777 *(out->ReferenceElement->numQuadNodes),double);
87 gross 776 if (! (Finley_checkPtr(out->volume) || Finley_checkPtr(out->DSDX)) ) {
88 gross 781 /*========================== dim = 1 ============================================== */
89     if (out->numDim==1) {
90 gross 777 if (out->ReferenceElement->Type->numLocalDim==0) {
91 gross 552
92 gross 777 } else if (out->ReferenceElement->Type->numLocalDim==1) {
93 gross 781 if ((shape->Type->numShapes==numNodes) &&
94     (out->ReferenceElement->Type->numShapes==out->ReferenceElement->Type->numNodes)) {
95     Assemble_jacobeans_1D(nodes->Coordinates,out->ReferenceElement->numQuadNodes,out->ReferenceElement->QuadWeights,
96     shape->Type->numShapes,self->numElements,numNodes,self->Nodes,
97     shape->dSdv,out->ReferenceElement->Type->numShapes,out->ReferenceElement->dSdv,
98     out->DSDX,out->volume,self->Id);
99     } else {
100     Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: 1D supports numShape=NumNodes only.");
101     }
102 gross 776 } else {
103 gross 777 Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: local dimenion in a 1D domain has to be 0 or 1.");
104 gross 776 }
105 gross 781 /*========================== dim = 2 ============================================== */
106     } else if (out->numDim==2) {
107 gross 777 if (out->ReferenceElement->Type->numLocalDim==0) {
108 gross 552
109 gross 777 } else if (out->ReferenceElement->Type->numLocalDim==1) {
110     if (out->ReferenceElement->Type->numDim==2) {
111 gross 781 if ((shape->Type->numShapes==numNodes) &&
112     (out->ReferenceElement->Type->numShapes==out->ReferenceElement->Type->numNodes)) {
113     Assemble_jacobeans_2D_M1D_E2D(nodes->Coordinates,out->ReferenceElement->numQuadNodes,out->ReferenceElement->QuadWeights,
114     shape->Type->numShapes,self->numElements,numNodes,self->Nodes,
115     shape->dSdv,out->ReferenceElement->Type->numShapes,out->ReferenceElement->dSdv,
116     out->DSDX,out->volume,self->Id);
117     } else if ((2*(shape->Type->numShapes)==numNodes) &&
118     (2*(out->ReferenceElement->Type->numShapes)==out->ReferenceElement->Type->numNodes)) {
119     Assemble_jacobeans_2D_M1D_E2D_C(nodes->Coordinates,out->ReferenceElement->numQuadNodes,out->ReferenceElement->QuadWeights,
120     shape->Type->numShapes,self->numElements,numNodes,self->Nodes,
121     shape->dSdv,out->ReferenceElement->Type->numShapes,out->ReferenceElement->dSdv,
122     out->DSDX,out->volume,self->Id);
123     } else {
124     Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: 2D supports numShape=NumNodes or 2*numShape=NumNodes only.");
125     }
126 gross 777 } else if (out->ReferenceElement->Type->numDim==1) {
127 gross 781 if ((shape->Type->numShapes==numNodes) &&
128     (out->ReferenceElement->Type->numShapes==out->ReferenceElement->Type->numNodes)) {
129     Assemble_jacobeans_2D_M1D_E1D(nodes->Coordinates,out->ReferenceElement->numQuadNodes,out->ReferenceElement->QuadWeights,
130     shape->Type->numShapes,self->numElements,numNodes,self->Nodes,
131     shape->dSdv,out->ReferenceElement->Type->numShapes,out->ReferenceElement->dSdv,
132     out->DSDX,out->volume,self->Id);
133     } else if ((2*shape->Type->numShapes==numNodes) &&
134     (2*out->ReferenceElement->Type->numShapes==out->ReferenceElement->Type->numNodes)) {
135     Assemble_jacobeans_2D_M1D_E1D_C(nodes->Coordinates,out->ReferenceElement->numQuadNodes,out->ReferenceElement->QuadWeights,
136     shape->Type->numShapes,self->numElements,numNodes,self->Nodes,
137     shape->dSdv,out->ReferenceElement->Type->numShapes,out->ReferenceElement->dSdv,
138     out->DSDX,out->volume,self->Id);
139     } else {
140     Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: 2D supports numShape=NumNodes or 2*numShape=NumNodes only.");
141     }
142 gross 777 } else {
143     Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: element dimension for local dimenion 1 in a 2D domain has to be 1 or 2.");
144     }
145     } else if (out->ReferenceElement->Type->numLocalDim==2) {
146 gross 781 if ((shape->Type->numShapes==numNodes) &&
147     (out->ReferenceElement->Type->numShapes==out->ReferenceElement->Type->numNodes)) {
148     Assemble_jacobeans_2D(nodes->Coordinates,out->ReferenceElement->numQuadNodes,out->ReferenceElement->QuadWeights,
149     shape->Type->numShapes,self->numElements,numNodes,self->Nodes,
150     shape->dSdv,out->ReferenceElement->Type->numShapes,out->ReferenceElement->dSdv,
151     out->DSDX,out->volume,self->Id);
152     } else {
153     Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: 3D volume elements supports numShape=NumNodes only.");
154     }
155    
156 gross 776 } else {
157 gross 777 Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: local dimenion in a 2D domain has to be 1 or 2.");
158 gross 776 }
159 gross 781 /*========================== dim = 3 ============================================== */
160     } else if (out->numDim==3) {
161 gross 777 if (out->ReferenceElement->Type->numLocalDim==0) {
162 gross 552
163 gross 777 } else if (out->ReferenceElement->Type->numLocalDim==2) {
164     if (out->ReferenceElement->Type->numDim==3) {
165 gross 781 if ((shape->Type->numShapes==numNodes) &&
166     (out->ReferenceElement->Type->numShapes==out->ReferenceElement->Type->numNodes)) {
167     Assemble_jacobeans_3D_M2D_E3D(nodes->Coordinates,out->ReferenceElement->numQuadNodes,out->ReferenceElement->QuadWeights,
168     shape->Type->numShapes,self->numElements,numNodes,self->Nodes,
169     shape->dSdv,out->ReferenceElement->Type->numShapes,out->ReferenceElement->dSdv,
170     out->DSDX,out->volume,self->Id);
171     } else if ((2*shape->Type->numShapes==numNodes) &&
172     (2*out->ReferenceElement->Type->numShapes==out->ReferenceElement->Type->numNodes)) {
173     Assemble_jacobeans_3D_M2D_E3D_C(nodes->Coordinates,out->ReferenceElement->numQuadNodes,out->ReferenceElement->QuadWeights,
174     shape->Type->numShapes,self->numElements,numNodes,self->Nodes,
175     shape->dSdv,out->ReferenceElement->Type->numShapes,out->ReferenceElement->dSdv,
176     out->DSDX,out->volume,self->Id);
177     } else {
178     Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: 3D supports numShape=NumNodes or 2*numShape=NumNodes only.");
179     }
180 gross 777 } else if (out->ReferenceElement->Type->numDim==2) {
181 gross 781 if ((shape->Type->numShapes==numNodes) &&
182     (out->ReferenceElement->Type->numShapes==out->ReferenceElement->Type->numNodes)) {
183     Assemble_jacobeans_3D_M2D_E2D(nodes->Coordinates,out->ReferenceElement->numQuadNodes,out->ReferenceElement->QuadWeights,
184     shape->Type->numShapes,self->numElements,numNodes,self->Nodes,
185     shape->dSdv,out->ReferenceElement->Type->numShapes,out->ReferenceElement->dSdv,
186     out->DSDX,out->volume,self->Id);
187     } else if ((2*shape->Type->numShapes==numNodes) &&
188     (2*out->ReferenceElement->Type->numShapes==out->ReferenceElement->Type->numNodes)) {
189     Assemble_jacobeans_3D_M2D_E2D_C(nodes->Coordinates,out->ReferenceElement->numQuadNodes,out->ReferenceElement->QuadWeights,
190     shape->Type->numShapes,self->numElements,numNodes,self->Nodes,
191     shape->dSdv,out->ReferenceElement->Type->numShapes,out->ReferenceElement->dSdv,
192     out->DSDX,out->volume,self->Id);
193     } else {
194     Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: 3D supports numShape=NumNodes or 2*numShape=NumNodes only.");
195     }
196 gross 777 } else {
197     Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: element dimension for local dimenion 2 in a 3D domain has to be 3 or 2.");
198     }
199     } else if (out->ReferenceElement->Type->numLocalDim==3) {
200 gross 781 if ((shape->Type->numShapes==numNodes) &&
201     (out->ReferenceElement->Type->numShapes==out->ReferenceElement->Type->numNodes)) {
202     Assemble_jacobeans_3D(nodes->Coordinates,out->ReferenceElement->numQuadNodes,out->ReferenceElement->QuadWeights,
203     shape->Type->numShapes,self->numElements,numNodes,self->Nodes,
204     shape->dSdv,out->ReferenceElement->Type->numShapes,out->ReferenceElement->dSdv,
205     out->DSDX,out->volume,self->Id);
206     } else {
207     Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: 3D volume elements supports numShape=NumNodes only.");
208     }
209 gross 776 } else {
210 gross 777 Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: local dimenion in a 3D domain has to be 2 or 3.");
211 gross 776 }
212     } else {
213 gross 777 Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: spatial dimension has to be 1, 2 or 3.");
214 gross 552 }
215 gross 776 }
216     if (Finley_noError()) {
217     out->status = nodes->status;
218     } else {
219     out=NULL;
220     }
221 gross 552
222 gross 776 }
223 gross 552
224 gross 776 return out;
225 gross 552 }
226     /*
227     * $Log$
228     *
229     */

  ViewVC Help
Powered by ViewVC 1.1.26