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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 616 - (hide annotations)
Wed Mar 22 02:46:56 2006 UTC (13 years, 7 months ago) by elspeth
Original Path: trunk/finley/src/Mesh.c
File MIME type: text/plain
File size: 4847 byte(s)
Copyright added to more source files.

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 jgs 123 Finley_Mesh* Finley_Mesh_alloc(char* name,dim_t numDim, index_t order) {
34 jgs 82 Finley_Mesh *out;
35    
36     /* allocate the return value */
37    
38 jgs 102 out=MEMALLOC(1,Finley_Mesh);
39 jgs 82 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 jgs 102
48     out->FullFullPattern=NULL;
49     out->FullReducedPattern=NULL;
50     out->ReducedFullPattern=NULL;
51     out->ReducedReducedPattern=NULL;
52 jgs 82
53     /* copy name: */
54    
55 jgs 102 out->Name=MEMALLOC(strlen(name)+1,char);
56 jgs 82 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 jgs 150 if (! Finley_noError()) {
66 jgs 82 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 jgs 102 /* 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 jgs 82 /* 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 jgs 150 Paso_SystemMatrixPattern_dealloc(in->FullFullPattern);
105     Paso_SystemMatrixPattern_dealloc(in->FullReducedPattern);
106     Paso_SystemMatrixPattern_dealloc(in->ReducedFullPattern);
107     Paso_SystemMatrixPattern_dealloc(in->ReducedReducedPattern);
108 jgs 82 MEMFREE(in);
109     }
110     }
111     }
112    
113     /**************************************************************/
114    
115     /* returns the spatial dimension of the mesh: */
116    
117 jgs 123 dim_t Finley_Mesh_getDim(Finley_Mesh *in) {
118 jgs 82 return in->Nodes->numDim;
119     }
120    
121     /**************************************************************/
122    
123     /* returns the number of nodes in the mesh: */
124    
125 jgs 123 dim_t Finley_Mesh_getNumNodes(Finley_Mesh *in) {
126 jgs 82 return in->Nodes->numNodes;
127     }
128     /**************************************************************/
129    
130     /* returns the number of degrees of freedom in the mesh: */
131    
132 jgs 123 dim_t Finley_Mesh_getNumDegreesOfFreedom(Finley_Mesh *in) {
133 jgs 82 return in->Nodes->numDegreesOfFreedom;
134     }
135     /**************************************************************/
136    
137     /* returns the number of degrees of freedom in the mesh: */
138    
139 jgs 123 dim_t Finley_Mesh_getReducedNumDegreesOfFreedom(Finley_Mesh *in) {
140 jgs 82 return in->Nodes->reducedNumDegreesOfFreedom;
141     }
142     /*
143     * $Log$
144 jgs 150 * 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 jgs 123 * 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 jgs 102 * Revision 1.4 2004/12/15 07:08:32 jgs
154 jgs 97 * *** empty log message ***
155 jgs 123 * Revision 1.1.1.1.2.3 2005/06/29 02:34:51 gross
156     * some changes towards 64 integers in finley
157 jgs 82 *
158 jgs 123 * 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 jgs 97 *
161 jgs 82 *
162 jgs 123 *
163 jgs 82 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26