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

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

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

revision 1044 by gross, Mon Mar 19 07:29:31 2007 UTC revision 1156 by gross, Mon May 21 06:45:14 2007 UTC
# Line 27  Line 27 
27    
28  /*  reads a mesh from a Finley file of name fname */  /*  reads a mesh from a Finley file of name fname */
29    
30  Finley_Mesh* Finley_Mesh_read(char* fname,index_t order) {  Finley_Mesh* Finley_Mesh_read(char* fname,index_t order, index_t reduced_order,  bool_t optimize_labeling) {
31    
32    dim_t numNodes, numDim, numEle, i0, i1;    dim_t numNodes, numDim, numEle, i0, i1;
33    index_t tag_key;    index_t tag_key;
# Line 42  Finley_Mesh* Finley_Mesh_read(char* fnam Line 42  Finley_Mesh* Finley_Mesh_read(char* fnam
42  #ifdef PASO_MPI  #ifdef PASO_MPI
43    /* TODO */    /* TODO */
44    Finley_setError(SYSTEM_ERROR,"Finley_Mesh_read: MPI is not suporrted yet.");`    Finley_setError(SYSTEM_ERROR,"Finley_Mesh_read: MPI is not suporrted yet.");`
45      return NULL;
46  #endif  #endif
47    
48    /* get file handle */    /* get file handle */
# Line 60  Finley_Mesh* Finley_Mesh_read(char* fnam Line 61  Finley_Mesh* Finley_Mesh_read(char* fnam
61    
62    fscanf(fileHandle_p, "%1d%*s %d\n", &numDim,&numNodes);    fscanf(fileHandle_p, "%1d%*s %d\n", &numDim,&numNodes);
63    /* allocate mesh */    /* allocate mesh */
64    mesh_p = Finley_Mesh_alloc(name,numDim,order);    mesh_p = Finley_Mesh_alloc(name,numDim,order,reduced_order);
65    if (! Finley_noError()) return NULL;    if (! Finley_noError()) return NULL;
66    
67    Finley_NodeFile_allocTable(mesh_p->Nodes, numNodes);    Finley_NodeFile_allocTable(mesh_p->Nodes, numNodes);
# Line 96  Finley_Mesh* Finley_Mesh_read(char* fnam Line 97  Finley_Mesh* Finley_Mesh_read(char* fnam
97      return NULL;      return NULL;
98    }    }
99    /* read the elements */    /* read the elements */
100    mesh_p->Elements=Finley_ElementFile_alloc(typeID,mesh_p->order);    mesh_p->Elements=Finley_ElementFile_alloc(typeID,mesh_p->order, mesh_p->reduced_order);
101    Finley_ElementFile_allocTable(mesh_p->Elements, numEle);    Finley_ElementFile_allocTable(mesh_p->Elements, numEle);
102    mesh_p->Elements->minColor=0;    mesh_p->Elements->minColor=0;
103    mesh_p->Elements->maxColor=numEle-1;    mesh_p->Elements->maxColor=numEle-1;
# Line 119  Finley_Mesh* Finley_Mesh_read(char* fnam Line 120  Finley_Mesh* Finley_Mesh_read(char* fnam
120      Finley_setError(VALUE_ERROR,error_msg);      Finley_setError(VALUE_ERROR,error_msg);
121      return NULL;      return NULL;
122    }    }
123    mesh_p->FaceElements=Finley_ElementFile_alloc(faceTypeID,mesh_p->order);    mesh_p->FaceElements=Finley_ElementFile_alloc(faceTypeID,mesh_p->order, mesh_p->reduced_order);
124    Finley_ElementFile_allocTable(mesh_p->FaceElements, numEle);    Finley_ElementFile_allocTable(mesh_p->FaceElements, numEle);
125    mesh_p->FaceElements->minColor=0;    mesh_p->FaceElements->minColor=0;
126    mesh_p->FaceElements->maxColor=numEle-1;    mesh_p->FaceElements->maxColor=numEle-1;
# Line 141  Finley_Mesh* Finley_Mesh_read(char* fnam Line 142  Finley_Mesh* Finley_Mesh_read(char* fnam
142      Finley_setError(VALUE_ERROR,error_msg);      Finley_setError(VALUE_ERROR,error_msg);
143      return NULL;      return NULL;
144    }    }
145    mesh_p->ContactElements=Finley_ElementFile_alloc(contactTypeID,mesh_p->order);    mesh_p->ContactElements=Finley_ElementFile_alloc(contactTypeID,mesh_p->order, mesh_p->reduced_order);
146    Finley_ElementFile_allocTable(mesh_p->ContactElements, numEle);    Finley_ElementFile_allocTable(mesh_p->ContactElements, numEle);
147    mesh_p->ContactElements->minColor=0;    mesh_p->ContactElements->minColor=0;
148    mesh_p->ContactElements->maxColor=numEle-1;    mesh_p->ContactElements->maxColor=numEle-1;
# Line 163  Finley_Mesh* Finley_Mesh_read(char* fnam Line 164  Finley_Mesh* Finley_Mesh_read(char* fnam
164      Finley_setError(VALUE_ERROR,error_msg);      Finley_setError(VALUE_ERROR,error_msg);
165      return NULL;      return NULL;
166    }    }
167    mesh_p->Points=Finley_ElementFile_alloc(pointTypeID,mesh_p->order);    mesh_p->Points=Finley_ElementFile_alloc(pointTypeID,mesh_p->order, mesh_p->reduced_order);
168    Finley_ElementFile_allocTable(mesh_p->Points, numEle);    Finley_ElementFile_allocTable(mesh_p->Points, numEle);
169    mesh_p->Points->minColor=0;    mesh_p->Points->minColor=0;
170    mesh_p->Points->maxColor=numEle-1;    mesh_p->Points->maxColor=numEle-1;
# Line 190  Finley_Mesh* Finley_Mesh_read(char* fnam Line 191  Finley_Mesh* Finley_Mesh_read(char* fnam
191    
192    /*   resolve id's : */    /*   resolve id's : */
193    
194    Finley_Mesh_resolveNodeIds(mesh_p);    if (Finley_noError()) {
195         Finley_Mesh_resolveNodeIds(mesh_p);
196      }
197    
198    /* rearrange elements: */    /* rearrange elements: */
199    
200    Finley_Mesh_prepare(mesh_p);    if (Finley_noError()) {
201         Finley_Mesh_prepare(mesh_p);
202      }
203    
204      /* optimize node labeling*/
205    
206      if (Finley_noError()) {
207          if (optimize_labeling) Finley_Mesh_optimizeNodeLabeling(mesh_p);
208      }
209    
210    /* that's it */    /* that's it */
211    #ifdef Finley_TRACE    #ifdef Finley_TRACE

Legend:
Removed from v.1044  
changed lines
  Added in v.1156

  ViewVC Help
Powered by ViewVC 1.1.26