/[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 150 by jgs, Thu Sep 15 03:44:45 2005 UTC trunk/finley/src/Mesh.c revision 1811 by ksteube, Thu Sep 25 23:11:13 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  /**************************************************************/  /*******************************************************
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    
 /*   Finley: Mesh */  
14    
15  /**************************************************************/  /**************************************************************/
16    
17  /*  Author: gross@access.edu.au */  /*   Finley: Mesh */
 /*  Version: $Id$ */  
18    
19  /**************************************************************/  /**************************************************************/
20    
# Line 32  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,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)
31    {
32    Finley_Mesh *out;    Finley_Mesh *out;
33        
34    /*  allocate the return value */    /*  allocate the return value */
# Line 45  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 );
   out->Nodes=Finley_NodeFile_alloc(numDim);  
67    if (! Finley_noError()) {    if (! Finley_noError()) {
68        Finley_Mesh_dealloc(out);        Finley_Mesh_free(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 84  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         Paso_SystemMatrixPattern_dealloc(in->FullFullPattern);         Finley_TagMap_free(in->TagMap);
108         Paso_SystemMatrixPattern_dealloc(in->FullReducedPattern);         Paso_SystemMatrixPattern_free(in->FullFullPattern);
109         Paso_SystemMatrixPattern_dealloc(in->ReducedFullPattern);         Paso_SystemMatrixPattern_free(in->FullReducedPattern);
110         Paso_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 120  dim_t Finley_Mesh_getDim(Finley_Mesh *in Line 123  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  dim_t 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  /*  returns the number of degrees of freedom in the mesh: */      Finley_ElementFile_free(self->ContactElements);
136        self->ContactElements=elements;
137  dim_t Finley_Mesh_getNumDegreesOfFreedom(Finley_Mesh *in) {  }
138    return in->Nodes->numDegreesOfFreedom;  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    
 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.150  
changed lines
  Added in v.1811

  ViewVC Help
Powered by ViewVC 1.1.26