/[escript]/branches/doubleplusgood/dudley/src/Mesh.cpp
ViewVC logotype

Contents of /branches/doubleplusgood/dudley/src/Mesh.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 730 - (show annotations)
Mon May 15 04:03:49 2006 UTC (12 years, 11 months ago) by bcumming
Original Path: trunk/finley/src/Mesh.c
File MIME type: text/plain
File size: 5330 byte(s)


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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26