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: Mesh */ |
18 |
|
|
|
19 |
|
|
/**************************************************************/ |
20 |
|
|
|
21 |
jgs |
150 |
/* Author: gross@access.edu.au */ |
22 |
|
|
/* Version: $Id$ */ |
23 |
jgs |
82 |
|
24 |
|
|
/**************************************************************/ |
25 |
|
|
|
26 |
|
|
#include "Mesh.h" |
27 |
|
|
|
28 |
|
|
/**************************************************************/ |
29 |
|
|
|
30 |
|
|
/* allocates a Mesh with name name for elements of type id using an integration order. If order is negative, */ |
31 |
|
|
/* the most appropriate order is selected indepently. */ |
32 |
|
|
|
33 |
|
|
extern Finley_RefElementInfo Finley_RefElement_InfoList[]; |
34 |
|
|
|
35 |
jgs |
123 |
Finley_Mesh* Finley_Mesh_alloc(char* name,dim_t numDim, index_t order) { |
36 |
jgs |
82 |
Finley_Mesh *out; |
37 |
|
|
|
38 |
|
|
/* allocate the return value */ |
39 |
|
|
|
40 |
jgs |
102 |
out=MEMALLOC(1,Finley_Mesh); |
41 |
jgs |
82 |
if (Finley_checkPtr(out)) return NULL; |
42 |
|
|
out->Name=NULL; |
43 |
|
|
out->Nodes=NULL; |
44 |
|
|
out->Elements=NULL; |
45 |
|
|
out->FaceElements=NULL; |
46 |
|
|
out->Points=NULL; |
47 |
|
|
out->ContactElements=NULL; |
48 |
|
|
out->reference_counter=0; |
49 |
jgs |
102 |
|
50 |
|
|
out->FullFullPattern=NULL; |
51 |
|
|
out->FullReducedPattern=NULL; |
52 |
|
|
out->ReducedFullPattern=NULL; |
53 |
|
|
out->ReducedReducedPattern=NULL; |
54 |
jgs |
82 |
|
55 |
|
|
/* copy name: */ |
56 |
|
|
|
57 |
jgs |
102 |
out->Name=MEMALLOC(strlen(name)+1,char); |
58 |
jgs |
82 |
if (Finley_checkPtr(out->Name)) { |
59 |
|
|
Finley_Mesh_dealloc(out); |
60 |
|
|
return NULL; |
61 |
|
|
} |
62 |
|
|
strcpy(out->Name,name); |
63 |
|
|
|
64 |
|
|
/* allocate node table: */ |
65 |
|
|
|
66 |
|
|
out->Nodes=Finley_NodeFile_alloc(numDim); |
67 |
jgs |
150 |
if (! Finley_noError()) { |
68 |
jgs |
82 |
Finley_Mesh_dealloc(out); |
69 |
|
|
return NULL; |
70 |
|
|
} |
71 |
|
|
out->order=order; |
72 |
|
|
out->Elements=NULL; |
73 |
|
|
out->FaceElements=NULL; |
74 |
|
|
out->Points=NULL; |
75 |
|
|
out->ContactElements=NULL; |
76 |
|
|
out->reference_counter++; |
77 |
|
|
return out; |
78 |
|
|
} |
79 |
|
|
|
80 |
jgs |
102 |
/* returns a reference to Finley_Mesh in */ |
81 |
|
|
|
82 |
|
|
Finley_Mesh* Finley_Mesh_reference(Finley_Mesh* in) { |
83 |
|
|
if (in!=NULL) ++(in->reference_counter); |
84 |
|
|
return in; |
85 |
|
|
} |
86 |
|
|
|
87 |
jgs |
82 |
/* deallocates a mesh: */ |
88 |
|
|
|
89 |
|
|
void Finley_Mesh_dealloc(Finley_Mesh* in) { |
90 |
|
|
if (in!=NULL) { |
91 |
|
|
in->reference_counter--; |
92 |
|
|
if (in->reference_counter<1) { |
93 |
|
|
#ifdef Finley_TRACE |
94 |
|
|
if (in->Name!=NULL) { |
95 |
|
|
printf("Finley_Mesh_dealloc: mesh %s is deallocated.\n",in->Name); |
96 |
|
|
} else { |
97 |
|
|
printf("Finley_Mesh_dealloc\n"); |
98 |
|
|
} |
99 |
|
|
#endif |
100 |
|
|
MEMFREE(in->Name); |
101 |
|
|
Finley_NodeFile_dealloc(in->Nodes); |
102 |
|
|
Finley_ElementFile_dealloc(in->Elements); |
103 |
|
|
Finley_ElementFile_dealloc(in->FaceElements); |
104 |
|
|
Finley_ElementFile_dealloc(in->ContactElements); |
105 |
|
|
Finley_ElementFile_dealloc(in->Points); |
106 |
jgs |
150 |
Paso_SystemMatrixPattern_dealloc(in->FullFullPattern); |
107 |
|
|
Paso_SystemMatrixPattern_dealloc(in->FullReducedPattern); |
108 |
|
|
Paso_SystemMatrixPattern_dealloc(in->ReducedFullPattern); |
109 |
|
|
Paso_SystemMatrixPattern_dealloc(in->ReducedReducedPattern); |
110 |
jgs |
82 |
MEMFREE(in); |
111 |
|
|
} |
112 |
|
|
} |
113 |
|
|
} |
114 |
|
|
|
115 |
|
|
/**************************************************************/ |
116 |
|
|
|
117 |
|
|
/* returns the spatial dimension of the mesh: */ |
118 |
|
|
|
119 |
jgs |
123 |
dim_t Finley_Mesh_getDim(Finley_Mesh *in) { |
120 |
jgs |
82 |
return in->Nodes->numDim; |
121 |
|
|
} |
122 |
|
|
|
123 |
|
|
/**************************************************************/ |
124 |
|
|
|
125 |
|
|
/* returns the number of nodes in the mesh: */ |
126 |
|
|
|
127 |
jgs |
123 |
dim_t Finley_Mesh_getNumNodes(Finley_Mesh *in) { |
128 |
jgs |
82 |
return in->Nodes->numNodes; |
129 |
|
|
} |
130 |
|
|
/**************************************************************/ |
131 |
|
|
|
132 |
|
|
/* returns the number of degrees of freedom in the mesh: */ |
133 |
|
|
|
134 |
jgs |
123 |
dim_t Finley_Mesh_getNumDegreesOfFreedom(Finley_Mesh *in) { |
135 |
jgs |
82 |
return in->Nodes->numDegreesOfFreedom; |
136 |
|
|
} |
137 |
|
|
/**************************************************************/ |
138 |
|
|
|
139 |
|
|
/* returns the number of degrees of freedom in the mesh: */ |
140 |
|
|
|
141 |
jgs |
123 |
dim_t Finley_Mesh_getReducedNumDegreesOfFreedom(Finley_Mesh *in) { |
142 |
jgs |
82 |
return in->Nodes->reducedNumDegreesOfFreedom; |
143 |
|
|
} |
144 |
|
|
/* |
145 |
|
|
* $Log$ |
146 |
jgs |
150 |
* Revision 1.6 2005/09/15 03:44:22 jgs |
147 |
|
|
* Merge of development branch dev-02 back to main trunk on 2005-09-15 |
148 |
|
|
* |
149 |
|
|
* Revision 1.5.2.1 2005/09/07 06:26:19 gross |
150 |
|
|
* the solver from finley are put into the standalone package paso now |
151 |
|
|
* |
152 |
jgs |
123 |
* Revision 1.5 2005/07/08 04:07:51 jgs |
153 |
|
|
* Merge of development branch back to main trunk on 2005-07-08 |
154 |
|
|
* |
155 |
jgs |
102 |
* Revision 1.4 2004/12/15 07:08:32 jgs |
156 |
jgs |
97 |
* *** empty log message *** |
157 |
jgs |
123 |
* Revision 1.1.1.1.2.3 2005/06/29 02:34:51 gross |
158 |
|
|
* some changes towards 64 integers in finley |
159 |
jgs |
82 |
* |
160 |
jgs |
123 |
* Revision 1.1.1.1.2.2 2004/11/24 01:37:13 gross |
161 |
|
|
* some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now |
162 |
jgs |
97 |
* |
163 |
jgs |
82 |
* |
164 |
jgs |
123 |
* |
165 |
jgs |
82 |
*/ |