1 |
jgs |
82 |
/* $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,int order){ |
23 |
|
|
extern Finley_RefElementInfo Finley_RefElement_InfoList[]; |
24 |
|
|
int 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 |
jgs |
102 |
out=MEMALLOC(1,Finley_ElementFile); |
36 |
jgs |
82 |
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->numColors=0; |
45 |
|
|
out->order = order; |
46 |
|
|
|
47 |
|
|
/* allocate the reference element: */ |
48 |
|
|
|
49 |
|
|
out->ReferenceElement=Finley_RefElement_alloc(id,NQ); |
50 |
|
|
if (Finley_ErrorCode!=NO_ERROR) { |
51 |
|
|
Finley_ElementFile_dealloc(out); |
52 |
|
|
return NULL; |
53 |
|
|
} |
54 |
|
|
out->LinearReferenceElement=Finley_RefElement_alloc(Finley_RefElement_InfoList[id].LinearTypeId,NQ); |
55 |
|
|
if (Finley_ErrorCode!=NO_ERROR) { |
56 |
|
|
Finley_ElementFile_dealloc(out); |
57 |
|
|
return NULL; |
58 |
|
|
} |
59 |
|
|
return out; |
60 |
|
|
} |
61 |
|
|
|
62 |
|
|
/* deallocates an element file: */ |
63 |
|
|
|
64 |
|
|
void Finley_ElementFile_dealloc(Finley_ElementFile* in) { |
65 |
|
|
if (in!=NULL) { |
66 |
|
|
#ifdef Finley_TRACE |
67 |
|
|
if (in->ReferenceElement!=NULL) printf("element file for %s is deallocated.\n",in->ReferenceElement->Type->Name); |
68 |
|
|
#endif |
69 |
|
|
Finley_RefElement_dealloc(in->ReferenceElement); |
70 |
|
|
Finley_RefElement_dealloc(in->LinearReferenceElement); |
71 |
|
|
Finley_ElementFile_deallocTable(in); |
72 |
|
|
MEMFREE(in); |
73 |
|
|
} |
74 |
|
|
} |
75 |
|
|
/* |
76 |
|
|
* $Log$ |
77 |
jgs |
102 |
* Revision 1.4 2004/12/15 07:08:32 jgs |
78 |
jgs |
97 |
* *** empty log message *** |
79 |
jgs |
82 |
* |
80 |
jgs |
97 |
* |
81 |
jgs |
82 |
* |
82 |
|
|
*/ |