/[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 730 by bcumming, Mon May 15 04:03:49 2006 UTC revision 934 by gross, Tue Jan 23 09:52:45 2007 UTC
# Line 33  Finley_Mesh* Finley_Mesh_read(char* fnam Line 33  Finley_Mesh* Finley_Mesh_read(char* fnam
33    Finley_Mesh *mesh_p=NULL;    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];
   Finley_NodeFile *nodes_p=NULL;  
36    double time0=Finley_timer();    double time0=Finley_timer();
37    
38    Finley_resetError();    Finley_resetError();
# Line 49  Finley_Mesh* Finley_Mesh_read(char* fnam Line 48  Finley_Mesh* Finley_Mesh_read(char* fnam
48    /* read header */    /* read header */
49    sprintf(frm,"%%%d[^\n]",LenString_MAX-1);    sprintf(frm,"%%%d[^\n]",LenString_MAX-1);
50    fscanf(fileHandle_p, frm, name);    fscanf(fileHandle_p, frm, name);
51    
52      /* allocate mesh */
53    #ifndef PASO_MPI
54      mesh_p = Finley_Mesh_alloc(name,numDim,order);
55    #else
56      /* TODO */
57    #endif
58      if (! Finley_noError()) return NULL;
59    /* get the nodes */    /* get the nodes */
60    
61    fscanf(fileHandle_p, "%1d%*s %d\n", &numDim,&numNodes);    fscanf(fileHandle_p, "%1d%*s %d\n", &numDim,&numNodes);
62  #ifndef PASO_MPI  #ifndef PASO_MPI
63    nodes_p=Finley_NodeFile_alloc(numDim);    Finley_NodeFile_allocTable(mesh_p->Nodes, numNodes);
   if (! Finley_noError()) return NULL;  
   Finley_NodeFile_allocTable(nodes_p, numNodes);  
64    if (! Finley_noError()) return NULL;    if (! Finley_noError()) return NULL;
65  #else  #else
66    /* TODO */    /* TODO */
# Line 63  Finley_Mesh* Finley_Mesh_read(char* fnam Line 68  Finley_Mesh* Finley_Mesh_read(char* fnam
68    
69    if (1 == numDim) {    if (1 == numDim) {
70        for (i0 = 0; i0 < numNodes; i0++)        for (i0 = 0; i0 < numNodes; i0++)
71      fscanf(fileHandle_p, "%d %d %d %le\n", &nodes_p->Id[i0],      fscanf(fileHandle_p, "%d %d %d %le\n", &mesh_p->Nodes->Id[i0],
72             &nodes_p->degreeOfFreedom[i0], &nodes_p->Tag[i0],             &mesh_p->Nodes->degreeOfFreedom[i0], &mesh_p->Nodes->Tag[i0],
73             &nodes_p->Coordinates[INDEX2(0,i0,numDim)]);             &mesh_p->Nodes->Coordinates[INDEX2(0,i0,numDim)]);
74    } else if (2 == numDim) {    } else if (2 == numDim) {
75        for (i0 = 0; i0 < numNodes; i0++)        for (i0 = 0; i0 < numNodes; i0++)
76      fscanf(fileHandle_p, "%d %d %d %le %le\n", &nodes_p->Id[i0],      fscanf(fileHandle_p, "%d %d %d %le %le\n", &mesh_p->Nodes->Id[i0],
77             &nodes_p->degreeOfFreedom[i0], &nodes_p->Tag[i0],             &mesh_p->Nodes->degreeOfFreedom[i0], &mesh_p->Nodes->Tag[i0],
78             &nodes_p->Coordinates[INDEX2(0,i0,numDim)],             &mesh_p->Nodes->Coordinates[INDEX2(0,i0,numDim)],
79             &nodes_p->Coordinates[INDEX2(1,i0,numDim)]);             &mesh_p->Nodes->Coordinates[INDEX2(1,i0,numDim)]);
80    } else if (3 == numDim) {    } else if (3 == numDim) {
81        for (i0 = 0; i0 < numNodes; i0++)        for (i0 = 0; i0 < numNodes; i0++)
82      fscanf(fileHandle_p, "%d %d %d %le %le %le\n", &nodes_p->Id[i0],      fscanf(fileHandle_p, "%d %d %d %le %le %le\n", &mesh_p->Nodes->Id[i0],
83             &nodes_p->degreeOfFreedom[i0], &nodes_p->Tag[i0],             &mesh_p->Nodes->degreeOfFreedom[i0], &mesh_p->Nodes->Tag[i0],
84             &nodes_p->Coordinates[INDEX2(0,i0,numDim)],             &mesh_p->Nodes->Coordinates[INDEX2(0,i0,numDim)],
85             &nodes_p->Coordinates[INDEX2(1,i0,numDim)],             &mesh_p->Nodes->Coordinates[INDEX2(1,i0,numDim)],
86             &nodes_p->Coordinates[INDEX2(2,i0,numDim)]);             &mesh_p->Nodes->Coordinates[INDEX2(2,i0,numDim)]);
87    } /* if else else */    } /* if else else */
88    
89    /* get the element type */    /* get the element type */
# Line 90  Finley_Mesh* Finley_Mesh_read(char* fnam Line 95  Finley_Mesh* Finley_Mesh_read(char* fnam
95      Finley_setError(VALUE_ERROR,error_msg);      Finley_setError(VALUE_ERROR,error_msg);
96      return NULL;      return NULL;
97    }    }
   
   /* allocate mesh */  
   
   /* Finley_Mesh * mesh_p =Finley_Mesh_alloc(name,numDim,order); */  
 #ifndef PASO_MPI  
   mesh_p = Finley_Mesh_alloc(name,numDim,order);  
 #else  
   /* TODO */  
 #endif  
   
   if (! Finley_noError()) return NULL;  
   mesh_p->Nodes=nodes_p;  
   
98    /* read the elements */    /* read the elements */
99  #ifndef PASO_MPI  #ifndef PASO_MPI
100    mesh_p->Elements=Finley_ElementFile_alloc(typeID,mesh_p->order);    mesh_p->Elements=Finley_ElementFile_alloc(typeID,mesh_p->order);

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

  ViewVC Help
Powered by ViewVC 1.1.26