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

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

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

revision 2420 by gross, Wed Apr 15 03:52:38 2009 UTC revision 2421 by gross, Thu May 14 02:29:06 2009 UTC
# Line 142  void Finley_Mesh_saveVTK(const char *fil Line 142  void Finley_Mesh_saveVTK(const char *fil
142                           Finley_Mesh *mesh_p,                           Finley_Mesh *mesh_p,
143                           const dim_t num_data,                           const dim_t num_data,
144                           char **names_p,                           char **names_p,
145                           escriptDataC **data_pp)                           escriptDataC **data_pp,
146                             const char* metadata,
147                             const char*metadata_schema)
148  {  {
149  #ifdef PASO_MPI  #ifdef PASO_MPI
150      MPI_File mpi_fileHandle_p;      MPI_File mpi_fileHandle_p;
# Line 171  void Finley_Mesh_saveVTK(const char *fil Line 173  void Finley_Mesh_saveVTK(const char *fil
173    
174      const char *vtkHeader = \      const char *vtkHeader = \
175        "<?xml version=\"1.0\"?>\n" \        "<?xml version=\"1.0\"?>\n" \
176        "<VTKFile type=\"UnstructuredGrid\" version=\"0.1\">\n" \        "<VTKFile type=\"UnstructuredGrid\" version=\"0.1\"%s%s>\n%s%s" \
177        "<UnstructuredGrid>\n" \        "<UnstructuredGrid>\n" \
178        "<Piece NumberOfPoints=\"%d\" NumberOfCells=\"%d\">\n" \        "<Piece NumberOfPoints=\"%d\" NumberOfCells=\"%d\">\n" \
179        "<Points>\n" \        "<Points>\n" \
# Line 489  void Finley_Mesh_saveVTK(const char *fil Line 491  void Finley_Mesh_saveVTK(const char *fil
491    
492      /* allocate enough memory for text buffer */      /* allocate enough memory for text buffer */
493    
494      txtBufferSize = strlen(vtkHeader) + 3*LEN_INT_FORMAT + (30+3*maxNameLen);      txtBufferSize = strlen(vtkHeader) + 3*LEN_INT_FORMAT + (30+3*maxNameLen)+strlen(metadata)+strlen(metadata_schema);
495      if (mpi_size > 1) {      if (mpi_size > 1) {
496         txtBufferSize = MAX(txtBufferSize, myNumPoints * LEN_TMP_BUFFER);         txtBufferSize = MAX(txtBufferSize, myNumPoints * LEN_TMP_BUFFER);
497          txtBufferSize = MAX(txtBufferSize, numCellFactor * myNumCells *          txtBufferSize = MAX(txtBufferSize, numCellFactor * myNumCells *
# Line 522  void Finley_Mesh_saveVTK(const char *fil Line 524  void Finley_Mesh_saveVTK(const char *fil
524              nodeIndex = NULL;              nodeIndex = NULL;
525          }          }
526    
527          sprintf(txtBuffer, vtkHeader, globalNumPoints,          if (strlen(metadata)>0) {
528                  numCellFactor*globalNumCells, 3);             if (strlen(metadata_schema)>0) {
529                  sprintf(txtBuffer, vtkHeader," ",metadata_schema,metadata,"\n",globalNumPoints, numCellFactor*globalNumCells, 3);
530               } else {
531                  sprintf(txtBuffer, vtkHeader,"","",metadata,"\n",globalNumPoints, numCellFactor*globalNumCells, 3);
532               }
533            } else {
534               if (strlen(metadata_schema)>0) {
535                  sprintf(txtBuffer, vtkHeader," ",metadata_schema,"","",globalNumPoints, numCellFactor*globalNumCells, 3);
536               } else {
537                  sprintf(txtBuffer, vtkHeader,"","","","",globalNumPoints, numCellFactor*globalNumCells, 3);
538               }
539            }
540    
541          if (mpi_size > 1) {          if (mpi_size > 1) {
542              /* write the nodes */              /* write the nodes */

Legend:
Removed from v.2420  
changed lines
  Added in v.2421

  ViewVC Help
Powered by ViewVC 1.1.26