1 |
jgs |
150 |
/* |
2 |
|
|
****************************************************************************** |
3 |
|
|
* * |
4 |
|
|
* COPYRIGHT ACcESS 2003,2004,2005 - All Rights Reserved * |
5 |
|
|
* * |
6 |
|
|
* This software is the property of ACcESS. No part of this code * |
7 |
|
|
* may be copied in any form or by any means without the expressed written * |
8 |
|
|
* consent of ACcESS. Copying, use or modification of this software * |
9 |
|
|
* by any unauthorised person is illegal unless that person has a software * |
10 |
|
|
* license agreement with ACcESS. * |
11 |
|
|
* * |
12 |
|
|
****************************************************************************** |
13 |
|
|
*/ |
14 |
|
|
|
15 |
jgs |
82 |
/**************************************************************/ |
16 |
|
|
|
17 |
|
|
/* Finley: ElementFile */ |
18 |
|
|
|
19 |
|
|
/* allocates an element file to hold elements of type id and with integration order order. */ |
20 |
|
|
/* use Finley_Mesh_allocElementTable to allocate the element table (Id,Nodes,Tag). */ |
21 |
|
|
|
22 |
|
|
/**************************************************************/ |
23 |
|
|
|
24 |
|
|
/* Author: gross@access.edu.au */ |
25 |
|
|
/* Version: $Id$ */ |
26 |
|
|
|
27 |
|
|
/**************************************************************/ |
28 |
|
|
|
29 |
|
|
#include "ElementFile.h" |
30 |
|
|
|
31 |
|
|
/**************************************************************/ |
32 |
|
|
|
33 |
jgs |
123 |
Finley_ElementFile* Finley_ElementFile_alloc(ElementTypeId id,index_t order){ |
34 |
jgs |
82 |
extern Finley_RefElementInfo Finley_RefElement_InfoList[]; |
35 |
jgs |
123 |
dim_t NQ; |
36 |
jgs |
82 |
Finley_ElementFile *out; |
37 |
|
|
|
38 |
|
|
/* get the number of quadrature nodes needed to achieve integration order order: */ |
39 |
|
|
|
40 |
|
|
if (order<0) order=2*Finley_RefElement_InfoList[id].numOrder; |
41 |
|
|
NQ= Finley_RefElement_InfoList[id].getNumQuadNodes(order); |
42 |
jgs |
150 |
if (! Finley_noError()) return NULL; |
43 |
jgs |
82 |
|
44 |
|
|
/* allocate the return value */ |
45 |
|
|
|
46 |
jgs |
102 |
out=MEMALLOC(1,Finley_ElementFile); |
47 |
jgs |
82 |
if (Finley_checkPtr(out)) return NULL; |
48 |
|
|
out->ReferenceElement=NULL; |
49 |
|
|
out->LinearReferenceElement=NULL; |
50 |
|
|
out->numElements=0; |
51 |
|
|
out->Id=NULL; |
52 |
|
|
out->Nodes=NULL; |
53 |
|
|
out->Tag=NULL; |
54 |
|
|
out->Color=NULL; |
55 |
jgs |
123 |
out->minColor=0; |
56 |
|
|
out->maxColor=-1; |
57 |
jgs |
82 |
out->order = order; |
58 |
gross |
532 |
out->volume_is_valid=FALSE; |
59 |
|
|
out->volume=NULL; |
60 |
|
|
out->DvDV=NULL; |
61 |
|
|
out->DSDV_is_valid=FALSE; |
62 |
|
|
out->DSDV=NULL; |
63 |
|
|
out->DSLinearDV_is_valid=FALSE; |
64 |
|
|
out->DSLinearDV=NULL; |
65 |
|
|
out->X_is_valid=FALSE; |
66 |
|
|
out->X=NULL; |
67 |
jgs |
82 |
|
68 |
gross |
532 |
|
69 |
jgs |
82 |
/* allocate the reference element: */ |
70 |
|
|
|
71 |
|
|
out->ReferenceElement=Finley_RefElement_alloc(id,NQ); |
72 |
jgs |
150 |
if (! Finley_noError()) { |
73 |
jgs |
82 |
Finley_ElementFile_dealloc(out); |
74 |
|
|
return NULL; |
75 |
|
|
} |
76 |
|
|
out->LinearReferenceElement=Finley_RefElement_alloc(Finley_RefElement_InfoList[id].LinearTypeId,NQ); |
77 |
jgs |
150 |
if (! Finley_noError()) { |
78 |
jgs |
82 |
Finley_ElementFile_dealloc(out); |
79 |
|
|
return NULL; |
80 |
|
|
} |
81 |
|
|
return out; |
82 |
|
|
} |
83 |
|
|
|
84 |
|
|
/* deallocates an element file: */ |
85 |
|
|
|
86 |
|
|
void Finley_ElementFile_dealloc(Finley_ElementFile* in) { |
87 |
|
|
if (in!=NULL) { |
88 |
|
|
#ifdef Finley_TRACE |
89 |
|
|
if (in->ReferenceElement!=NULL) printf("element file for %s is deallocated.\n",in->ReferenceElement->Type->Name); |
90 |
|
|
#endif |
91 |
|
|
Finley_RefElement_dealloc(in->ReferenceElement); |
92 |
|
|
Finley_RefElement_dealloc(in->LinearReferenceElement); |
93 |
|
|
Finley_ElementFile_deallocTable(in); |
94 |
gross |
532 |
MEMFREE(in->volume); |
95 |
|
|
MEMFREE(in->DvDV); |
96 |
|
|
MEMFREE(in->DSDV); |
97 |
|
|
MEMFREE(in->DSLinearDV); |
98 |
|
|
MEMFREE(in->X); |
99 |
jgs |
82 |
MEMFREE(in); |
100 |
|
|
} |
101 |
|
|
} |
102 |
|
|
/* |
103 |
|
|
* $Log$ |
104 |
jgs |
150 |
* Revision 1.6 2005/09/15 03:44:21 jgs |
105 |
|
|
* Merge of development branch dev-02 back to main trunk on 2005-09-15 |
106 |
|
|
* |
107 |
|
|
* Revision 1.5.2.1 2005/09/07 06:26:18 gross |
108 |
|
|
* the solver from finley are put into the standalone package paso now |
109 |
|
|
* |
110 |
jgs |
123 |
* Revision 1.5 2005/07/08 04:07:48 jgs |
111 |
|
|
* Merge of development branch back to main trunk on 2005-07-08 |
112 |
|
|
* |
113 |
jgs |
102 |
* Revision 1.4 2004/12/15 07:08:32 jgs |
114 |
jgs |
97 |
* *** empty log message *** |
115 |
jgs |
123 |
* Revision 1.1.1.1.2.2 2005/06/29 02:34:49 gross |
116 |
|
|
* some changes towards 64 integers in finley |
117 |
jgs |
82 |
* |
118 |
jgs |
123 |
* Revision 1.1.1.1.2.1 2004/11/24 01:37:13 gross |
119 |
|
|
* some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now |
120 |
jgs |
97 |
* |
121 |
jgs |
82 |
* |
122 |
jgs |
123 |
* |
123 |
jgs |
82 |
*/ |