Skip to content

Commit

Permalink
remove some superfluous includes
Browse files Browse the repository at this point in the history
  • Loading branch information
nschloe committed Nov 10, 2015
1 parent edb2914 commit 39bc108
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions meshio/writer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
#
from collections import defaultdict
import h5py
import numpy
import os
Expand Down Expand Up @@ -185,12 +184,10 @@ def _write_h5m(


def _generate_vtk_mesh(points, cellsNodes):
from vtk import vtkUnstructuredGrid, VTK_LINE, VTK_TRIANGLE, VTK_TETRA, \
vtkIdList, vtkPoints, vtkDoubleArray, vtkCellArray
mesh = vtkUnstructuredGrid()
mesh = vtk.vtkUnstructuredGrid()

# set points
vtk_points = vtkPoints()
vtk_points = vtk.vtkPoints()
# Not using a deep copy here results in a segfault.
vtk_array = numpy_support.numpy_to_vtk(points, deep=True)
vtk_points.SetData(vtk_array)
Expand All @@ -200,7 +197,7 @@ def _generate_vtk_mesh(points, cellsNodes):
cell_array = vtk.vtkCellArray()
# set cells
for cellNodes in cellsNodes:
pts = vtkIdList()
pts = vtk.vtkIdList()
num_local_nodes = len(cellNodes)
pts.SetNumberOfIds(num_local_nodes)
# Get the connectivity for this element.
Expand All @@ -209,9 +206,9 @@ def _generate_vtk_mesh(points, cellsNodes):
cell_array.InsertNextCell(pts)

numnodes_to_type = {
2: VTK_LINE,
3: VTK_TRIANGLE,
4: VTK_TETRA
2: vtk.VTK_LINE,
3: vtk.VTK_TRIANGLE,
4: vtk.VTK_TETRA
}
mesh.SetCells(
# simply use the type of the last cell
Expand Down

0 comments on commit 39bc108

Please sign in to comment.