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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 730 - (show annotations)
Mon May 15 04:03:49 2006 UTC (13 years, 7 months ago) by bcumming
File MIME type: text/plain
File size: 4324 byte(s)


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)
33 #else
34 Finley_ElementFile* Finley_ElementFile_alloc(ElementTypeId id,index_t order, Paso_MPIInfo *MPIInfo)
35 #endif
36 {
37 extern Finley_RefElementInfo Finley_RefElement_InfoList[];
38 dim_t 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=2*Finley_RefElement_InfoList[id].numOrder;
44 NQ= Finley_RefElement_InfoList[id].getNumQuadNodes(order);
45 if (! Finley_noError()) return NULL;
46
47 /* allocate the return value */
48
49 out=MEMALLOC(1,Finley_ElementFile);
50 if (Finley_checkPtr(out)) return NULL;
51 out->ReferenceElement=NULL;
52 out->LinearReferenceElement=NULL;
53 out->numElements=0;
54 out->Id=NULL;
55 out->Nodes=NULL;
56 out->Tag=NULL;
57 out->Color=NULL;
58 out->minColor=0;
59 out->maxColor=-1;
60 out->order = order;
61 out->volume_is_valid=FALSE;
62 out->volume=NULL;
63 out->DvDV=NULL;
64 out->DSDV_is_valid=FALSE;
65 out->DSDV=NULL;
66 out->DSLinearDV_is_valid=FALSE;
67 out->DSLinearDV=NULL;
68 out->X_is_valid=FALSE;
69 out->X=NULL;
70
71 #ifdef PASO_MPI
72 out->MPIInfo = Paso_MPIInfo_getReference( MPIInfo );
73 out->elementDistribution = Finley_ElementDistribution_alloc( MPIInfo );
74 #endif
75
76 /* allocate the reference element: */
77
78 out->ReferenceElement=Finley_RefElement_alloc(id,NQ);
79 if (! Finley_noError()) {
80 Finley_ElementFile_dealloc(out);
81 return NULL;
82 }
83 out->LinearReferenceElement=Finley_RefElement_alloc(Finley_RefElement_InfoList[id].LinearTypeId,NQ);
84 if (! Finley_noError()) {
85 Finley_ElementFile_dealloc(out);
86 return NULL;
87 }
88 return out;
89 }
90
91 /* deallocates an element file: */
92
93 void Finley_ElementFile_dealloc(Finley_ElementFile* in) {
94 if (in!=NULL) {
95 #ifdef Finley_TRACE
96 if (in->ReferenceElement!=NULL) printf("element file for %s is deallocated.\n",in->ReferenceElement->Type->Name);
97 #endif
98 Finley_RefElement_dealloc(in->ReferenceElement);
99 Finley_RefElement_dealloc(in->LinearReferenceElement);
100 Finley_ElementFile_deallocTable(in);
101 MEMFREE(in->volume);
102 MEMFREE(in->DvDV);
103 MEMFREE(in->DSDV);
104 MEMFREE(in->DSLinearDV);
105 MEMFREE(in->X);
106 #ifdef PASO_MPI
107 Paso_MPIInfo_dealloc( in->MPIInfo );
108 Finley_ElementDistribution_dealloc( in->elementDistribution );
109 #endif
110 MEMFREE(in);
111 }
112 }
113 /*
114 * $Log$
115 * Revision 1.6 2005/09/15 03:44:21 jgs
116 * Merge of development branch dev-02 back to main trunk on 2005-09-15
117 *
118 * Revision 1.5.2.1 2005/09/07 06:26:18 gross
119 * the solver from finley are put into the standalone package paso now
120 *
121 * Revision 1.5 2005/07/08 04:07:48 jgs
122 * Merge of development branch back to main trunk on 2005-07-08
123 *
124 * Revision 1.4 2004/12/15 07:08:32 jgs
125 * *** empty log message ***
126 * Revision 1.1.1.1.2.2 2005/06/29 02:34:49 gross
127 * some changes towards 64 integers in finley
128 *
129 * Revision 1.1.1.1.2.1 2004/11/24 01:37:13 gross
130 * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
131 *
132 *
133 *
134 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26