/[escript]/branches/domexper/finley/src/ElementFile.c
ViewVC logotype

Contents of /branches/domexper/finley/src/ElementFile.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1062 - (show annotations)
Mon Mar 26 06:17:53 2007 UTC (12 years, 8 months ago) by gross
Original Path: trunk/finley/src/ElementFile.c
File MIME type: text/plain
File size: 5345 byte(s)
reduced integration schemes are implemented now for grad, integrate, etc. Tests still to be added.
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). */
19
20 /**************************************************************/
21
22 /* Author: gross@access.edu.au */
23 /* Version: $Id$ */
24
25 /**************************************************************/
26
27 #include "ElementFile.h"
28
29 /**************************************************************/
30
31 #ifndef PASO_MPI
32 Finley_ElementFile* Finley_ElementFile_alloc(ElementTypeId id, index_t order, index_t reduced_order)
33 #else
34 Finley_ElementFile* Finley_ElementFile_alloc(ElementTypeId id, index_t order, index_t reduced_order, Paso_MPIInfo *MPIInfo)
35 #endif
36 {
37 extern Finley_RefElementInfo Finley_RefElement_InfoList[];
38 dim_t NQ, reduced_NQ;
39 Finley_ElementFile *out;
40
41 /* get the number of quadrature nodes needed to achieve integration order order: */
42
43 if (order<0) order=MAX(2*Finley_RefElement_InfoList[id].numOrder,0);
44 if (reduced_order<0) reduced_order=MAX(2*(Finley_RefElement_InfoList[id].numOrder-1),0);
45 NQ= Finley_RefElement_InfoList[id].getNumQuadNodes(order);
46 reduced_NQ= Finley_RefElement_InfoList[id].getNumQuadNodes(reduced_order);
47 if (! Finley_noError()) return NULL;
48
49 /* allocate the return value */
50
51 out=MEMALLOC(1,Finley_ElementFile);
52 if (Finley_checkPtr(out)) return NULL;
53 out->order = order;
54 out->reduced_order = reduced_order;
55 out->ReferenceElement=NULL;
56 out->LinearReferenceElement=NULL;
57 out->ReferenceElementReducedOrder=NULL;
58 out->LinearReferenceElementReducedOrder=NULL;
59 out->isPrepared=FINLEY_UNKNOWN;
60 out->numElements=0;
61 out->Id=NULL;
62 out->Nodes=NULL;
63 out->Tag=NULL;
64 out->Color=NULL;
65 out->minColor=0;
66 out->maxColor=-1;
67 out->jacobeans=NULL;
68 out->jacobeans_reducedQ=NULL;
69 out->jacobeans_reducedS=NULL;
70 out->jacobeans_reducedS_reducedQ=NULL;
71
72 #ifdef PASO_MPI
73 out->Dom=NULL;
74 out->MPIInfo = Paso_MPIInfo_getReference( MPIInfo );
75 out->elementDistribution = Finley_ElementDistribution_alloc( MPIInfo );
76 #endif
77
78 /* allocate the reference element: */
79
80 out->ReferenceElement=Finley_RefElement_alloc(id,NQ);
81 out->jacobeans=Finley_ElementFile_Jacobeans_alloc(out->ReferenceElement);
82 out->ReferenceElementReducedOrder=Finley_RefElement_alloc(id,reduced_NQ);
83 out->jacobeans_reducedQ=Finley_ElementFile_Jacobeans_alloc(out->ReferenceElementReducedOrder);
84
85 out->LinearReferenceElement=Finley_RefElement_alloc(Finley_RefElement_InfoList[id].LinearTypeId,NQ);
86 out->jacobeans_reducedS=Finley_ElementFile_Jacobeans_alloc(out->LinearReferenceElement);
87 out->LinearReferenceElementReducedOrder=Finley_RefElement_alloc(Finley_RefElement_InfoList[id].LinearTypeId,reduced_NQ);
88 out->jacobeans_reducedS_reducedQ=Finley_ElementFile_Jacobeans_alloc(out->LinearReferenceElementReducedOrder);
89 if (! Finley_noError()) {
90 Finley_ElementFile_dealloc(out);
91 return NULL;
92 }
93 return out;
94 }
95
96 /* deallocates an element file: */
97
98 void Finley_ElementFile_dealloc(Finley_ElementFile* in) {
99 if (in!=NULL) {
100 #ifdef Finley_TRACE
101 if (in->ReferenceElement!=NULL) printf("element file for %s is deallocated.\n",in->ReferenceElement->Type->Name);
102 #endif
103 Finley_RefElement_dealloc(in->ReferenceElement);
104 Finley_RefElement_dealloc(in->ReferenceElementReducedOrder);
105 Finley_RefElement_dealloc(in->LinearReferenceElement);
106 Finley_RefElement_dealloc(in->LinearReferenceElementReducedOrder);
107 Finley_ElementFile_deallocTable(in);
108 Finley_ElementFile_Jacobeans_dealloc(in->jacobeans);
109 Finley_ElementFile_Jacobeans_dealloc(in->jacobeans_reducedS);
110 Finley_ElementFile_Jacobeans_dealloc(in->jacobeans_reducedQ);
111 Finley_ElementFile_Jacobeans_dealloc(in->jacobeans_reducedS_reducedQ);
112 #ifdef PASO_MPI
113 MEMFREE(in->Dom);
114 Paso_MPIInfo_dealloc( in->MPIInfo );
115 Finley_ElementDistribution_dealloc( in->elementDistribution );
116 #endif
117 MEMFREE(in);
118 }
119 }
120 /*
121 * $Log$
122 * Revision 1.6 2005/09/15 03:44:21 jgs
123 * Merge of development branch dev-02 back to main trunk on 2005-09-15
124 *
125 * Revision 1.5.2.1 2005/09/07 06:26:18 gross
126 * the solver from finley are put into the standalone package paso now
127 *
128 * Revision 1.5 2005/07/08 04:07:48 jgs
129 * Merge of development branch back to main trunk on 2005-07-08
130 *
131 * Revision 1.4 2004/12/15 07:08:32 jgs
132 * *** empty log message ***
133 * Revision 1.1.1.1.2.2 2005/06/29 02:34:49 gross
134 * some changes towards 64 integers in finley
135 *
136 * Revision 1.1.1.1.2.1 2004/11/24 01:37:13 gross
137 * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
138 *
139 *
140 *
141 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26