/[escript]/trunk-mpi-branch/finley/src/ElementFile.c
ViewVC logotype

Contents of /trunk-mpi-branch/finley/src/ElementFile.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1223 - (show annotations)
Fri Aug 3 02:40:39 2007 UTC (11 years, 8 months ago) by gross
File MIME type: text/plain
File size: 4886 byte(s)
first attemt towards an improved MPI version.  

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 /* Finley: ElementFile */
16
17 /* allocates an element file to hold elements of type id and with integration order order. */
18 /* use Finley_Mesh_allocElementTable to allocate the element table (Id,Nodes,Tag,Owner). */
19
20 /**************************************************************/
21
22 /* Author: gross@access.edu.au */
23 /* Version: $Id$ */
24
25 /**************************************************************/
26
27 #include "ElementFile.h"
28
29 /**************************************************************/
30
31 Finley_ElementFile* Finley_ElementFile_alloc(ElementTypeId id, index_t order, index_t reduced_order, Paso_MPIInfo *MPIInfo)
32 {
33 extern Finley_RefElementInfo Finley_RefElement_InfoList[];
34 dim_t NQ, reduced_NQ;
35 Finley_ElementFile *out;
36
37 /* get the number of quadrature nodes needed to achieve integration order order: */
38
39 if (order<0) order=MAX(2*Finley_RefElement_InfoList[id].numOrder,0);
40 if (reduced_order<0) reduced_order=MAX(2*(Finley_RefElement_InfoList[id].numOrder-1),0);
41 NQ= Finley_RefElement_InfoList[id].getNumQuadNodes(order);
42 reduced_NQ= Finley_RefElement_InfoList[id].getNumQuadNodes(reduced_order);
43 if (! Finley_noError()) return NULL;
44
45 /* allocate the return value */
46
47 out=MEMALLOC(1,Finley_ElementFile);
48 if (Finley_checkPtr(out)) return NULL;
49 out->order = order;
50 out->reduced_order = reduced_order;
51 out->ReferenceElement=NULL;
52 out->LinearReferenceElement=NULL;
53 out->ReferenceElementReducedOrder=NULL;
54 out->LinearReferenceElementReducedOrder=NULL;
55 out->isPrepared=FINLEY_UNKNOWN;
56 out->numElements=0;
57 out->Id=NULL;
58 out->Nodes=NULL;
59 out->Tag=NULL;
60 out->Color=NULL;
61 out->minColor=0;
62 out->maxColor=-1;
63 out->jacobeans=NULL;
64 out->jacobeans_reducedQ=NULL;
65 out->jacobeans_reducedS=NULL;
66 out->jacobeans_reducedS_reducedQ=NULL;
67
68 out->Owner=NULL;
69 out->MPIInfo = Paso_MPIInfo_getReference( MPIInfo );
70
71 /* allocate the reference element: */
72
73 out->ReferenceElement=Finley_RefElement_alloc(id,NQ);
74 out->jacobeans=Finley_ElementFile_Jacobeans_alloc(out->ReferenceElement);
75 out->ReferenceElementReducedOrder=Finley_RefElement_alloc(id,reduced_NQ);
76 out->jacobeans_reducedQ=Finley_ElementFile_Jacobeans_alloc(out->ReferenceElementReducedOrder);
77
78 out->LinearReferenceElement=Finley_RefElement_alloc(Finley_RefElement_InfoList[id].LinearTypeId,NQ);
79 out->jacobeans_reducedS=Finley_ElementFile_Jacobeans_alloc(out->LinearReferenceElement);
80 out->LinearReferenceElementReducedOrder=Finley_RefElement_alloc(Finley_RefElement_InfoList[id].LinearTypeId,reduced_NQ);
81 out->jacobeans_reducedS_reducedQ=Finley_ElementFile_Jacobeans_alloc(out->LinearReferenceElementReducedOrder);
82
83 out->numNodes=out->ReferenceElement->Type->numNodes;
84
85 if (! Finley_noError()) {
86 Finley_ElementFile_free(out);
87 return NULL;
88 }
89 return out;
90 }
91
92 /* deallocates an element file: */
93
94 void Finley_ElementFile_free(Finley_ElementFile* in) {
95 if (in!=NULL) {
96 #ifdef Finley_TRACE
97 if (in->ReferenceElement!=NULL) printf("element file for %s is deallocated.\n",in->ReferenceElement->Type->Name);
98 #endif
99 Finley_ElementFile_freeTable(in);
100 Finley_RefElement_dealloc(in->ReferenceElement);
101 Finley_RefElement_dealloc(in->ReferenceElementReducedOrder);
102 Finley_RefElement_dealloc(in->LinearReferenceElement);
103 Finley_RefElement_dealloc(in->LinearReferenceElementReducedOrder);
104 Finley_ElementFile_Jacobeans_dealloc(in->jacobeans);
105 Finley_ElementFile_Jacobeans_dealloc(in->jacobeans_reducedS);
106 Finley_ElementFile_Jacobeans_dealloc(in->jacobeans_reducedQ);
107 Finley_ElementFile_Jacobeans_dealloc(in->jacobeans_reducedS_reducedQ);
108 Paso_MPIInfo_free( in->MPIInfo );
109 MEMFREE(in);
110 }
111 }
112
113 dim_t Finley_ElementFile_getGlobalNumElements(Finley_ElementFile* in) {
114 if (in) {
115 } else {
116 return 0;
117 }
118 }
119 dim_t Finley_ElementFile_getMyNumElements(Finley_ElementFile* in) {
120 return Finley_ElementFile_getLastElement(in)-Finley_ElementFile_getFirstElement(in);
121 }
122 index_t Finley_ElementFile_getFirstElement(Finley_ElementFile* in) {
123 if (in) {
124 } else {
125 return 0;
126 }
127 }
128 index_t Finley_ElementFile_getLastElement(Finley_ElementFile* in) {
129 if (in) {
130 } else {
131 return 0;
132 }
133 }
134

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26