def test_with_cuds_mesh(self):
        # given
        points = numpy.array([
            [0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1],
            [2, 0, 0], [3, 0, 0], [3, 1, 0], [2, 1, 0],
            [2, 0, 1], [3, 0, 1], [3, 1, 1], [2, 1, 1]],
            'f')
        cells = [
            [0, 1, 2, 3],  # tetra
            [4, 5, 6, 7, 8, 9, 10, 11]]  # hex
        faces = [[2, 7, 11]]
        edges = [[1, 4], [3, 8]]
        count = itertools.count()
        points = [
            Point(coordinates=point, data=DataContainer(TEMPERATURE=index))
            for index, point in enumerate(points)]

        cuds = Mesh('test')
        cuds.add(points)

        faces = [
            Face(
                points=[points[index].uid for index in face],
                data=DataContainer(TEMPERATURE=next(count)))
            for face in faces]
        edges = [
            Edge(
                points=[points[index].uid for index in edge],
                data=DataContainer(TEMPERATURE=next(count)))
            for edge in edges]
        cells = [
            Cell(
                points=[points[index].uid for index in cell],
                data=DataContainer(TEMPERATURE=next(count)))
            for cell in cells]
        cuds.add(edges)
        cuds.add(faces)
        cuds.add(cells)

        # when
        data_set = cuds2vtk(cuds=cuds)

        # then check points
        self.assertEqual(data_set.GetNumberOfPoints(), 12)

        point_data = data_set.GetPointData()
        self.assertEqual(point_data.GetNumberOfArrays(), 1)
        temperature = point_data.GetArray(0)
        self.assertEqual(temperature.GetName(), 'TEMPERATURE')
        self.assertItemsEqual(
            vtk_to_numpy(temperature), range(12))

        # then check cells
        self.assertEqual(data_set.GetNumberOfCells(), 5)

        cell_data = data_set.GetCellData()
        self.assertEqual(cell_data.GetNumberOfArrays(), 1)
        temperature = cell_data.GetArray(0)
        self.assertEqual(temperature.GetName(), 'TEMPERATURE')
        self.assertItemsEqual(
            vtk_to_numpy(temperature), range(5))

        # For each cell in the container
        # find the corresponding cell in the vtkCellArray and
        # verify that they link to points that have the right coordinates.
        for cell in itertools.chain(
                cuds.iter(item_type=CUBA.EDGE),
                cuds.iter(item_type=CUBA.FACE),
                cuds.iter(item_type=CUBA.CELL)):
            # The temperature value is also the index that the cells
            # are expected to have in the vtkCellArray.
            value = cell.data[CUBA.TEMPERATURE]
            index = numpy.nonzero(vtk_to_numpy(temperature) == value)[0]
            vtk_cell = data_set.GetCell(index)
            ids = vtk_cell.GetPointIds()
            for i, uid in enumerate(cell.points):
                cell_point = cuds.get(uid)
                assert_array_equal(
                    data_set.GetPoint(ids.GetId(i)), cell_point.coordinates)