/[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 123 by jgs, Fri Jul 8 04:08:13 2005 UTC revision 147 by jgs, Fri Aug 12 01:45:47 2005 UTC
# Line 348  void Finley_Mesh_saveVTK(const char * fi Line 348  void Finley_Mesh_saveVTK(const char * fi
348          "type=\"Int32\" "          "type=\"Int32\" "
349          "format=\"ascii\">\n");          "format=\"ascii\">\n");
350      int NN = elements->ReferenceElement->Type->numNodes;      int NN = elements->ReferenceElement->Type->numNodes;
351      int counter = 0;      if (VTK_QUADRATIC_HEXAHEDRON==cellType) {
352      for (i = 0; i < numCells; i++) {         for (i = 0; i < numCells; i++) {
353        fprintf(fileHandle_p, "%d ",           fprintf(fileHandle_p,"%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d",
354            mesh_p->Elements->Nodes[INDEX2(0, i, NN)]);                              mesh_p->Elements->Nodes[INDEX2(0, i, NN)],
355        counter++; /* counter for the number of connectivity points written */                              mesh_p->Elements->Nodes[INDEX2(1, i, NN)],
356        /* if the counter gets too big (i.e. the line gets too long),                              mesh_p->Elements->Nodes[INDEX2(2, i, NN)],
357         * then add a newline and reset */                              mesh_p->Elements->Nodes[INDEX2(3, i, NN)],
358        if (counter > 19) {                              mesh_p->Elements->Nodes[INDEX2(4, i, NN)],
359        fprintf(fileHandle_p, "\n");                              mesh_p->Elements->Nodes[INDEX2(5, i, NN)],
360        counter = 0;                              mesh_p->Elements->Nodes[INDEX2(6, i, NN)],
361        }                              mesh_p->Elements->Nodes[INDEX2(7, i, NN)],
362        for (j = 1; j < numVTKNodesPerElement; j++) {                              mesh_p->Elements->Nodes[INDEX2(8, i, NN)],
363      fprintf(fileHandle_p,"%d ", mesh_p->Elements->Nodes[INDEX2(j, i, NN)]);                              mesh_p->Elements->Nodes[INDEX2(9, i, NN)],
364      counter++;                              mesh_p->Elements->Nodes[INDEX2(10, i, NN)],
365      /* if the counter gets too big (i.e. the line gets too long),                              mesh_p->Elements->Nodes[INDEX2(11, i, NN)],
366       * then add a newline and reset */                              mesh_p->Elements->Nodes[INDEX2(16, i, NN)],
367      if (counter > 19) {                              mesh_p->Elements->Nodes[INDEX2(17, i, NN)],
368          fprintf(fileHandle_p, "\n");                              mesh_p->Elements->Nodes[INDEX2(18, i, NN)],
369          counter = 0;                              mesh_p->Elements->Nodes[INDEX2(19, i, NN)],
370      }                              mesh_p->Elements->Nodes[INDEX2(12, i, NN)],
371        }                              mesh_p->Elements->Nodes[INDEX2(13, i, NN)],
372                                mesh_p->Elements->Nodes[INDEX2(14, i, NN)],
373                                mesh_p->Elements->Nodes[INDEX2(15, i, NN)]);
374             fprintf(fileHandle_p, "\n");
375           }
376        } else {
377           for (i = 0; i < numCells; i++) {
378             for (j = 0; j < numVTKNodesPerElement; j++) fprintf(fileHandle_p,"%d ", mesh_p->Elements->Nodes[INDEX2(j, i, NN)]);
379             fprintf(fileHandle_p, "\n");
380           }
381      }      }
382      fprintf(fileHandle_p, "\n");      fprintf(fileHandle_p, "\n");
383      fprintf(fileHandle_p, "</DataArray>\n");      fprintf(fileHandle_p, "</DataArray>\n");
# Line 378  void Finley_Mesh_saveVTK(const char * fi Line 387  void Finley_Mesh_saveVTK(const char * fi
387          "Name=\"offsets\" "          "Name=\"offsets\" "
388          "type=\"Int32\" "          "type=\"Int32\" "
389          "format=\"ascii\">\n");          "format=\"ascii\">\n");
390      counter = 0;  /* counter for the number of offsets written to file */      int counter = 0;  /* counter for the number of offsets written to file */
391      for (i=numVTKNodesPerElement; i<=numCells*numVTKNodesPerElement; i+=numVTKNodesPerElement) {      for (i=numVTKNodesPerElement; i<=numCells*numVTKNodesPerElement; i+=numVTKNodesPerElement) {
392        fprintf(fileHandle_p, "%d ", i);        fprintf(fileHandle_p, "%d ", i);
393        counter++;        counter++;
# Line 617  void Finley_Mesh_saveVTK(const char * fi Line 626  void Finley_Mesh_saveVTK(const char * fi
626    
627  /*  /*
628   * $Log$   * $Log$
629     * Revision 1.6  2005/08/12 01:45:43  jgs
630     * erge of development branch dev-02 back to main trunk on 2005-08-12
631     *
632     * Revision 1.5.2.1  2005/08/10 06:14:37  gross
633     * QUADRATIC HEXAHEDRON elements fixed
634     *
635   * Revision 1.5  2005/07/08 04:07:55  jgs   * Revision 1.5  2005/07/08 04:07:55  jgs
636   * Merge of development branch back to main trunk on 2005-07-08   * Merge of development branch back to main trunk on 2005-07-08
637   *   *

Legend:
Removed from v.123  
changed lines
  Added in v.147

  ViewVC Help
Powered by ViewVC 1.1.26