/[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 616 by elspeth, Wed Mar 22 02:46:56 2006 UTC revision 730 by bcumming, Mon May 15 04:03:49 2006 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      Finley_Mesh *mesh_p=NULL;
34    char name[LenString_MAX],element_type[LenString_MAX],frm[20];    char name[LenString_MAX],element_type[LenString_MAX],frm[20];
35    char error_msg[LenErrorMsg_MAX];    char error_msg[LenErrorMsg_MAX];
36    Finley_NodeFile *nodes_p=NULL;    Finley_NodeFile *nodes_p=NULL;
37    double time0=Finley_timer();    double time0=Finley_timer();
38    
39    Finley_resetError();    Finley_resetError();
40    
41    /* get file handle */    /* get file handle */
# Line 50  Finley_Mesh* Finley_Mesh_read(char* fnam Line 52  Finley_Mesh* Finley_Mesh_read(char* fnam
52    /* get the nodes */    /* get the nodes */
53    
54    fscanf(fileHandle_p, "%1d%*s %d\n", &numDim,&numNodes);    fscanf(fileHandle_p, "%1d%*s %d\n", &numDim,&numNodes);
55    #ifndef PASO_MPI
56    nodes_p=Finley_NodeFile_alloc(numDim);    nodes_p=Finley_NodeFile_alloc(numDim);
57    if (! Finley_noError()) return NULL;    if (! Finley_noError()) return NULL;
58    Finley_NodeFile_allocTable(nodes_p, numNodes);    Finley_NodeFile_allocTable(nodes_p, numNodes);
59    if (! Finley_noError()) return NULL;    if (! Finley_noError()) return NULL;
60    #else
61      /* TODO */
62    #endif
63    
64    if (1 == numDim) {    if (1 == numDim) {
65        for (i0 = 0; i0 < numNodes; i0++)        for (i0 = 0; i0 < numNodes; i0++)
# Line 87  Finley_Mesh* Finley_Mesh_read(char* fnam Line 93  Finley_Mesh* Finley_Mesh_read(char* fnam
93    
94    /* allocate mesh */    /* allocate mesh */
95    
96    Finley_Mesh * mesh_p =Finley_Mesh_alloc(name,numDim,order);    /* Finley_Mesh * mesh_p =Finley_Mesh_alloc(name,numDim,order); */
97    #ifndef PASO_MPI
98      mesh_p = Finley_Mesh_alloc(name,numDim,order);
99    #else
100      /* TODO */
101    #endif
102    
103    if (! Finley_noError()) return NULL;    if (! Finley_noError()) return NULL;
104    mesh_p->Nodes=nodes_p;    mesh_p->Nodes=nodes_p;
105    
106    /* read the elements */    /* read the elements */
107    #ifndef PASO_MPI
108    mesh_p->Elements=Finley_ElementFile_alloc(typeID,mesh_p->order);    mesh_p->Elements=Finley_ElementFile_alloc(typeID,mesh_p->order);
109    #else
110      /* TODO */
111    #endif
112    Finley_ElementFile_allocTable(mesh_p->Elements, numEle);    Finley_ElementFile_allocTable(mesh_p->Elements, numEle);
113    mesh_p->Elements->minColor=0;    mesh_p->Elements->minColor=0;
114    mesh_p->Elements->maxColor=numEle-1;    mesh_p->Elements->maxColor=numEle-1;
# Line 114  Finley_Mesh* Finley_Mesh_read(char* fnam Line 130  Finley_Mesh* Finley_Mesh_read(char* fnam
130      Finley_setError(VALUE_ERROR,error_msg);      Finley_setError(VALUE_ERROR,error_msg);
131      return NULL;      return NULL;
132    }    }
133    #ifndef PASO_MPI
134    mesh_p->FaceElements=Finley_ElementFile_alloc(faceTypeID,mesh_p->order);    mesh_p->FaceElements=Finley_ElementFile_alloc(faceTypeID,mesh_p->order);
135    #else
136      /* TODO */
137    #endif
138    Finley_ElementFile_allocTable(mesh_p->FaceElements, numEle);    Finley_ElementFile_allocTable(mesh_p->FaceElements, numEle);
139    mesh_p->FaceElements->minColor=0;    mesh_p->FaceElements->minColor=0;
140    mesh_p->FaceElements->maxColor=numEle-1;    mesh_p->FaceElements->maxColor=numEle-1;
# Line 136  Finley_Mesh* Finley_Mesh_read(char* fnam Line 156  Finley_Mesh* Finley_Mesh_read(char* fnam
156      Finley_setError(VALUE_ERROR,error_msg);      Finley_setError(VALUE_ERROR,error_msg);
157      return NULL;      return NULL;
158    }    }
159    #ifndef PASO_MPI
160    mesh_p->ContactElements=Finley_ElementFile_alloc(contactTypeID,mesh_p->order);    mesh_p->ContactElements=Finley_ElementFile_alloc(contactTypeID,mesh_p->order);
161    #else
162      /* TODO */
163    #endif
164    Finley_ElementFile_allocTable(mesh_p->ContactElements, numEle);    Finley_ElementFile_allocTable(mesh_p->ContactElements, numEle);
165    mesh_p->ContactElements->minColor=0;    mesh_p->ContactElements->minColor=0;
166    mesh_p->ContactElements->maxColor=numEle-1;    mesh_p->ContactElements->maxColor=numEle-1;
# Line 158  Finley_Mesh* Finley_Mesh_read(char* fnam Line 182  Finley_Mesh* Finley_Mesh_read(char* fnam
182      Finley_setError(VALUE_ERROR,error_msg);      Finley_setError(VALUE_ERROR,error_msg);
183      return NULL;      return NULL;
184    }    }
185    #ifndef PASO_MPI
186    mesh_p->Points=Finley_ElementFile_alloc(pointTypeID,mesh_p->order);    mesh_p->Points=Finley_ElementFile_alloc(pointTypeID,mesh_p->order);
187    #else
188      /* TODO */
189    #endif
190    Finley_ElementFile_allocTable(mesh_p->Points, numEle);    Finley_ElementFile_allocTable(mesh_p->Points, numEle);
191    mesh_p->Points->minColor=0;    mesh_p->Points->minColor=0;
192    mesh_p->Points->maxColor=numEle-1;    mesh_p->Points->maxColor=numEle-1;

Legend:
Removed from v.616  
changed lines
  Added in v.730

  ViewVC Help
Powered by ViewVC 1.1.26