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

luis at geodynamics.org luis at geodynamics.org
Wed Feb 18 08:14:49 PST 2009


Author: luis
Date: 2009-02-18 08:14:49 -0800 (Wed, 18 Feb 2009)
New Revision: 14090

Modified:
   cs/cigma/trunk/src/io_vtk.h
Log:
Fixed io_vtk.h so it can read rectilinear VTK files properly

* Node ordering is different for VTK_VOXEL type cells

Modified: cs/cigma/trunk/src/io_vtk.h
===================================================================
--- cs/cigma/trunk/src/io_vtk.h	2009-02-18 16:14:47 UTC (rev 14089)
+++ cs/cigma/trunk/src/io_vtk.h	2009-02-18 16:14:49 UTC (rev 14090)
@@ -23,6 +23,7 @@
 #include <string>
 #include <sstream>
 #include <cassert>
+#include <algorithm>
 
 #include "Cell.h"
 #include "tri_logger.hpp"
@@ -318,6 +319,21 @@
         }
     }
 
+    // XXX: (is there a better way to reorder the nodes in the array?)
+    // regardless, at this point, if cells are of type VTK_VOXEL,
+    // we need to re-order the nodes using the permutation (2 3)(6 7)
+    dataset->GetCell(0, cell);
+    int celltype = cell->GetCellType();
+    if (celltype == VTK_VOXEL)
+    {
+        for (i = 0; i < ncells; i++)
+        {
+            const int n = i * nverts;
+            std::swap(array[n+2], array[n+3]);
+            std::swap(array[n+6], array[n+7]);
+        }
+    }
+
     cell->Delete();
 
     *connect = array;



More information about the CIG-COMMITS mailing list