/[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 100 - (show annotations)
Wed Dec 15 03:48:48 2004 UTC (14 years, 4 months ago) by jgs
Original Path: trunk/esys2/finley/src/finleyC/Mesh.c
File MIME type: text/plain
File size: 3414 byte(s)
*** empty log message ***

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,int numDim, int order) {
24 Finley_Mesh *out;
25
26 /* allocate the return value */
27
28 out=(Finley_Mesh*)MEMALLOC(sizeof(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 /* copy name: */
39
40 out->Name=(char*)MEMALLOC((strlen(name)+1)*sizeof(char));
41 if (Finley_checkPtr(out->Name)) {
42 Finley_Mesh_dealloc(out);
43 return NULL;
44 }
45 strcpy(out->Name,name);
46
47 /* allocate node table: */
48
49 out->Nodes=Finley_NodeFile_alloc(numDim);
50 if (Finley_ErrorCode!=NO_ERROR) {
51 Finley_Mesh_dealloc(out);
52 return NULL;
53 }
54 out->order=order;
55 out->Elements=NULL;
56 out->FaceElements=NULL;
57 out->Points=NULL;
58 out->ContactElements=NULL;
59 out->reference_counter++;
60 return out;
61 }
62
63 /* deallocates a mesh: */
64
65 void Finley_Mesh_dealloc(Finley_Mesh* in) {
66 if (in!=NULL) {
67 in->reference_counter--;
68 if (in->reference_counter<1) {
69 #ifdef Finley_TRACE
70 if (in->Name!=NULL) {
71 printf("Finley_Mesh_dealloc: mesh %s is deallocated.\n",in->Name);
72 } else {
73 printf("Finley_Mesh_dealloc\n");
74 }
75 #endif
76 MEMFREE(in->Name);
77 Finley_NodeFile_dealloc(in->Nodes);
78 Finley_ElementFile_dealloc(in->Elements);
79 Finley_ElementFile_dealloc(in->FaceElements);
80 Finley_ElementFile_dealloc(in->ContactElements);
81 Finley_ElementFile_dealloc(in->Points);
82 MEMFREE(in);
83 }
84 }
85 }
86
87 /**************************************************************/
88
89 /* returns the spatial dimension of the mesh: */
90
91 int Finley_Mesh_getDim(Finley_Mesh *in) {
92 return in->Nodes->numDim;
93 }
94
95 /**************************************************************/
96
97 /* returns the number of nodes in the mesh: */
98
99 int Finley_Mesh_getNumNodes(Finley_Mesh *in) {
100 return in->Nodes->numNodes;
101 }
102 /**************************************************************/
103
104 /* returns the number of degrees of freedom in the mesh: */
105
106 int Finley_Mesh_getNumDegreesOfFreedom(Finley_Mesh *in) {
107 return in->Nodes->numDegreesOfFreedom;
108 }
109 /**************************************************************/
110
111 /* returns the number of degrees of freedom in the mesh: */
112
113 int Finley_Mesh_getReducedNumDegreesOfFreedom(Finley_Mesh *in) {
114 return in->Nodes->reducedNumDegreesOfFreedom;
115 }
116 /*
117 * $Log$
118 * Revision 1.3 2004/12/15 03:48:45 jgs
119 * *** empty log message ***
120 *
121 * Revision 1.1.1.1 2004/10/26 06:53:57 jgs
122 * initial import of project esys2
123 *
124 * Revision 1.1.1.1 2004/06/24 04:00:40 johng
125 * Initial version of eys using boost-python.
126 *
127 *
128 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26