/[escript]/trunk/finley/src/ElementFile_jacobeans.c
ViewVC logotype

Annotation of /trunk/finley/src/ElementFile_jacobeans.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 777 - (hide annotations)
Wed Jul 12 08:54:45 2006 UTC (13 years, 4 months ago) by gross
File MIME type: text/plain
File size: 8528 byte(s)
integration with persistent jacobeans is running now
1 gross 552 /*
2 elspeth 616 ************************************************************
3     * Copyright 2006 by ACcESS MNRF *
4     * *
5     * http://www.access.edu.au *
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     ************************************************************
11 gross 552 */
12    
13    
14     /**************************************************************/
15    
16     /**************************************************************/
17    
18     /* Author: gross@access.edu.au */
19     /* Version: $Id$ */
20    
21     /**************************************************************/
22    
23 gross 777 #include "ElementFile.h"
24 gross 776 #include "Assemble.h"
25 gross 552 #ifdef _OPENMP
26     #include <omp.h>
27     #endif
28    
29    
30     /**************************************************************/
31    
32 gross 777 Finley_ElementFile_Jacobeans* Finley_ElementFile_Jacobeans_alloc(Finley_RefElement* ReferenceElement)
33 gross 776 {
34     Finley_ElementFile_Jacobeans* out=MEMALLOC(1,Finley_ElementFile_Jacobeans);
35     if (Finley_checkPtr(out)) {
36     return NULL;
37     } else {
38     out->status=FINLEY_INITIAL_STATUS-1;
39 gross 777 out->ReferenceElement=ReferenceElement;
40 gross 776 out->volume=NULL;
41     out->DSDX=NULL;
42     return out;
43     }
44 gross 552 }
45    
46 gross 776 /**************************************************************/
47 gross 552
48 gross 776 void Finley_ElementFile_Jacobeans_dealloc(Finley_ElementFile_Jacobeans* in)
49     {
50     if (in!=NULL) {
51     if (in->volume!=NULL) MEMFREE(in->volume);
52     if (in->DSDX!=NULL) MEMFREE(in->DSDX);
53     MEMFREE(in);
54     }
55 gross 552 }
56    
57 gross 776 /**************************************************************/
58 gross 552
59    
60 gross 776 /**************************************************************/
61 gross 552
62 gross 776 Finley_ElementFile_Jacobeans* Finley_ElementFile_borrowJacobeans(Finley_ElementFile* self, Finley_NodeFile* nodes,
63 gross 777 bool_t reducedShapefunction, bool_t reducedIntegrationOrder) {
64 gross 776 Finley_ElementFile_Jacobeans *out = NULL;
65 gross 552
66 gross 776 if (reducedShapefunction) {
67     if (reducedIntegrationOrder) {
68     out=self->jacobeans_reducedS_reducedQ;
69     } else {
70     out=self->jacobeans_reducedS;
71 gross 552 }
72 gross 776 } else {
73     if (reducedIntegrationOrder) {
74     out=self->jacobeans_reducedQ;
75     } else {
76     out=self->jacobeans;
77 gross 552 }
78 gross 776 }
79     if (out->status < nodes->status) {
80 gross 777 dim_t numNodes=self->ReferenceElement->Type->numShapes;
81     Finley_RefElement *shape;
82     if (reducedIntegrationOrder) {
83     shape=self->ReferenceElement;
84 gross 776 } else {
85     shape=self->ReferenceElement;
86     }
87 gross 777 if (out->volume==NULL) out->volume=MEMALLOC((self->numElements)*(out->ReferenceElement->numQuadNodes),double);
88     if (out->DSDX==NULL) out->DSDX=MEMALLOC((self->numElements)
89     *(out->ReferenceElement->Type->numShapes)
90     *(nodes->numDim)
91     *(out->ReferenceElement->numQuadNodes),double);
92 gross 776 if (! (Finley_checkPtr(out->volume) || Finley_checkPtr(out->DSDX)) ) {
93     if (nodes->numDim==1) {
94 gross 777 if (out->ReferenceElement->Type->numLocalDim==0) {
95 gross 552
96 gross 777 } else if (out->ReferenceElement->Type->numLocalDim==1) {
97     Assemble_jacobeans_1D(nodes->Coordinates,out->ReferenceElement->numQuadNodes,out->ReferenceElement->QuadWeights,
98     shape->Type->numShapes,self->numElements,numNodes,self->Nodes,
99     shape->dSdv,out->ReferenceElement->Type->numShapes,out->ReferenceElement->dSdv,
100 gross 776 out->DSDX,out->volume,self->Id);
101     } else {
102 gross 777 Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: local dimenion in a 1D domain has to be 0 or 1.");
103 gross 776 }
104     } else if (nodes->numDim==2) {
105 gross 777 if (out->ReferenceElement->Type->numLocalDim==0) {
106 gross 552
107 gross 777 } else if (out->ReferenceElement->Type->numLocalDim==1) {
108     if (out->ReferenceElement->Type->numDim==2) {
109     Assemble_jacobeans_2D_M1D_E2D(nodes->Coordinates,out->ReferenceElement->numQuadNodes,out->ReferenceElement->QuadWeights,
110     shape->Type->numShapes,self->numElements,numNodes,self->Nodes,
111     shape->dSdv,out->ReferenceElement->Type->numShapes,out->ReferenceElement->dSdv,
112     out->DSDX,out->volume,self->Id);
113    
114     } else if (out->ReferenceElement->Type->numDim==1) {
115     Assemble_jacobeans_2D_M1D_E1D(nodes->Coordinates,out->ReferenceElement->numQuadNodes,out->ReferenceElement->QuadWeights,
116     shape->Type->numShapes,self->numElements,numNodes,self->Nodes,
117     shape->dSdv,out->ReferenceElement->Type->numShapes,out->ReferenceElement->dSdv,
118     out->DSDX,out->volume,self->Id);
119     } else {
120     Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: element dimension for local dimenion 1 in a 2D domain has to be 1 or 2.");
121     }
122     } else if (out->ReferenceElement->Type->numLocalDim==2) {
123     Assemble_jacobeans_2D(nodes->Coordinates,out->ReferenceElement->numQuadNodes,out->ReferenceElement->QuadWeights,
124     shape->Type->numShapes,self->numElements,numNodes,self->Nodes,
125     shape->dSdv,out->ReferenceElement->Type->numShapes,out->ReferenceElement->dSdv,
126 gross 776 out->DSDX,out->volume,self->Id);
127     } else {
128 gross 777 Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: local dimenion in a 2D domain has to be 1 or 2.");
129 gross 776 }
130     } else if (nodes->numDim==3) {
131 gross 777 if (out->ReferenceElement->Type->numLocalDim==0) {
132 gross 552
133 gross 777 } else if (out->ReferenceElement->Type->numLocalDim==2) {
134     if (out->ReferenceElement->Type->numDim==3) {
135     Assemble_jacobeans_3D_M2D_E3D(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    
140     } else if (out->ReferenceElement->Type->numDim==2) {
141     Assemble_jacobeans_3D_M2D_E2D(nodes->Coordinates,out->ReferenceElement->numQuadNodes,out->ReferenceElement->QuadWeights,
142     shape->Type->numShapes,self->numElements,numNodes,self->Nodes,
143     shape->dSdv,out->ReferenceElement->Type->numShapes,out->ReferenceElement->dSdv,
144     out->DSDX,out->volume,self->Id);
145     } else {
146     Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: element dimension for local dimenion 2 in a 3D domain has to be 3 or 2.");
147     }
148     } else if (out->ReferenceElement->Type->numLocalDim==3) {
149     Assemble_jacobeans_3D(nodes->Coordinates,out->ReferenceElement->numQuadNodes,out->ReferenceElement->QuadWeights,
150     shape->Type->numShapes,self->numElements,numNodes,self->Nodes,
151     shape->dSdv,out->ReferenceElement->Type->numShapes,out->ReferenceElement->dSdv,
152 gross 776 out->DSDX,out->volume,self->Id);
153     } else {
154 gross 777 Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: local dimenion in a 3D domain has to be 2 or 3.");
155 gross 776 }
156     } else {
157 gross 777 Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: spatial dimension has to be 1, 2 or 3.");
158 gross 552 }
159 gross 776 }
160     if (Finley_noError()) {
161     out->status = nodes->status;
162     } else {
163     out=NULL;
164     }
165 gross 552
166 gross 776 }
167 gross 552
168 gross 776 return out;
169 gross 552 }
170     /*
171     * $Log$
172     *
173     */

  ViewVC Help
Powered by ViewVC 1.1.26