/[escript]/branches/arrayview_from_1695_trunk/finley/src/Mesh_read.c
ViewVC logotype

Diff of /branches/arrayview_from_1695_trunk/finley/src/Mesh_read.c

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

revision 1028 by gross, Wed Mar 14 00:15:24 2007 UTC revision 1044 by gross, Mon Mar 19 07:29:31 2007 UTC
# Line 30  Line 30 
30  Finley_Mesh* Finley_Mesh_read(char* fname,index_t order) {  Finley_Mesh* Finley_Mesh_read(char* fname,index_t order) {
31    
32    dim_t numNodes, numDim, numEle, i0, i1;    dim_t numNodes, numDim, numEle, i0, i1;
33      index_t tag_key;
34    Finley_Mesh *mesh_p=NULL;    Finley_Mesh *mesh_p=NULL;
35    char name[LenString_MAX],element_type[LenString_MAX],frm[20];    char name[LenString_MAX],element_type[LenString_MAX],frm[20];
36    char error_msg[LenErrorMsg_MAX];    char error_msg[LenErrorMsg_MAX];
# Line 38  Finley_Mesh* Finley_Mesh_read(char* fnam Line 39  Finley_Mesh* Finley_Mesh_read(char* fnam
39    ElementTypeId typeID, faceTypeID, contactTypeID, pointTypeID;    ElementTypeId typeID, faceTypeID, contactTypeID, pointTypeID;
40    
41    Finley_resetError();    Finley_resetError();
42    #ifdef PASO_MPI
43      /* TODO */
44      Finley_setError(SYSTEM_ERROR,"Finley_Mesh_read: MPI is not suporrted yet.");`
45    #endif
46    
47    /* get file handle */    /* get file handle */
48    fileHandle_p = fopen(fname, "r");    fileHandle_p = fopen(fname, "r");
# Line 55  Finley_Mesh* Finley_Mesh_read(char* fnam Line 60  Finley_Mesh* Finley_Mesh_read(char* fnam
60    
61    fscanf(fileHandle_p, "%1d%*s %d\n", &numDim,&numNodes);    fscanf(fileHandle_p, "%1d%*s %d\n", &numDim,&numNodes);
62    /* allocate mesh */    /* allocate mesh */
 #ifndef PASO_MPI  
63    mesh_p = Finley_Mesh_alloc(name,numDim,order);    mesh_p = Finley_Mesh_alloc(name,numDim,order);
64    if (! Finley_noError()) return NULL;    if (! Finley_noError()) return NULL;
 #else  
   /* TODO */  
 #endif  
65    
 #ifndef PASO_MPI  
66    Finley_NodeFile_allocTable(mesh_p->Nodes, numNodes);    Finley_NodeFile_allocTable(mesh_p->Nodes, numNodes);
67    if (! Finley_noError()) return NULL;    if (! Finley_noError()) return NULL;
 #else  
   /* TODO */  
 #endif  
68    
69    if (1 == numDim) {    if (1 == numDim) {
70        for (i0 = 0; i0 < numNodes; i0++)        for (i0 = 0; i0 < numNodes; i0++)
# Line 99  Finley_Mesh* Finley_Mesh_read(char* fnam Line 96  Finley_Mesh* Finley_Mesh_read(char* fnam
96      return NULL;      return NULL;
97    }    }
98    /* read the elements */    /* read the elements */
 #ifndef PASO_MPI  
99    mesh_p->Elements=Finley_ElementFile_alloc(typeID,mesh_p->order);    mesh_p->Elements=Finley_ElementFile_alloc(typeID,mesh_p->order);
 #else  
   /* TODO */  
 #endif  
100    Finley_ElementFile_allocTable(mesh_p->Elements, numEle);    Finley_ElementFile_allocTable(mesh_p->Elements, numEle);
101    mesh_p->Elements->minColor=0;    mesh_p->Elements->minColor=0;
102    mesh_p->Elements->maxColor=numEle-1;    mesh_p->Elements->maxColor=numEle-1;
# Line 126  Finley_Mesh* Finley_Mesh_read(char* fnam Line 119  Finley_Mesh* Finley_Mesh_read(char* fnam
119      Finley_setError(VALUE_ERROR,error_msg);      Finley_setError(VALUE_ERROR,error_msg);
120      return NULL;      return NULL;
121    }    }
 #ifndef PASO_MPI  
122    mesh_p->FaceElements=Finley_ElementFile_alloc(faceTypeID,mesh_p->order);    mesh_p->FaceElements=Finley_ElementFile_alloc(faceTypeID,mesh_p->order);
 #else  
   /* TODO */  
 #endif  
123    Finley_ElementFile_allocTable(mesh_p->FaceElements, numEle);    Finley_ElementFile_allocTable(mesh_p->FaceElements, numEle);
124    mesh_p->FaceElements->minColor=0;    mesh_p->FaceElements->minColor=0;
125    mesh_p->FaceElements->maxColor=numEle-1;    mesh_p->FaceElements->maxColor=numEle-1;
# Line 152  Finley_Mesh* Finley_Mesh_read(char* fnam Line 141  Finley_Mesh* Finley_Mesh_read(char* fnam
141      Finley_setError(VALUE_ERROR,error_msg);      Finley_setError(VALUE_ERROR,error_msg);
142      return NULL;      return NULL;
143    }    }
 #ifndef PASO_MPI  
144    mesh_p->ContactElements=Finley_ElementFile_alloc(contactTypeID,mesh_p->order);    mesh_p->ContactElements=Finley_ElementFile_alloc(contactTypeID,mesh_p->order);
 #else  
   /* TODO */  
 #endif  
145    Finley_ElementFile_allocTable(mesh_p->ContactElements, numEle);    Finley_ElementFile_allocTable(mesh_p->ContactElements, numEle);
146    mesh_p->ContactElements->minColor=0;    mesh_p->ContactElements->minColor=0;
147    mesh_p->ContactElements->maxColor=numEle-1;    mesh_p->ContactElements->maxColor=numEle-1;
# Line 178  Finley_Mesh* Finley_Mesh_read(char* fnam Line 163  Finley_Mesh* Finley_Mesh_read(char* fnam
163      Finley_setError(VALUE_ERROR,error_msg);      Finley_setError(VALUE_ERROR,error_msg);
164      return NULL;      return NULL;
165    }    }
 #ifndef PASO_MPI  
166    mesh_p->Points=Finley_ElementFile_alloc(pointTypeID,mesh_p->order);    mesh_p->Points=Finley_ElementFile_alloc(pointTypeID,mesh_p->order);
 #else  
   /* TODO */  
 #endif  
167    Finley_ElementFile_allocTable(mesh_p->Points, numEle);    Finley_ElementFile_allocTable(mesh_p->Points, numEle);
168    mesh_p->Points->minColor=0;    mesh_p->Points->minColor=0;
169    mesh_p->Points->maxColor=numEle-1;    mesh_p->Points->maxColor=numEle-1;
# Line 195  Finley_Mesh* Finley_Mesh_read(char* fnam Line 176  Finley_Mesh* Finley_Mesh_read(char* fnam
176      }   /* for i1 */      }   /* for i1 */
177      fscanf(fileHandle_p, "\n");      fscanf(fileHandle_p, "\n");
178    } /* for i0 */    } /* for i0 */
179      /* get the name tags */
180      if (feof(fileHandle_p) == 0) {
181         fscanf(fileHandle_p, "%s\n", name);
182         while (feof(fileHandle_p) == 0) {
183           fscanf(fileHandle_p, "%s %d\n", name, &tag_key);
184           Finley_Mesh_addTagMap(mesh_p,name,tag_key);
185         }
186      }
187    /* close file */    /* close file */
188    
189    fclose(fileHandle_p);    fclose(fileHandle_p);

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

  ViewVC Help
Powered by ViewVC 1.1.26