/[escript]/trunk/finley/src/finleyC/Mesh.c
ViewVC logotype

Contents of /trunk/finley/src/finleyC/Mesh.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/Mesh.c
File MIME type: text/plain
File size: 4135 byte(s)
Merge of development branch back to main trunk on 2005-07-08

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26