[cig-commits] r13719 - cs/cigma/trunk/src

luis at geodynamics.org luis at geodynamics.org
Wed Dec 17 02:32:03 PST 2008


Author: luis
Date: 2008-12-17 02:32:03 -0800 (Wed, 17 Dec 2008)
New Revision: 13719

Modified:
   cs/cigma/trunk/src/io_vtk_reader.cpp
   cs/cigma/trunk/src/io_vtk_reader.h
Log:
Convert vtkCellType to cigma::Cell::type.

Also, calling vtk_read_coordinates<double>() with an explicit
template parameter [T=double].

Modified: cs/cigma/trunk/src/io_vtk_reader.cpp
===================================================================
--- cs/cigma/trunk/src/io_vtk_reader.cpp	2008-12-17 10:32:00 UTC (rev 13718)
+++ cs/cigma/trunk/src/io_vtk_reader.cpp	2008-12-17 10:32:03 UTC (rev 13719)
@@ -361,7 +361,7 @@
     */
 
     TRI_LOG_STR("VtkReader::getCoordinates()");
-    return vtk_read_coordinates(this->dataset, loc, coordinates, nno, nsd);
+    return vtk_read_coordinates<double>(this->dataset, loc, coordinates, nno, nsd);
 }
 
 int VtkReader::getConnectivity(const char *loc, int **connectivity, int *nel, int *ndofs)
@@ -410,6 +410,37 @@
 }
 
 
+Cell::type VtkReader::getCellType(int id) const
+{
+    int vtkCellType = VTK_EMPTY_CELL;
+
+    if (dataset != 0)
+    {
+        vtkCellType = dataset->GetCellType(id);
+    }
+
+    if (vtkCellType == VTK_TRIANGLE)
+    {
+        return Cell::TRI3;
+    }
+    if ((vtkCellType == VTK_QUAD))
+    {
+        return Cell::QUAD4;
+    }
+    if ((vtkCellType == VTK_TETRA))
+    {
+        return Cell::TET4;
+    }
+    if ((vtkCellType == VTK_HEXAHEDRON) ||
+        (vtkCellType == VTK_VOXEL))
+    {
+        return Cell::HEX8;
+    }
+
+    return Cell::NONE;
+}
+
+
 int vtk_print_contents(const char *filename)
 {
     TRI_LOG_STR("vtk_print_contents()");
@@ -487,6 +518,8 @@
 //
 
 
+#include "Cell.h"
+
 using namespace cigma;
 
 
@@ -525,6 +558,11 @@
     return -1;
 }
 
+Cell::type VtkReader::getCellType(int id) const
+{
+    return Cell::NONE;
+}
+
 int vtk_print_contents(const char *filename)
 {
     throw cigma::Exception("vtk_print_contents", "Error: Cigma not configured with VTK library", 1);

Modified: cs/cigma/trunk/src/io_vtk_reader.h
===================================================================
--- cs/cigma/trunk/src/io_vtk_reader.h	2008-12-17 10:32:00 UTC (rev 13718)
+++ cs/cigma/trunk/src/io_vtk_reader.h	2008-12-17 10:32:03 UTC (rev 13719)
@@ -4,6 +4,7 @@
 #include "Common.h"
 #include "io_file_reader.h"
 #include "io_vtk.h" // for GridType enum
+#include "Cell.h"
 
 #ifdef HAVE_VTK
 #include "vtkDataSetReader.h"
@@ -32,6 +33,8 @@
     int getCoordinates(const char *loc, double **coordinates, int *nno, int *nsd);
     int getConnectivity(const char *loc, int **connectivity, int *nel, int *ndofs);
 
+    Cell::type getCellType(int id) const;
+
 #ifdef HAVE_VTK
 public:
     vtkGridType gridType;



More information about the CIG-COMMITS mailing list