/[escript]/branches/domexper/dudley/src/Mesh_readGmsh.c
ViewVC logotype

Diff of /branches/domexper/dudley/src/Mesh_readGmsh.c

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

revision 1003 by gross, Thu Mar 1 01:53:37 2007 UTC revision 1028 by gross, Wed Mar 14 00:15:24 2007 UTC
# Line 37  Finley_Mesh* Finley_Mesh_readGmsh(char* Line 37  Finley_Mesh* Finley_Mesh_readGmsh(char*
37    int format = 0, size = sizeof(double);    int format = 0, size = sizeof(double);
38    dim_t numNodes, totalNumElements=0, numTags=0, numNodesPerElement, numNodesPerElement2, element_dim;    dim_t numNodes, totalNumElements=0, numTags=0, numNodesPerElement, numNodesPerElement2, element_dim;
39    index_t e, i0, j, gmsh_type, partition_id, itmp, final_element_type,  elementary_id;    index_t e, i0, j, gmsh_type, partition_id, itmp, final_element_type,  elementary_id;
40      index_t numElements=0, numFaceElements=0, *id=NULL, *tag=NULL, *vertices=NULL;
41    Finley_Mesh *mesh_p=NULL;    Finley_Mesh *mesh_p=NULL;
42    char name[LenString_MAX],element_type[LenString_MAX],frm[20], line[LenString_MAX+1];    char line[LenString_MAX+1];
43    char error_msg[LenErrorMsg_MAX];    char error_msg[LenErrorMsg_MAX];
44    double rtmp0, rtmp1;    double rtmp0, rtmp1;
45    double time0=Finley_timer();    double time0=Finley_timer();
46      FILE * fileHandle_p = NULL;
47      ElementTypeId* element_type=NULL;
48    
49    Finley_resetError();    Finley_resetError();
50   #if PASO_MPI   #if PASO_MPI
# Line 56  Finley_Mesh* Finley_Mesh_readGmsh(char* Line 59  Finley_Mesh* Finley_Mesh_readGmsh(char*
59    if (! Finley_noError()) return NULL;    if (! Finley_noError()) return NULL;
60    
61    /* get file handle */    /* get file handle */
62    FILE * fileHandle_p = fopen(fname, "r");    fileHandle_p = fopen(fname, "r");
63    if (fileHandle_p==NULL) {    if (fileHandle_p==NULL) {
64      sprintf(error_msg,"Opening Gmsh file %s for reading failed.",fname);      sprintf(error_msg,"Opening Gmsh file %s for reading failed.",fname);
65      Finley_setError(IO_ERROR,error_msg);      Finley_setError(IO_ERROR,error_msg);
# Line 117  Finley_Mesh* Finley_Mesh_readGmsh(char* Line 120  Finley_Mesh* Finley_Mesh_readGmsh(char*
120    
121        ElementTypeId final_element_type = NoType;        ElementTypeId final_element_type = NoType;
122        ElementTypeId final_face_element_type = NoType;        ElementTypeId final_face_element_type = NoType;
123        index_t numElements=0;        numElements=0;
124        index_t numFaceElements=0;        numFaceElements=0;
125        fscanf(fileHandle_p, "%d", &totalNumElements);        fscanf(fileHandle_p, "%d", &totalNumElements);
126    
127        index_t* id=TMPMEMALLOC(totalNumElements,index_t);        id=TMPMEMALLOC(totalNumElements,index_t);
128        index_t* tag=TMPMEMALLOC(totalNumElements,index_t);        tag=TMPMEMALLOC(totalNumElements,index_t);
129        ElementTypeId* element_type=TMPMEMALLOC(totalNumElements,ElementTypeId);  
130        index_t* vertices=TMPMEMALLOC(totalNumElements*MAX_numNodes_gmsh,index_t);  
131          element_type=TMPMEMALLOC(totalNumElements,ElementTypeId);
132          vertices=TMPMEMALLOC(totalNumElements*MAX_numNodes_gmsh,index_t);
133        if (! (Finley_checkPtr(id) || Finley_checkPtr(tag) || Finley_checkPtr(element_type) || Finley_checkPtr(vertices) ) ) {        if (! (Finley_checkPtr(id) || Finley_checkPtr(tag) || Finley_checkPtr(element_type) || Finley_checkPtr(vertices) ) ) {
134           /* read all in */           /* read all in */
135           for(e = 0; e < totalNumElements; e++) {           for(e = 0; e < totalNumElements; e++) {
# Line 225  Finley_Mesh* Finley_Mesh_readGmsh(char* Line 230  Finley_Mesh* Finley_Mesh_readGmsh(char*
230             } else if (j == 2) {             } else if (j == 2) {
231               partition_id = itmp;               partition_id = itmp;
232                 }                 }
233             // ignore any other tags             /* ignore any other tags */
234           }           }
235         }         }
236             if (! Finley_noError()) break;             if (! Finley_noError()) break;

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

  ViewVC Help
Powered by ViewVC 1.1.26