/[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 3221 - (show annotations)
Wed Sep 29 01:00:21 2010 UTC (8 years, 6 months ago) by jfenwick
File MIME type: text/plain
File size: 4741 byte(s)
Comment stripping

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->numDim=0;
33 out->numQuad=0;
34 out->numElements=0;
35 out->absD=NULL;
36 out->quadweight=0;
37 out->DSDX=NULL;
38 return out;
39 }
40 }
41
42 /**************************************************************/
43
44 void Dudley_ElementFile_Jacobeans_dealloc(Dudley_ElementFile_Jacobeans* in)
45 {
46 if (in!=NULL) {
47 MEMFREE(in->DSDX);
48 MEMFREE(in->absD);
49 MEMFREE(in);
50 }
51 }
52
53 /**************************************************************/
54
55
56 Dudley_ElementFile_Jacobeans* Dudley_ElementFile_borrowJacobeans(Dudley_ElementFile* self, Dudley_NodeFile* nodes,
57 bool_t reducedIntegrationOrder) {
58 Dudley_ElementFile_Jacobeans *out = NULL;
59
60 dim_t numNodes=self->numNodes;
61
62 if (reducedIntegrationOrder)
63 {
64 out=self->jacobeans_reducedQ;
65 }
66 else
67 {
68 out=self->jacobeans;
69 }
70 if (out->status < nodes->status)
71 {
72 out->numDim=nodes->numDim;
73 out->numQuad=QuadNums[self->numDim][!reducedIntegrationOrder];
74 out->numShapes=self->numDim+1;
75 out->numElements=self->numElements;
76 if (out->DSDX==NULL) out->DSDX=MEMALLOC((out->numElements)
77 *(out->numShapes)
78 *(out->numDim)
79 *(out->numQuad),double);
80 if (out->absD==NULL) out->absD=MEMALLOC(out->numElements,double);
81 if (! (Dudley_checkPtr(out->DSDX) || Dudley_checkPtr(out->absD)) ) {
82 /*========================== dim = 1 ============================================== */
83 if (out->numDim==1) {
84 Dudley_setError(SYSTEM_ERROR, "Dudley does not support 1D domains.");
85 /*========================== dim = 2 ============================================== */
86 } else if (out->numDim==2) {
87 if (self->numLocalDim==0) {
88 Dudley_setError(SYSTEM_ERROR,"Dudley_ElementFile_borrowJacobeans: 2D does not support local dimension 0.");
89 } else if (self->numLocalDim==1) {
90 Assemble_jacobeans_2D_M1D_E1D(nodes->Coordinates, out->numQuad, self->numElements, numNodes,self->Nodes, out->DSDX,out->absD, &(out->quadweight), self->Id);
91 } else if (self->numLocalDim==2) {
92 Assemble_jacobeans_2D(nodes->Coordinates,out->numQuad, self->numElements,numNodes,self->Nodes,
93 out->DSDX, out->absD, &(out->quadweight), self->Id);
94 } else {
95 Dudley_setError(SYSTEM_ERROR,"Dudley_ElementFile_borrowJacobeans: local dimenion in a 2D domain has to be 1 or 2.");
96 }
97 /*========================== dim = 3 ============================================== */
98 } else if (out->numDim==3) {
99 if (self->numLocalDim==0) {
100 Dudley_setError(SYSTEM_ERROR,"Dudley_ElementFile_borrowJacobeans: 3D does not support local dimension 0.");
101 } else if (self->numLocalDim==2) {
102 Assemble_jacobeans_3D_M2D_E2D(nodes->Coordinates,out->numQuad,self->numElements,numNodes,self->Nodes,
103 out->DSDX,out->absD, &(out->quadweight), self->Id);
104 } else if (self->numLocalDim==3) {
105 Assemble_jacobeans_3D(nodes->Coordinates,out->numQuad,self->numElements,numNodes,self->Nodes,
106 out->DSDX,out->absD, &(out->quadweight), self->Id);
107 } else {
108 Dudley_setError(SYSTEM_ERROR,"Dudley_ElementFile_borrowJacobeans: local dimenion in a 3D domain has to be 2 or 3.");
109 }
110 } else {
111 Dudley_setError(SYSTEM_ERROR,"Dudley_ElementFile_borrowJacobeans: spatial dimension has to be 1, 2 or 3.");
112 }
113 }
114 if (Dudley_noError()) {
115 out->status = nodes->status;
116 } else {
117 out=NULL;
118 }
119
120 }
121
122 return out;
123 }

  ViewVC Help
Powered by ViewVC 1.1.26