/[escript]/trunk/finley/src/Mesh.c
ViewVC logotype

Diff of /trunk/finley/src/Mesh.c

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

trunk/finley/src/finleyC/Mesh.c revision 155 by jgs, Wed Nov 9 02:02:19 2005 UTC temp_trunk_copy/finley/src/Mesh.c revision 1384 by phornby, Fri Jan 11 02:29:38 2008 UTC
# Line 1  Line 1 
 /*  
  ******************************************************************************  
  *                                                                            *  
  *       COPYRIGHT  ACcESS 2003,2004,2005 -  All Rights Reserved              *  
  *                                                                            *  
  * This software is the property of ACcESS. No part of this code              *  
  * may be copied in any form or by any means without the expressed written    *  
  * consent of ACcESS.  Copying, use or modification of this software          *  
  * by any unauthorised person is illegal unless that person has a software    *  
  * license agreement with ACcESS.                                             *  
  *                                                                            *  
  ******************************************************************************  
 */  
1    
2  /**************************************************************/  /* $Id$ */
3    
4  /*   Finley: Mesh */  /*******************************************************
5     *
6     *           Copyright 2003-2007 by ACceSS MNRF
7     *       Copyright 2007 by University of Queensland
8     *
9     *                http://esscc.uq.edu.au
10     *        Primary Business: Queensland, Australia
11     *  Licensed under the Open Software License version 3.0
12     *     http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15    
16  /**************************************************************/  /**************************************************************/
17    
18  /*  Author: gross@access.edu.au */  /*   Finley: Mesh */
 /*  Version: $Id$ */  
19    
20  /**************************************************************/  /**************************************************************/
21    
# Line 32  Line 28 
28    
29  extern Finley_RefElementInfo Finley_RefElement_InfoList[];  extern Finley_RefElementInfo Finley_RefElement_InfoList[];
30    
31  Finley_Mesh* Finley_Mesh_alloc(char* name,dim_t numDim, index_t order) {  Finley_Mesh* Finley_Mesh_alloc(char* name,dim_t numDim, index_t order, index_t reduced_order, Paso_MPIInfo *mpi_info)
32    {
33    Finley_Mesh *out;    Finley_Mesh *out;
34        
35    /*  allocate the return value */    /*  allocate the return value */
# Line 45  Finley_Mesh* Finley_Mesh_alloc(char* nam Line 42  Finley_Mesh* Finley_Mesh_alloc(char* nam
42    out->FaceElements=NULL;    out->FaceElements=NULL;
43    out->Points=NULL;          out->Points=NULL;      
44    out->ContactElements=NULL;          out->ContactElements=NULL;      
45      out->TagMap=NULL;      
46    out->reference_counter=0;    out->reference_counter=0;
47    
48    out->FullFullPattern=NULL;    out->FullFullPattern=NULL;
49    out->FullReducedPattern=NULL;    out->FullReducedPattern=NULL;
50    out->ReducedFullPattern=NULL;    out->ReducedFullPattern=NULL;
51    out->ReducedReducedPattern=NULL;    out->ReducedReducedPattern=NULL;
52        out->MPIInfo = Paso_MPIInfo_getReference( mpi_info );
53      if (! Finley_noError()) {
54          Finley_Mesh_free(out);
55          return NULL;
56      }
57    /*   copy name: */    /*   copy name: */
58        
59    out->Name=MEMALLOC(strlen(name)+1,char);    out->Name=MEMALLOC(strlen(name)+1,char);
60    if (Finley_checkPtr(out->Name)) {    if (Finley_checkPtr(out->Name)) {
61        Finley_Mesh_dealloc(out);        Finley_Mesh_free(out);
62        return NULL;        return NULL;
63    }    }
64    strcpy(out->Name,name);    strcpy(out->Name,name);
65        
66    /*   allocate node table: */    /*   allocate node table: */
67        out->Nodes=Finley_NodeFile_alloc( numDim, mpi_info );
   out->Nodes=Finley_NodeFile_alloc(numDim);  
68    if (! Finley_noError()) {    if (! Finley_noError()) {
69        Finley_Mesh_dealloc(out);        Finley_Mesh_free(out);
70        return NULL;        return NULL;
71    }    }
72    out->order=order;    out->order=order;
73      out->reduced_order=reduced_order;
74    out->Elements=NULL;    out->Elements=NULL;
75    out->FaceElements=NULL;    out->FaceElements=NULL;
76    out->Points=NULL;    out->Points=NULL;
# Line 84  Finley_Mesh* Finley_Mesh_reference(Finle Line 86  Finley_Mesh* Finley_Mesh_reference(Finle
86       return in;       return in;
87  }  }
88    
89  /*   deallocates a mesh: */  /*   freeates a mesh: */
90    
91  void Finley_Mesh_dealloc(Finley_Mesh* in) {  void Finley_Mesh_free(Finley_Mesh* in) {
92    if (in!=NULL) {    if (in!=NULL) {
93       in->reference_counter--;       in->reference_counter--;
94       if (in->reference_counter<1) {       if (in->reference_counter<1) {
95         #ifdef Finley_TRACE         #ifdef Finley_TRACE
96         if (in->Name!=NULL) {         if (in->Name!=NULL) {
97             printf("Finley_Mesh_dealloc: mesh %s is deallocated.\n",in->Name);             printf("Finley_Mesh_free: mesh %s is freed.\n",in->Name);
98         } else {         } else {
99             printf("Finley_Mesh_dealloc\n");             printf("Finley_Mesh_free\n");
100         }         }
101         #endif         #endif
102         MEMFREE(in->Name);         MEMFREE(in->Name);
103         Finley_NodeFile_dealloc(in->Nodes);         Finley_NodeFile_free(in->Nodes);
104         Finley_ElementFile_dealloc(in->Elements);           Finley_ElementFile_free(in->Elements);  
105         Finley_ElementFile_dealloc(in->FaceElements);         Finley_ElementFile_free(in->FaceElements);
106         Finley_ElementFile_dealloc(in->ContactElements);         Finley_ElementFile_free(in->ContactElements);
107         Finley_ElementFile_dealloc(in->Points);         Finley_ElementFile_free(in->Points);
108         Paso_SystemMatrixPattern_dealloc(in->FullFullPattern);         Finley_TagMap_free(in->TagMap);
109         Paso_SystemMatrixPattern_dealloc(in->FullReducedPattern);         Paso_SystemMatrixPattern_free(in->FullFullPattern);
110         Paso_SystemMatrixPattern_dealloc(in->ReducedFullPattern);         Paso_SystemMatrixPattern_free(in->FullReducedPattern);
111         Paso_SystemMatrixPattern_dealloc(in->ReducedReducedPattern);         Paso_SystemMatrixPattern_free(in->ReducedFullPattern);
112           Paso_SystemMatrixPattern_free(in->ReducedReducedPattern);
113           Paso_MPIInfo_free( in->MPIInfo );
114         MEMFREE(in);               MEMFREE(in);      
115       }       }
116    }    }
# Line 120  dim_t Finley_Mesh_getDim(Finley_Mesh *in Line 124  dim_t Finley_Mesh_getDim(Finley_Mesh *in
124    return in->Nodes->numDim;    return in->Nodes->numDim;
125  }  }
126    
127  /**************************************************************/  void Finley_Mesh_setElements(Finley_Mesh* self,Finley_ElementFile *elements) {
128        Finley_ElementFile_free(self->Elements);
129  /*  returns the number of nodes in the mesh: */      self->Elements=elements;
130    }
131  dim_t Finley_Mesh_getNumNodes(Finley_Mesh *in) {  void Finley_Mesh_setFaceElements(Finley_Mesh* self,Finley_ElementFile *elements) {
132    return in->Nodes->numNodes;      Finley_ElementFile_free(self->FaceElements);
133  }      self->FaceElements=elements;
134  /**************************************************************/  }
135    void Finley_Mesh_setContactElements(Finley_Mesh* self,Finley_ElementFile *elements) {
136  /*  returns the number of degrees of freedom in the mesh: */      Finley_ElementFile_free(self->ContactElements);
137        self->ContactElements=elements;
138  dim_t Finley_Mesh_getNumDegreesOfFreedom(Finley_Mesh *in) {  }
139    return in->Nodes->numDegreesOfFreedom;  void Finley_Mesh_setPoints(Finley_Mesh* self,Finley_ElementFile *elements) {
140        Finley_ElementFile_free(self->Points);
141        self->Points=elements;
142  }  }
 /**************************************************************/  
143    
 /*  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.155  
changed lines
  Added in v.1384

  ViewVC Help
Powered by ViewVC 1.1.26