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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 123 - (show annotations)
Fri Jul 8 04:08:13 2005 UTC (14 years, 5 months ago) by jgs
Original Path: trunk/esys2/finley/src/finleyC/ElementFile.c
File MIME type: text/plain
File size: 2742 byte(s)
Merge of development branch back to main trunk on 2005-07-08

1 /* $Id$ */
2 /**************************************************************/
3
4 /* Finley: ElementFile */
5
6 /* allocates an element file to hold elements of type id and with integration order order. */
7 /* use Finley_Mesh_allocElementTable to allocate the element table (Id,Nodes,Tag). */
8
9 /**************************************************************/
10
11 /* Copyrights by ACcESS Australia 2003/04 */
12 /* Author: gross@access.edu.au */
13 /* Version: $Id$ */
14
15 /**************************************************************/
16
17 #include "Finley.h"
18 #include "ElementFile.h"
19
20 /**************************************************************/
21
22 Finley_ElementFile* Finley_ElementFile_alloc(ElementTypeId id,index_t order){
23 extern Finley_RefElementInfo Finley_RefElement_InfoList[];
24 dim_t NQ;
25 Finley_ElementFile *out;
26
27 /* get the number of quadrature nodes needed to achieve integration order order: */
28
29 if (order<0) order=2*Finley_RefElement_InfoList[id].numOrder;
30 NQ= Finley_RefElement_InfoList[id].getNumQuadNodes(order);
31 if (Finley_ErrorCode!=NO_ERROR) return NULL;
32
33 /* allocate the return value */
34
35 out=MEMALLOC(1,Finley_ElementFile);
36 if (Finley_checkPtr(out)) return NULL;
37 out->ReferenceElement=NULL;
38 out->LinearReferenceElement=NULL;
39 out->numElements=0;
40 out->Id=NULL;
41 out->Nodes=NULL;
42 out->Tag=NULL;
43 out->Color=NULL;
44 out->minColor=0;
45 out->maxColor=-1;
46 out->order = order;
47
48 /* allocate the reference element: */
49
50 out->ReferenceElement=Finley_RefElement_alloc(id,NQ);
51 if (Finley_ErrorCode!=NO_ERROR) {
52 Finley_ElementFile_dealloc(out);
53 return NULL;
54 }
55 out->LinearReferenceElement=Finley_RefElement_alloc(Finley_RefElement_InfoList[id].LinearTypeId,NQ);
56 if (Finley_ErrorCode!=NO_ERROR) {
57 Finley_ElementFile_dealloc(out);
58 return NULL;
59 }
60 return out;
61 }
62
63 /* deallocates an element file: */
64
65 void Finley_ElementFile_dealloc(Finley_ElementFile* in) {
66 if (in!=NULL) {
67 #ifdef Finley_TRACE
68 if (in->ReferenceElement!=NULL) printf("element file for %s is deallocated.\n",in->ReferenceElement->Type->Name);
69 #endif
70 Finley_RefElement_dealloc(in->ReferenceElement);
71 Finley_RefElement_dealloc(in->LinearReferenceElement);
72 Finley_ElementFile_deallocTable(in);
73 MEMFREE(in);
74 }
75 }
76 /*
77 * $Log$
78 * Revision 1.5 2005/07/08 04:07:48 jgs
79 * Merge of development branch back to main trunk on 2005-07-08
80 *
81 * Revision 1.4 2004/12/15 07:08:32 jgs
82 * *** empty log message ***
83 * Revision 1.1.1.1.2.2 2005/06/29 02:34:49 gross
84 * some changes towards 64 integers in finley
85 *
86 * Revision 1.1.1.1.2.1 2004/11/24 01:37:13 gross
87 * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
88 *
89 *
90 *
91 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26