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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 777 - (show 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 /*
2 ************************************************************
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 */
12
13
14 /**************************************************************/
15
16 /**************************************************************/
17
18 /* Author: gross@access.edu.au */
19 /* Version: $Id$ */
20
21 /**************************************************************/
22
23 #include "ElementFile.h"
24 #include "Assemble.h"
25 #ifdef _OPENMP
26 #include <omp.h>
27 #endif
28
29
30 /**************************************************************/
31
32 Finley_ElementFile_Jacobeans* Finley_ElementFile_Jacobeans_alloc(Finley_RefElement* ReferenceElement)
33 {
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 out->ReferenceElement=ReferenceElement;
40 out->volume=NULL;
41 out->DSDX=NULL;
42 return out;
43 }
44 }
45
46 /**************************************************************/
47
48 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 }
56
57 /**************************************************************/
58
59
60 /**************************************************************/
61
62 Finley_ElementFile_Jacobeans* Finley_ElementFile_borrowJacobeans(Finley_ElementFile* self, Finley_NodeFile* nodes,
63 bool_t reducedShapefunction, bool_t reducedIntegrationOrder) {
64 Finley_ElementFile_Jacobeans *out = NULL;
65
66 if (reducedShapefunction) {
67 if (reducedIntegrationOrder) {
68 out=self->jacobeans_reducedS_reducedQ;
69 } else {
70 out=self->jacobeans_reducedS;
71 }
72 } else {
73 if (reducedIntegrationOrder) {
74 out=self->jacobeans_reducedQ;
75 } else {
76 out=self->jacobeans;
77 }
78 }
79 if (out->status < nodes->status) {
80 dim_t numNodes=self->ReferenceElement->Type->numShapes;
81 Finley_RefElement *shape;
82 if (reducedIntegrationOrder) {
83 shape=self->ReferenceElement;
84 } else {
85 shape=self->ReferenceElement;
86 }
87 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 if (! (Finley_checkPtr(out->volume) || Finley_checkPtr(out->DSDX)) ) {
93 if (nodes->numDim==1) {
94 if (out->ReferenceElement->Type->numLocalDim==0) {
95
96 } 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 out->DSDX,out->volume,self->Id);
101 } else {
102 Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: local dimenion in a 1D domain has to be 0 or 1.");
103 }
104 } else if (nodes->numDim==2) {
105 if (out->ReferenceElement->Type->numLocalDim==0) {
106
107 } 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 out->DSDX,out->volume,self->Id);
127 } else {
128 Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: local dimenion in a 2D domain has to be 1 or 2.");
129 }
130 } else if (nodes->numDim==3) {
131 if (out->ReferenceElement->Type->numLocalDim==0) {
132
133 } 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 out->DSDX,out->volume,self->Id);
153 } else {
154 Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: local dimenion in a 3D domain has to be 2 or 3.");
155 }
156 } else {
157 Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: spatial dimension has to be 1, 2 or 3.");
158 }
159 }
160 if (Finley_noError()) {
161 out->status = nodes->status;
162 } else {
163 out=NULL;
164 }
165
166 }
167
168 return out;
169 }
170 /*
171 * $Log$
172 *
173 */

  ViewVC Help
Powered by ViewVC 1.1.26