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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/esys2/finley/src/finleyC/Mesh.c revision 97 by jgs, Tue Dec 14 05:39:33 2004 UTC trunk/finley/src/Mesh.c revision 1811 by ksteube, Thu Sep 25 23:11:13 2008 UTC
# Line 1  Line 1 
 /**************************************************************/  
1    
2  /*   Finley: Mesh */  /*******************************************************
3    *
4    * Copyright (c) 2003-2008 by University of Queensland
5    * Earth Systems Science Computational Center (ESSCC)
6    * http://www.uq.edu.au/esscc
7    *
8    * Primary Business: Queensland, Australia
9    * Licensed under the Open Software License version 3.0
10    * http://www.opensource.org/licenses/osl-3.0.php
11    *
12    *******************************************************/
13    
14    
15  /**************************************************************/  /**************************************************************/
16    
17  /*   Copyrights by ACcESS Australia 2003,04 */  /*   Finley: Mesh */
 /*   Author: gross@access.edu.au */  
 /*   Version: $Id$ */  
18    
19  /**************************************************************/  /**************************************************************/
20    
 #include "Finley.h"  
21  #include "Mesh.h"  #include "Mesh.h"
22    
23  /**************************************************************/  /**************************************************************/
# Line 20  Line 27 
27    
28  extern Finley_RefElementInfo Finley_RefElement_InfoList[];  extern Finley_RefElementInfo Finley_RefElement_InfoList[];
29    
30  Finley_Mesh* Finley_Mesh_alloc(char* name,int numDim, int order) {  Finley_Mesh* Finley_Mesh_alloc(char* name,dim_t numDim, index_t order, index_t reduced_order, Paso_MPIInfo *mpi_info)
31    {
32    Finley_Mesh *out;    Finley_Mesh *out;
33        
34    /*  allocate the return value */    /*  allocate the return value */
# Line 33  Finley_Mesh* Finley_Mesh_alloc(char* nam Line 41  Finley_Mesh* Finley_Mesh_alloc(char* nam
41    out->FaceElements=NULL;    out->FaceElements=NULL;
42    out->Points=NULL;          out->Points=NULL;      
43    out->ContactElements=NULL;          out->ContactElements=NULL;      
44      out->TagMap=NULL;      
45    out->reference_counter=0;    out->reference_counter=0;
46    
47    out->FullFullPattern=NULL;    out->FullFullPattern=NULL;
48    out->FullReducedPattern=NULL;    out->FullReducedPattern=NULL;
49    out->ReducedFullPattern=NULL;    out->ReducedFullPattern=NULL;
50    out->ReducedReducedPattern=NULL;    out->ReducedReducedPattern=NULL;
51        out->MPIInfo = Paso_MPIInfo_getReference( mpi_info );
52      if (! Finley_noError()) {
53          Finley_Mesh_free(out);
54          return NULL;
55      }
56    /*   copy name: */    /*   copy name: */
57        
58    out->Name=MEMALLOC(strlen(name)+1,char);    out->Name=MEMALLOC(strlen(name)+1,char);
59    if (Finley_checkPtr(out->Name)) {    if (Finley_checkPtr(out->Name)) {
60        Finley_Mesh_dealloc(out);        Finley_Mesh_free(out);
61        return NULL;        return NULL;
62    }    }
63    strcpy(out->Name,name);    strcpy(out->Name,name);
64        
65    /*   allocate node table: */    /*   allocate node table: */
66        out->Nodes=Finley_NodeFile_alloc( numDim, mpi_info );
67    out->Nodes=Finley_NodeFile_alloc(numDim);    if (! Finley_noError()) {
68    if (Finley_ErrorCode!=NO_ERROR) {        Finley_Mesh_free(out);
       Finley_Mesh_dealloc(out);  
69        return NULL;        return NULL;
70    }    }
71    out->order=order;    out->order=order;
72      out->reduced_order=reduced_order;
73    out->Elements=NULL;    out->Elements=NULL;
74    out->FaceElements=NULL;    out->FaceElements=NULL;
75    out->Points=NULL;    out->Points=NULL;
# Line 72  Finley_Mesh* Finley_Mesh_reference(Finle Line 85  Finley_Mesh* Finley_Mesh_reference(Finle
85       return in;       return in;
86  }  }
87    
88  /*   deallocates a mesh: */  /*   freeates a mesh: */
89    
90  void Finley_Mesh_dealloc(Finley_Mesh* in) {  void Finley_Mesh_free(Finley_Mesh* in) {
91    if (in!=NULL) {    if (in!=NULL) {
92       in->reference_counter--;       in->reference_counter--;
93       if (in->reference_counter<1) {       if (in->reference_counter<1) {
94         #ifdef Finley_TRACE         #ifdef Finley_TRACE
95         if (in->Name!=NULL) {         if (in->Name!=NULL) {
96             printf("Finley_Mesh_dealloc: mesh %s is deallocated.\n",in->Name);             printf("Finley_Mesh_free: mesh %s is freed.\n",in->Name);
97         } else {         } else {
98             printf("Finley_Mesh_dealloc\n");             printf("Finley_Mesh_free\n");
99         }         }
100         #endif         #endif
101         MEMFREE(in->Name);         MEMFREE(in->Name);
102         Finley_NodeFile_dealloc(in->Nodes);         Finley_NodeFile_free(in->Nodes);
103         Finley_ElementFile_dealloc(in->Elements);           Finley_ElementFile_free(in->FaceElements);
104         Finley_ElementFile_dealloc(in->FaceElements);         Finley_ElementFile_free(in->Elements);  
105         Finley_ElementFile_dealloc(in->ContactElements);         Finley_ElementFile_free(in->ContactElements);
106         Finley_ElementFile_dealloc(in->Points);         Finley_ElementFile_free(in->Points);
107         Finley_SystemMatrixPattern_dealloc(in->FullFullPattern);         Finley_TagMap_free(in->TagMap);
108         Finley_SystemMatrixPattern_dealloc(in->FullReducedPattern);         Paso_SystemMatrixPattern_free(in->FullFullPattern);
109         Finley_SystemMatrixPattern_dealloc(in->ReducedFullPattern);         Paso_SystemMatrixPattern_free(in->FullReducedPattern);
110         Finley_SystemMatrixPattern_dealloc(in->ReducedReducedPattern);         Paso_SystemMatrixPattern_free(in->ReducedFullPattern);
111           Paso_SystemMatrixPattern_free(in->ReducedReducedPattern);
112           Paso_MPIInfo_free( in->MPIInfo );
113         MEMFREE(in);               MEMFREE(in);      
114       }       }
115    }    }
# Line 104  void Finley_Mesh_dealloc(Finley_Mesh* in Line 119  void Finley_Mesh_dealloc(Finley_Mesh* in
119    
120  /*  returns the spatial dimension of the mesh: */  /*  returns the spatial dimension of the mesh: */
121    
122  int Finley_Mesh_getDim(Finley_Mesh *in) {  dim_t Finley_Mesh_getDim(Finley_Mesh *in) {
123    return in->Nodes->numDim;    return in->Nodes->numDim;
124  }  }
125    
126  /**************************************************************/  void Finley_Mesh_setElements(Finley_Mesh* self,Finley_ElementFile *elements) {
127        Finley_ElementFile_free(self->Elements);
128  /*  returns the number of nodes in the mesh: */      self->Elements=elements;
129    }
130  int Finley_Mesh_getNumNodes(Finley_Mesh *in) {  void Finley_Mesh_setFaceElements(Finley_Mesh* self,Finley_ElementFile *elements) {
131    return in->Nodes->numNodes;      Finley_ElementFile_free(self->FaceElements);
132        self->FaceElements=elements;
133    }
134    void Finley_Mesh_setContactElements(Finley_Mesh* self,Finley_ElementFile *elements) {
135        Finley_ElementFile_free(self->ContactElements);
136        self->ContactElements=elements;
137    }
138    void Finley_Mesh_setPoints(Finley_Mesh* self,Finley_ElementFile *elements) {
139        Finley_ElementFile_free(self->Points);
140        self->Points=elements;
141  }  }
 /**************************************************************/  
   
 /*  returns the number of degrees of freedom in the mesh: */  
142    
 int Finley_Mesh_getNumDegreesOfFreedom(Finley_Mesh *in) {  
   return in->Nodes->numDegreesOfFreedom;  
 }  
 /**************************************************************/  
   
 /*  returns the number of degrees of freedom in the mesh: */  
   
 int Finley_Mesh_getReducedNumDegreesOfFreedom(Finley_Mesh *in) {  
   return in->Nodes->reducedNumDegreesOfFreedom;  
 }  
 /*  
 * $Log$  
 * Revision 1.2  2004/12/14 05:39:30  jgs  
 * *** empty log message ***  
 *  
 * Revision 1.1.1.1.2.2  2004/11/24 01:37:13  gross  
 * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now  
 *  
 * Revision 1.1.1.1.2.1  2004/11/12 06:58:18  gross  
 * a lot of changes to get the linearPDE class running: most important change is that there is no matrix format exposed to the user anymore. the format is chosen by the Domain according to the solver and symmetry  
 *  
 * Revision 1.1.1.1  2004/10/26 06:53:57  jgs  
 * initial import of project esys2  
 *  
 * Revision 1.1.1.1  2004/06/24 04:00:40  johng  
 * Initial version of eys using boost-python.  
 *  
 *  
 */  

Legend:
Removed from v.97  
changed lines
  Added in v.1811

  ViewVC Help
Powered by ViewVC 1.1.26