/[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

revision 730 by bcumming, Mon May 15 04:03:49 2006 UTC revision 2358 by gross, Wed Apr 1 22:25:24 2009 UTC
# Line 1  Line 1 
1  /*  /*******************************************************
2   ************************************************************  *
3   *          Copyright 2006 by ACcESS MNRF                   *  * Copyright (c) 2003-2008 by University of Queensland
4   *                                                          *  * Earth Systems Science Computational Center (ESSCC)
5   *              http://www.access.edu.au                    *  * http://www.uq.edu.au/esscc
6   *       Primary Business: Queensland, Australia            *  *
7   *  Licensed under the Open Software License version 3.0    *  * Primary Business: Queensland, Australia
8   *     http://www.opensource.org/licenses/osl-3.0.php       *  * Licensed under the Open Software License version 3.0
9   *                                                          *  * http://www.opensource.org/licenses/osl-3.0.php
10   ************************************************************  *
11  */  *******************************************************/
   
 /**************************************************************/  
12    
 /*   Finley: Mesh */  
13    
14  /**************************************************************/  /**************************************************************/
15    
16  /*  Author: gross@access.edu.au */  /*   Finley: Mesh */
 /*  Version: $Id$ */  
17    
18  /**************************************************************/  /**************************************************************/
19    
# Line 30  Line 26 
26    
27  extern Finley_RefElementInfo Finley_RefElement_InfoList[];  extern Finley_RefElementInfo Finley_RefElement_InfoList[];
28    
29  #ifndef PASO_MPI  Finley_Mesh* Finley_Mesh_alloc(char* name,dim_t numDim, index_t order, index_t reduced_order, Paso_MPIInfo *mpi_info)
 Finley_Mesh* Finley_Mesh_alloc(char* name,dim_t numDim, index_t order)  
 #else  
 Finley_Mesh* Finley_Mesh_alloc(char* name,dim_t numDim, index_t order, Paso_MPIInfo *mpi_info)  
 #endif  
30  {  {
31    Finley_Mesh *out;    Finley_Mesh *out;
32        
# Line 48  Finley_Mesh* Finley_Mesh_alloc(char* nam Line 40  Finley_Mesh* Finley_Mesh_alloc(char* nam
40    out->FaceElements=NULL;    out->FaceElements=NULL;
41    out->Points=NULL;          out->Points=NULL;      
42    out->ContactElements=NULL;          out->ContactElements=NULL;      
43      out->TagMap=NULL;      
44    out->reference_counter=0;    out->reference_counter=0;
45    
46    out->FullFullPattern=NULL;    out->FullFullPattern=NULL;
47    out->FullReducedPattern=NULL;    out->FullReducedPattern=NULL;
48    out->ReducedFullPattern=NULL;    out->ReducedFullPattern=NULL;
49    out->ReducedReducedPattern=NULL;    out->ReducedReducedPattern=NULL;
   
 #ifdef PASO_MPI  
   out->MPIInfo = NULL;  
   
   /* get MPI info */  
50    out->MPIInfo = Paso_MPIInfo_getReference( mpi_info );    out->MPIInfo = Paso_MPIInfo_getReference( mpi_info );
51    if (! Finley_noError()) {    if (! Finley_noError()) {
52        Finley_Mesh_dealloc(out);        Finley_Mesh_free(out);
53        return NULL;        return NULL;
54    }    }
 #endif  
55    /*   copy name: */    /*   copy name: */
56        
57    out->Name=MEMALLOC(strlen(name)+1,char);    out->Name=MEMALLOC(strlen(name)+1,char);
58    if (Finley_checkPtr(out->Name)) {    if (Finley_checkPtr(out->Name)) {
59        Finley_Mesh_dealloc(out);        Finley_Mesh_free(out);
60        return NULL;        return NULL;
61    }    }
62    strcpy(out->Name,name);    strcpy(out->Name,name);
63        
64    /*   allocate node table: */    /*   allocate node table: */
 #ifdef PASO_MPI  
65    out->Nodes=Finley_NodeFile_alloc( numDim, mpi_info );    out->Nodes=Finley_NodeFile_alloc( numDim, mpi_info );
 #else  
   out->Nodes=Finley_NodeFile_alloc(numDim);  
 #endif  
66    if (! Finley_noError()) {    if (! Finley_noError()) {
67        Finley_Mesh_dealloc(out);        Finley_Mesh_free(out);
68        return NULL;        return NULL;
69    }    }
70    out->order=order;    out->order=order;
71      out->reduced_order=reduced_order;
72    out->Elements=NULL;    out->Elements=NULL;
73    out->FaceElements=NULL;    out->FaceElements=NULL;
74    out->Points=NULL;    out->Points=NULL;
# Line 100  Finley_Mesh* Finley_Mesh_reference(Finle Line 84  Finley_Mesh* Finley_Mesh_reference(Finle
84       return in;       return in;
85  }  }
86    
87  /*   deallocates a mesh: */  /*   freeates a mesh: */
88    
89  void Finley_Mesh_dealloc(Finley_Mesh* in) {  void Finley_Mesh_free(Finley_Mesh* in) {
90    if (in!=NULL) {    if (in!=NULL) {
91       in->reference_counter--;       in->reference_counter--;
92       if (in->reference_counter<1) {       if (in->reference_counter<1) {
93         #ifdef Finley_TRACE         #ifdef Finley_TRACE
94         if (in->Name!=NULL) {         if (in->Name!=NULL) {
95             printf("Finley_Mesh_dealloc: mesh %s is deallocated.\n",in->Name);             printf("Finley_Mesh_free: mesh %s is freed.\n",in->Name);
96         } else {         } else {
97             printf("Finley_Mesh_dealloc\n");             printf("Finley_Mesh_free\n");
98         }         }
99         #endif         #endif
100         MEMFREE(in->Name);         MEMFREE(in->Name);
101         Finley_NodeFile_dealloc(in->Nodes);         Finley_NodeFile_free(in->Nodes);
102         Finley_ElementFile_dealloc(in->Elements);           Finley_ElementFile_free(in->FaceElements);
103         Finley_ElementFile_dealloc(in->FaceElements);         Finley_ElementFile_free(in->Elements);  
104         Finley_ElementFile_dealloc(in->ContactElements);         Finley_ElementFile_free(in->ContactElements);
105         Finley_ElementFile_dealloc(in->Points);         Finley_ElementFile_free(in->Points);
106         Paso_SystemMatrixPattern_dealloc(in->FullFullPattern);         Finley_TagMap_free(in->TagMap);
107         Paso_SystemMatrixPattern_dealloc(in->FullReducedPattern);         Paso_SystemMatrixPattern_free(in->FullFullPattern);
108         Paso_SystemMatrixPattern_dealloc(in->ReducedFullPattern);         Paso_SystemMatrixPattern_free(in->FullReducedPattern);
109         Paso_SystemMatrixPattern_dealloc(in->ReducedReducedPattern);         Paso_SystemMatrixPattern_free(in->ReducedFullPattern);
110  #ifdef PASO_MPI         Paso_SystemMatrixPattern_free(in->ReducedReducedPattern);
111         Paso_MPIInfo_dealloc( in->MPIInfo );         Paso_MPIInfo_free( in->MPIInfo );
 #endif  
112         MEMFREE(in);               MEMFREE(in);      
113       }       }
114    }    }
# Line 139  dim_t Finley_Mesh_getDim(Finley_Mesh *in Line 122  dim_t Finley_Mesh_getDim(Finley_Mesh *in
122    return in->Nodes->numDim;    return in->Nodes->numDim;
123  }  }
124    
125  /**************************************************************/  void Finley_Mesh_setElements(Finley_Mesh* self,Finley_ElementFile *elements) {
126        Finley_ElementFile_free(self->Elements);
127  /*  returns the number of nodes in the mesh: */      self->Elements=elements;
128    }
129  dim_t Finley_Mesh_getNumNodes(Finley_Mesh *in) {  void Finley_Mesh_setFaceElements(Finley_Mesh* self,Finley_ElementFile *elements) {
130    return in->Nodes->numNodes;      Finley_ElementFile_free(self->FaceElements);
131        self->FaceElements=elements;
132    }
133    void Finley_Mesh_setContactElements(Finley_Mesh* self,Finley_ElementFile *elements) {
134        Finley_ElementFile_free(self->ContactElements);
135        self->ContactElements=elements;
136    }
137    void Finley_Mesh_setPoints(Finley_Mesh* self,Finley_ElementFile *elements) {
138        Finley_ElementFile_free(self->Points);
139        self->Points=elements;
140  }  }
 /**************************************************************/  
   
 /*  returns the number of degrees of freedom in the mesh: */  
141    
 dim_t Finley_Mesh_getNumDegreesOfFreedom(Finley_Mesh *in) {  
   return in->Nodes->numDegreesOfFreedom;  
 }  
 /**************************************************************/  
   
 /*  returns the number of degrees of freedom in the mesh: */  
   
 dim_t Finley_Mesh_getReducedNumDegreesOfFreedom(Finley_Mesh *in) {  
   return in->Nodes->reducedNumDegreesOfFreedom;  
 }  
 /*  
 * $Log$  
 * Revision 1.6  2005/09/15 03:44:22  jgs  
 * Merge of development branch dev-02 back to main trunk on 2005-09-15  
 *  
 * Revision 1.5.2.1  2005/09/07 06:26:19  gross  
 * the solver from finley are put into the standalone package paso now  
 *  
 * Revision 1.5  2005/07/08 04:07:51  jgs  
 * Merge of development branch back to main trunk on 2005-07-08  
 *  
 * Revision 1.4  2004/12/15 07:08:32  jgs  
 * *** empty log message ***  
 * Revision 1.1.1.1.2.3  2005/06/29 02:34:51  gross  
 * some changes towards 64 integers in finley  
 *  
 * 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  
 *  
 *  
 *  
 */  

Legend:
Removed from v.730  
changed lines
  Added in v.2358

  ViewVC Help
Powered by ViewVC 1.1.26