Example #1
0
 def test_numpy_to_vtk(self):
     data_array = np.arange(1600)
     keyword = 'PORO'
     vtk_unstructured_grid = VTK()
     VTK.numpy_to_vtk(keyword, data_array, vtk_unstructured_grid, False)
     assert vtk_unstructured_grid.GetCellData().GetArray('PORO').GetSize() == 1600
Example #2
0
    def _update(self, data_array=[], name='PROPERTY'):
        r"""
        This method update the data in the vtkUnsctructuredGrid.

        Parameters
        ----------
        data_array : ndarray
            NumPy array holding the data of load_cell_data().
        name : string
            String holding the name of the property.

        """

        if len(self._actnum) != 0:
            VTK.numpy_to_vtk('ACTNUM', self._actnum, self._vtk_unstructured_grid, self._verbose)
        if len(self._permx) != 0:
             VTK.numpy_to_vtk('PERMX', self._permx, self._vtk_unstructured_grid, self._verbose)
        if len(self._permy) != 0:
            VTK.numpy_to_vtk('PERMY', self._permy, self._vtk_unstructured_grid, self._verbose)
        if len(self._permz) != 0:
            VTK.numpy_to_vtk('PERMZ', self._permz, self._vtk_unstructured_grid, self._verbose)
        if len(self._poro) != 0:
            VTK.numpy_to_vtk('PORO', self._poro, self._vtk_unstructured_grid, self._verbose)
        if len(self._so) != 0:
            VTK.numpy_to_vtk('SO', self._so, self._vtk_unstructured_grid, self._verbose)
        if len(data_array) != 0:
            VTK.numpy_to_vtk(name.upper(), data_array, self._vtk_unstructured_grid, self._verbose)