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

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

Parent Directory Parent Directory | Revision Log Revision Log


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


1 jgs 150 /*
2 elspeth 616 ************************************************************
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 jgs 150 */
12    
13 jgs 82 /**************************************************************/
14    
15     /* Finley: Mesh */
16    
17     /**************************************************************/
18    
19 jgs 150 /* Author: gross@access.edu.au */
20     /* Version: $Id$ */
21 jgs 82
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 bcumming 730 #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 jgs 82 Finley_Mesh *out;
40    
41     /* allocate the return value */
42    
43 jgs 102 out=MEMALLOC(1,Finley_Mesh);
44 jgs 82 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 jgs 102
53     out->FullFullPattern=NULL;
54     out->FullReducedPattern=NULL;
55     out->ReducedFullPattern=NULL;
56     out->ReducedReducedPattern=NULL;
57 bcumming 730
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 jgs 82 /* copy name: */
69    
70 jgs 102 out->Name=MEMALLOC(strlen(name)+1,char);
71 jgs 82 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 bcumming 730 #ifdef PASO_MPI
79     out->Nodes=Finley_NodeFile_alloc( numDim, mpi_info );
80     #else
81 jgs 82 out->Nodes=Finley_NodeFile_alloc(numDim);
82 bcumming 730 #endif
83 jgs 150 if (! Finley_noError()) {
84 jgs 82 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 jgs 102 /* 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 jgs 82 /* 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 jgs 150 Paso_SystemMatrixPattern_dealloc(in->FullFullPattern);
123     Paso_SystemMatrixPattern_dealloc(in->FullReducedPattern);
124     Paso_SystemMatrixPattern_dealloc(in->ReducedFullPattern);
125     Paso_SystemMatrixPattern_dealloc(in->ReducedReducedPattern);
126 bcumming 730 #ifdef PASO_MPI
127     Paso_MPIInfo_dealloc( in->MPIInfo );
128     #endif
129 jgs 82 MEMFREE(in);
130     }
131     }
132     }
133    
134     /**************************************************************/
135    
136     /* returns the spatial dimension of the mesh: */
137    
138 jgs 123 dim_t Finley_Mesh_getDim(Finley_Mesh *in) {
139 jgs 82 return in->Nodes->numDim;
140     }
141    
142     /**************************************************************/
143    
144     /* returns the number of nodes in the mesh: */
145    
146 jgs 123 dim_t Finley_Mesh_getNumNodes(Finley_Mesh *in) {
147 jgs 82 return in->Nodes->numNodes;
148     }
149     /**************************************************************/
150    
151     /* returns the number of degrees of freedom in the mesh: */
152    
153 jgs 123 dim_t Finley_Mesh_getNumDegreesOfFreedom(Finley_Mesh *in) {
154 jgs 82 return in->Nodes->numDegreesOfFreedom;
155     }
156     /**************************************************************/
157    
158     /* returns the number of degrees of freedom in the mesh: */
159    
160 jgs 123 dim_t Finley_Mesh_getReducedNumDegreesOfFreedom(Finley_Mesh *in) {
161 jgs 82 return in->Nodes->reducedNumDegreesOfFreedom;
162     }
163     /*
164     * $Log$
165 jgs 150 * 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 jgs 123 * 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 jgs 102 * Revision 1.4 2004/12/15 07:08:32 jgs
175 jgs 97 * *** empty log message ***
176 jgs 123 * Revision 1.1.1.1.2.3 2005/06/29 02:34:51 gross
177     * some changes towards 64 integers in finley
178 jgs 82 *
179 jgs 123 * 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 jgs 97 *
182 jgs 82 *
183 jgs 123 *
184 jgs 82 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26