/[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 3080 by jfenwick, Tue Aug 3 04:28:03 2010 UTC revision 3086 by jfenwick, Thu Aug 5 05:07:58 2010 UTC
# Line 13  Line 13 
13    
14  /**************************************************************/  /**************************************************************/
15    
16  /*   Finley: Mesh */  /*   Dudley: Mesh */
17    
18  /**************************************************************/  /**************************************************************/
19    
# Line 24  Line 24 
24  /*   allocates a Mesh with name name for elements of type id using an integration order. If order is negative, */  /*   allocates a Mesh with name name for elements of type id using an integration order. If order is negative, */
25  /*   the most appropriate order is selected indepently. */  /*   the most appropriate order is selected indepently. */
26    
27  Finley_Mesh* Finley_Mesh_alloc(char* name,dim_t numDim, Paso_MPIInfo *mpi_info)  Dudley_Mesh* Dudley_Mesh_alloc(char* name,dim_t numDim, Paso_MPIInfo *mpi_info)
28  {  {
29    Finley_Mesh *out;    Dudley_Mesh *out;
30        
31    /*  allocate the return value */    /*  allocate the return value */
32        
33    out=MEMALLOC(1,Finley_Mesh);    out=MEMALLOC(1,Dudley_Mesh);
34    if (Finley_checkPtr(out)) return NULL;    if (Dudley_checkPtr(out)) return NULL;
35    out->Name=NULL;      out->Name=NULL;  
36    out->Nodes=NULL;    out->Nodes=NULL;
37    out->Elements=NULL;      out->Elements=NULL;  
# Line 46  Finley_Mesh* Finley_Mesh_alloc(char* nam Line 46  Finley_Mesh* Finley_Mesh_alloc(char* nam
46    out->ReducedFullPattern=NULL;    out->ReducedFullPattern=NULL;
47    out->ReducedReducedPattern=NULL;    out->ReducedReducedPattern=NULL;
48    out->MPIInfo = Paso_MPIInfo_getReference( mpi_info );    out->MPIInfo = Paso_MPIInfo_getReference( mpi_info );
49    if (! Finley_noError()) {    if (! Dudley_noError()) {
50        Finley_Mesh_free(out);        Dudley_Mesh_free(out);
51        return NULL;        return NULL;
52    }    }
53    /*   copy name: */    /*   copy name: */
54        
55    out->Name=MEMALLOC(strlen(name)+1,char);    out->Name=MEMALLOC(strlen(name)+1,char);
56    if (Finley_checkPtr(out->Name)) {    if (Dudley_checkPtr(out->Name)) {
57        Finley_Mesh_free(out);        Dudley_Mesh_free(out);
58        return NULL;        return NULL;
59    }    }
60    strcpy(out->Name,name);    strcpy(out->Name,name);
61        
62    /*   allocate node table: */    /*   allocate node table: */
63    out->Nodes=Finley_NodeFile_alloc( numDim, mpi_info );    out->Nodes=Dudley_NodeFile_alloc( numDim, mpi_info );
64    if (! Finley_noError()) {    if (! Dudley_noError()) {
65        Finley_Mesh_free(out);        Dudley_Mesh_free(out);
66        return NULL;        return NULL;
67    }    }
68    out->approximationOrder=-1;    out->approximationOrder=-1;
# Line 78  Finley_Mesh* Finley_Mesh_alloc(char* nam Line 78  Finley_Mesh* Finley_Mesh_alloc(char* nam
78    return out;    return out;
79  }  }
80    
81  /* returns a reference to Finley_Mesh in */  /* returns a reference to Dudley_Mesh in */
82    
83  Finley_Mesh* Finley_Mesh_reference(Finley_Mesh* in) {  Dudley_Mesh* Dudley_Mesh_reference(Dudley_Mesh* in) {
84       if (in!=NULL) ++(in->reference_counter);       if (in!=NULL) ++(in->reference_counter);
85       return in;       return in;
86  }  }
87    
88  /*   freeates a mesh: */  /*   freeates a mesh: */
89    
90  void Finley_Mesh_free(Finley_Mesh* in) {  void Dudley_Mesh_free(Dudley_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         MEMFREE(in->Name);         MEMFREE(in->Name);
95         Finley_NodeFile_free(in->Nodes);         Dudley_NodeFile_free(in->Nodes);
96         Finley_ElementFile_free(in->FaceElements);         Dudley_ElementFile_free(in->FaceElements);
97         Finley_ElementFile_free(in->Elements);           Dudley_ElementFile_free(in->Elements);  
98         Finley_ElementFile_free(in->ContactElements);         Dudley_ElementFile_free(in->ContactElements);
99         Finley_ElementFile_free(in->Points);         Dudley_ElementFile_free(in->Points);
100         Finley_TagMap_free(in->TagMap);         Dudley_TagMap_free(in->TagMap);
101         Paso_SystemMatrixPattern_free(in->FullFullPattern);         Paso_SystemMatrixPattern_free(in->FullFullPattern);
102         Paso_SystemMatrixPattern_free(in->FullReducedPattern);         Paso_SystemMatrixPattern_free(in->FullReducedPattern);
103         Paso_SystemMatrixPattern_free(in->ReducedFullPattern);         Paso_SystemMatrixPattern_free(in->ReducedFullPattern);
# Line 112  void Finley_Mesh_free(Finley_Mesh* in) { Line 112  void Finley_Mesh_free(Finley_Mesh* in) {
112    
113  /*  returns the spatial dimension of the mesh: */  /*  returns the spatial dimension of the mesh: */
114    
115  dim_t Finley_Mesh_getDim(Finley_Mesh *in) {  dim_t Dudley_Mesh_getDim(Dudley_Mesh *in) {
116    return in->Nodes->numDim;    return in->Nodes->numDim;
117  }  }
118    
119  void Finley_Mesh_setElements(Finley_Mesh* self,Finley_ElementFile *elements) {  void Dudley_Mesh_setElements(Dudley_Mesh* self,Dudley_ElementFile *elements) {
120      Finley_ElementFile_free(self->Elements);      Dudley_ElementFile_free(self->Elements);
121      self->Elements=elements;      self->Elements=elements;
122  }  }
123  void Finley_Mesh_setFaceElements(Finley_Mesh* self,Finley_ElementFile *elements) {  void Dudley_Mesh_setFaceElements(Dudley_Mesh* self,Dudley_ElementFile *elements) {
124      Finley_ElementFile_free(self->FaceElements);      Dudley_ElementFile_free(self->FaceElements);
125      self->FaceElements=elements;      self->FaceElements=elements;
126  }  }
127  void Finley_Mesh_setContactElements(Finley_Mesh* self,Finley_ElementFile *elements) {  void Dudley_Mesh_setContactElements(Dudley_Mesh* self,Dudley_ElementFile *elements) {
128      Finley_ElementFile_free(self->ContactElements);      Dudley_ElementFile_free(self->ContactElements);
129      self->ContactElements=elements;      self->ContactElements=elements;
130  }  }
131  void Finley_Mesh_setPoints(Finley_Mesh* self,Finley_ElementFile *elements) {  void Dudley_Mesh_setPoints(Dudley_Mesh* self,Dudley_ElementFile *elements) {
132      Finley_ElementFile_free(self->Points);      Dudley_ElementFile_free(self->Points);
133      self->Points=elements;      self->Points=elements;
134  }  }
135  int  Finley_Mesh_getStatus(Finley_Mesh* in) {  int  Dudley_Mesh_getStatus(Dudley_Mesh* in) {
136     if  (in == NULL) {     if  (in == NULL) {
137          return -1;          return -1;
138     } else if (in->Nodes == NULL) {     } else if (in->Nodes == NULL) {
# Line 142  int  Finley_Mesh_getStatus(Finley_Mesh* Line 142  int  Finley_Mesh_getStatus(Finley_Mesh*
142     }     }
143  }  }
144    
145  void Mesh_setOrders(Finley_Mesh *in)  void Mesh_setOrders(Dudley_Mesh *in)
146  {  {
147     const dim_t order_max=9999999;     const dim_t order_max=9999999;
148     dim_t locals[4];     dim_t locals[4];

Legend:
Removed from v.3080  
changed lines
  Added in v.3086

  ViewVC Help
Powered by ViewVC 1.1.26