/[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 3247 - (hide annotations)
Wed Oct 6 05:53:06 2010 UTC (9 years, 4 months ago) by caltinay
File MIME type: text/plain
File size: 4377 byte(s)
Fixed name clashes between dudley and finley so both can be used
simultaneously.

1 gross 552
2 ksteube 1312 /*******************************************************
3 ksteube 1811 *
4 jfenwick 2881 * Copyright (c) 2003-2010 by University of Queensland
5 ksteube 1811 * 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 gross 552
14 gross 777 #include "ElementFile.h"
15 gross 776 #include "Assemble.h"
16 gross 552 #ifdef _OPENMP
17     #include <omp.h>
18     #endif
19    
20 jfenwick 3196 #include "ShapeTable.h"
21 gross 552
22     /**************************************************************/
23    
24 jfenwick 3224 Dudley_ElementFile_Jacobeans *Dudley_ElementFile_Jacobeans_alloc(void)
25 gross 776 {
26 jfenwick 3224 Dudley_ElementFile_Jacobeans *out = MEMALLOC(1, Dudley_ElementFile_Jacobeans);
27     if (Dudley_checkPtr(out))
28     {
29     return NULL;
30     }
31     else
32     {
33     out->status = DUDLEY_INITIAL_STATUS - 1;
34     out->numDim = 0;
35     out->numQuad = 0;
36     out->numElements = 0;
37     out->absD = NULL;
38     out->quadweight = 0;
39     out->DSDX = NULL;
40     return out;
41     }
42 gross 552 }
43    
44 gross 776 /**************************************************************/
45 gross 552
46 jfenwick 3224 void Dudley_ElementFile_Jacobeans_dealloc(Dudley_ElementFile_Jacobeans * in)
47 gross 776 {
48 jfenwick 3224 if (in != NULL)
49     {
50     MEMFREE(in->DSDX);
51     MEMFREE(in->absD);
52     MEMFREE(in);
53     }
54 gross 552 }
55    
56 gross 776 /**************************************************************/
57 gross 552
58 jfenwick 3224 Dudley_ElementFile_Jacobeans *Dudley_ElementFile_borrowJacobeans(Dudley_ElementFile * self, Dudley_NodeFile * nodes,
59     bool_t reducedIntegrationOrder)
60     {
61     Dudley_ElementFile_Jacobeans *out = NULL;
62 gross 552
63 jfenwick 3224 dim_t numNodes = self->numNodes;
64 gross 552
65 jfenwick 3224 if (reducedIntegrationOrder)
66     {
67     out = self->jacobeans_reducedQ;
68     }
69     else
70     {
71     out = self->jacobeans;
72     }
73     if (out->status < nodes->status)
74     {
75     out->numDim = nodes->numDim;
76     out->numQuad = QuadNums[self->numDim][!reducedIntegrationOrder];
77     out->numShapes = self->numDim + 1;
78     out->numElements = self->numElements;
79     if (out->DSDX == NULL)
80     out->DSDX = MEMALLOC((out->numElements) * (out->numShapes) * (out->numDim) * (out->numQuad), double);
81     if (out->absD == NULL)
82     out->absD = MEMALLOC(out->numElements, double);
83     if (!(Dudley_checkPtr(out->DSDX) || Dudley_checkPtr(out->absD)))
84     {
85     /*========================== dim = 1 ============================================== */
86     if (out->numDim == 1)
87     {
88     Dudley_setError(SYSTEM_ERROR, "Dudley does not support 1D domains.");
89     /*========================== dim = 2 ============================================== */
90     }
91     else if (out->numDim == 2)
92     {
93     if (self->numLocalDim == 0)
94     {
95     Dudley_setError(SYSTEM_ERROR,
96     "Dudley_ElementFile_borrowJacobeans: 2D does not support local dimension 0.");
97     }
98     else if (self->numLocalDim == 1)
99     {
100 caltinay 3247 Dudley_Assemble_jacobeans_2D_M1D_E1D(nodes->Coordinates, out->numQuad, self->numElements, numNodes,
101 jfenwick 3224 self->Nodes, out->DSDX, out->absD, &(out->quadweight), self->Id);
102     }
103     else if (self->numLocalDim == 2)
104     {
105 caltinay 3247 Dudley_Assemble_jacobeans_2D(nodes->Coordinates, out->numQuad, self->numElements, numNodes, self->Nodes,
106 jfenwick 3224 out->DSDX, out->absD, &(out->quadweight), self->Id);
107     }
108     else
109     {
110     Dudley_setError(SYSTEM_ERROR,
111 caltinay 3247 "Dudley_ElementFile_borrowJacobeans: local dimenion in a 2D domain has to be 1 or 2.");
112 jfenwick 3224 }
113     /*========================== dim = 3 ============================================== */
114     }
115     else if (out->numDim == 3)
116     {
117     if (self->numLocalDim == 0)
118     {
119     Dudley_setError(SYSTEM_ERROR,
120     "Dudley_ElementFile_borrowJacobeans: 3D does not support local dimension 0.");
121     }
122     else if (self->numLocalDim == 2)
123     {
124 caltinay 3247 Dudley_Assemble_jacobeans_3D_M2D_E2D(nodes->Coordinates, out->numQuad, self->numElements, numNodes,
125 jfenwick 3224 self->Nodes, out->DSDX, out->absD, &(out->quadweight), self->Id);
126     }
127     else if (self->numLocalDim == 3)
128     {
129 caltinay 3247 Dudley_Assemble_jacobeans_3D(nodes->Coordinates, out->numQuad, self->numElements, numNodes, self->Nodes,
130 jfenwick 3224 out->DSDX, out->absD, &(out->quadweight), self->Id);
131     }
132     else
133     {
134     Dudley_setError(SYSTEM_ERROR,
135     "Dudley_ElementFile_borrowJacobeans: local dimenion in a 3D domain has to be 2 or 3.");
136     }
137     }
138     else
139     {
140     Dudley_setError(SYSTEM_ERROR,
141     "Dudley_ElementFile_borrowJacobeans: spatial dimension has to be 1, 2 or 3.");
142     }
143     }
144     if (Dudley_noError())
145     {
146     out->status = nodes->status;
147     }
148     else
149     {
150     out = NULL;
151     }
152 gross 552
153 jfenwick 3224 }
154    
155     return out;
156 gross 552 }

  ViewVC Help
Powered by ViewVC 1.1.26