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

Annotation of /trunk/finley/src/ElementFile.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1062 - (hide annotations)
Mon Mar 26 06:17:53 2007 UTC (12 years, 6 months ago) by gross
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 jgs 150 /*
2 elspeth 616 ************************************************************
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 jgs 150 */
12    
13 jgs 82 /**************************************************************/
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 bcumming 730 #ifndef PASO_MPI
32 gross 1062 Finley_ElementFile* Finley_ElementFile_alloc(ElementTypeId id, index_t order, index_t reduced_order)
33 bcumming 730 #else
34 gross 1062 Finley_ElementFile* Finley_ElementFile_alloc(ElementTypeId id, index_t order, index_t reduced_order, Paso_MPIInfo *MPIInfo)
35 bcumming 730 #endif
36     {
37 jgs 82 extern Finley_RefElementInfo Finley_RefElement_InfoList[];
38 gross 1062 dim_t NQ, reduced_NQ;
39 jgs 82 Finley_ElementFile *out;
40    
41     /* get the number of quadrature nodes needed to achieve integration order order: */
42    
43 gross 1062 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 jgs 82 NQ= Finley_RefElement_InfoList[id].getNumQuadNodes(order);
46 gross 1062 reduced_NQ= Finley_RefElement_InfoList[id].getNumQuadNodes(reduced_order);
47 jgs 150 if (! Finley_noError()) return NULL;
48 jgs 82
49     /* allocate the return value */
50    
51 jgs 102 out=MEMALLOC(1,Finley_ElementFile);
52 jgs 82 if (Finley_checkPtr(out)) return NULL;
53 gross 1062 out->order = order;
54     out->reduced_order = reduced_order;
55 jgs 82 out->ReferenceElement=NULL;
56     out->LinearReferenceElement=NULL;
57 gross 1062 out->ReferenceElementReducedOrder=NULL;
58     out->LinearReferenceElementReducedOrder=NULL;
59 gross 964 out->isPrepared=FINLEY_UNKNOWN;
60 jgs 82 out->numElements=0;
61     out->Id=NULL;
62     out->Nodes=NULL;
63     out->Tag=NULL;
64     out->Color=NULL;
65 jgs 123 out->minColor=0;
66     out->maxColor=-1;
67 gross 777 out->jacobeans=NULL;
68     out->jacobeans_reducedQ=NULL;
69     out->jacobeans_reducedS=NULL;
70     out->jacobeans_reducedS_reducedQ=NULL;
71 jgs 82
72 bcumming 730 #ifdef PASO_MPI
73 bcumming 782 out->Dom=NULL;
74 bcumming 730 out->MPIInfo = Paso_MPIInfo_getReference( MPIInfo );
75     out->elementDistribution = Finley_ElementDistribution_alloc( MPIInfo );
76     #endif
77 gross 532
78 jgs 82 /* allocate the reference element: */
79    
80     out->ReferenceElement=Finley_RefElement_alloc(id,NQ);
81 gross 777 out->jacobeans=Finley_ElementFile_Jacobeans_alloc(out->ReferenceElement);
82 gross 1062 out->ReferenceElementReducedOrder=Finley_RefElement_alloc(id,reduced_NQ);
83     out->jacobeans_reducedQ=Finley_ElementFile_Jacobeans_alloc(out->ReferenceElementReducedOrder);
84 gross 777
85 jgs 82 out->LinearReferenceElement=Finley_RefElement_alloc(Finley_RefElement_InfoList[id].LinearTypeId,NQ);
86 gross 777 out->jacobeans_reducedS=Finley_ElementFile_Jacobeans_alloc(out->LinearReferenceElement);
87 gross 1062 out->LinearReferenceElementReducedOrder=Finley_RefElement_alloc(Finley_RefElement_InfoList[id].LinearTypeId,reduced_NQ);
88     out->jacobeans_reducedS_reducedQ=Finley_ElementFile_Jacobeans_alloc(out->LinearReferenceElementReducedOrder);
89 jgs 150 if (! Finley_noError()) {
90 jgs 82 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 gross 1062 Finley_RefElement_dealloc(in->ReferenceElementReducedOrder);
105 jgs 82 Finley_RefElement_dealloc(in->LinearReferenceElement);
106 gross 1062 Finley_RefElement_dealloc(in->LinearReferenceElementReducedOrder);
107 jgs 82 Finley_ElementFile_deallocTable(in);
108 gross 776 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 bcumming 730 #ifdef PASO_MPI
113 bcumming 782 MEMFREE(in->Dom);
114 bcumming 730 Paso_MPIInfo_dealloc( in->MPIInfo );
115     Finley_ElementDistribution_dealloc( in->elementDistribution );
116     #endif
117 jgs 82 MEMFREE(in);
118     }
119     }
120     /*
121     * $Log$
122 jgs 150 * 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 jgs 123 * 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 jgs 102 * Revision 1.4 2004/12/15 07:08:32 jgs
132 jgs 97 * *** empty log message ***
133 jgs 123 * Revision 1.1.1.1.2.2 2005/06/29 02:34:49 gross
134     * some changes towards 64 integers in finley
135 jgs 82 *
136 jgs 123 * 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 jgs 97 *
139 jgs 82 *
140 jgs 123 *
141 jgs 82 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26