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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 616 - (show annotations)
Wed Mar 22 02:46:56 2006 UTC (13 years, 2 months ago) by elspeth
File MIME type: text/plain
File size: 4847 byte(s)
Copyright added to more source files.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26