/[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 776 - (show annotations)
Wed Jul 12 00:07:31 2006 UTC (13 years, 10 months ago) by gross
File MIME type: text/plain
File size: 6785 byte(s)
basic code for persistence of jacobeans added. routines are not called yet
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 "Assemble.h"
24 #ifdef _OPENMP
25 #include <omp.h>
26 #endif
27
28
29 /**************************************************************/
30
31 Finley_ElementFile_Jacobeans* Finley_ElementFile_Jacobeans_alloc(void)
32 {
33 Finley_ElementFile_Jacobeans* out=MEMALLOC(1,Finley_ElementFile_Jacobeans);
34 if (Finley_checkPtr(out)) {
35 return NULL;
36 } else {
37 out->status=FINLEY_INITIAL_STATUS-1;
38 out->volume=NULL;
39 out->DSDX=NULL;
40 return out;
41 }
42 }
43
44 /**************************************************************/
45
46 void Finley_ElementFile_Jacobeans_dealloc(Finley_ElementFile_Jacobeans* in)
47 {
48 if (in!=NULL) {
49 if (in->volume!=NULL) MEMFREE(in->volume);
50 if (in->DSDX!=NULL) MEMFREE(in->DSDX);
51 MEMFREE(in);
52 }
53 }
54
55 /**************************************************************/
56
57
58 /**************************************************************/
59
60 Finley_ElementFile_Jacobeans* Finley_ElementFile_borrowJacobeans(Finley_ElementFile* self, Finley_NodeFile* nodes,
61 bool_t reducedShapefunction, bool_t reducedIntegrationOrder) {
62 Finley_ElementFile_Jacobeans *out = NULL;
63
64 if (reducedShapefunction) {
65 if (reducedIntegrationOrder) {
66 out=self->jacobeans_reducedS_reducedQ;
67 } else {
68 out=self->jacobeans_reducedS;
69 }
70 } else {
71 if (reducedIntegrationOrder) {
72 out=self->jacobeans_reducedQ;
73 } else {
74 out=self->jacobeans;
75 }
76 }
77
78 if (out->status < nodes->status) {
79 Finley_RefElement *shape, *test;
80 if (reducedShapefunction) {
81 if (reducedIntegrationOrder) {
82 shape=self->LinearReferenceElement;
83 test=self->LinearReferenceElement;
84 } else {
85 shape=self->LinearReferenceElement;
86 test=self->LinearReferenceElement;
87 }
88 } else {
89 if (reducedIntegrationOrder) {
90 shape=self->ReferenceElement;
91 test=self->ReferenceElement;
92 } else {
93 shape=self->ReferenceElement;
94 test=self->ReferenceElement;
95 }
96 }
97
98 if (out->volume==NULL) out->volume=MEMALLOC((self->numElements)*(shape->numQuadNodes),double);
99 if (out->DSDX==NULL) out->DSDX=MEMALLOC((self->numElements)*(test->Type->numShapes)*(shape->Type->numDim)*(shape->numQuadNodes),double);
100 if (! (Finley_checkPtr(out->volume) || Finley_checkPtr(out->DSDX)) ) {
101 if (nodes->numDim==1) {
102 if (shape->Type->numDim==0) {
103
104 } else if (shape->Type->numDim==1) {
105 Assemble_jacobeans_1D(nodes->Coordinates,shape->numQuadNodes,shape->QuadWeights,shape->Type->numShapes,
106 self->numElements,self->Nodes,
107 shape->dSdv,test->Type->numShapes,test->dSdv,
108 out->DSDX,out->volume,self->Id);
109 } else {
110 Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: local dimenion in a 1D domain has to be less or equal 1.");
111 }
112 } else if (nodes->numDim==2) {
113 if (shape->Type->numDim==0) {
114
115 } else if (shape->Type->numDim==1) {
116 Assemble_jacobeans_2D_M1D(nodes->Coordinates,shape->numQuadNodes,shape->QuadWeights,shape->Type->numShapes,
117 self->numElements,self->Nodes,
118 shape->dSdv,test->Type->numShapes,test->dSdv,
119 out->DSDX,out->volume,self->Id);
120 } else if (shape->Type->numDim==2) {
121 Assemble_jacobeans_2D(nodes->Coordinates,shape->numQuadNodes,shape->QuadWeights,shape->Type->numShapes,
122 self->numElements,self->Nodes,
123 shape->dSdv,test->Type->numShapes,test->dSdv,
124 out->DSDX,out->volume,self->Id);
125 } else {
126 Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: local dimenion in a 2D domain has to be less or equal 2.");
127 }
128 } else if (nodes->numDim==3) {
129 if (shape->Type->numDim==0) {
130
131 } else if (shape->Type->numDim==1) {
132 Assemble_jacobeans_3D_M1D(nodes->Coordinates,shape->numQuadNodes,shape->QuadWeights,shape->Type->numShapes,
133 self->numElements,self->Nodes,
134 shape->dSdv,test->Type->numShapes,test->dSdv,
135 out->DSDX,out->volume,self->Id);
136 } else if (shape->Type->numDim==2) {
137 Assemble_jacobeans_3D_M2D(nodes->Coordinates,shape->numQuadNodes,shape->QuadWeights,shape->Type->numShapes,
138 self->numElements,self->Nodes,
139 shape->dSdv,test->Type->numShapes,test->dSdv,
140 out->DSDX,out->volume,self->Id);
141 } else if (shape->Type->numDim==3) {
142 Assemble_jacobeans_3D(nodes->Coordinates,shape->numQuadNodes,shape->QuadWeights,shape->Type->numShapes,
143 self->numElements,self->Nodes,
144 shape->dSdv,test->Type->numShapes,test->dSdv,
145 out->DSDX,out->volume,self->Id);
146 } else {
147 Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: local dimenion in a 3D domain has to be less or equal 3.");
148 }
149 } else {
150 Finley_setError(SYSTEM_ERROR,"Finley_ElementFile_borrowJacobeans: spatial dimension has to be less or equal 3.");
151 }
152 }
153 if (Finley_noError()) {
154 out->status = nodes->status;
155 } else {
156 out=NULL;
157 }
158
159 }
160
161 return out;
162 }
163 /*
164 * $Log$
165 *
166 */

  ViewVC Help
Powered by ViewVC 1.1.26