/// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestPDataSetReaderGrid(String [] argv)
    {
        //Prefix Content is: ""

        // Create the RenderWindow, Renderer and both Actors[]
        //[]
        ren1 = vtkRenderer.New();
        renWin = vtkRenderWindow.New();
        renWin.AddRenderer((vtkRenderer)ren1);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        //[]
        // If the current directory is writable, then test the witers[]
        //[]
        try
          {
          channel = new StreamWriter("test.tmp");
          tryCatchError = "NOERROR";
          }
        catch(Exception)
          {
          tryCatchError = "ERROR";
          }
        if(tryCatchError.Equals("NOERROR"))
          {
          channel.Close();
          File.Delete("test.tmp");
          // ====== Structured Grid ======[]
          // First save out a grid in parallel form.[]
          reader = new vtkMultiBlockPLOT3DReader();
          reader.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin");
          reader.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin");
          writer = new vtkPDataSetWriter();
          writer.SetFileName((string)"comb.pvtk");
          writer.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          writer.SetNumberOfPieces((int)4);
          writer.Write();
          pReader = new vtkPDataSetReader();
          pReader.SetFileName((string)"comb.pvtk");
          surface = new vtkDataSetSurfaceFilter();
          surface.SetInputConnection((vtkAlgorithmOutput)pReader.GetOutputPort());
          mapper = vtkPolyDataMapper.New();
          mapper.SetInputConnection((vtkAlgorithmOutput)surface.GetOutputPort());
          mapper.SetNumberOfPieces((int)2);
          mapper.SetPiece((int)0);
          mapper.SetGhostLevel((int)1);
          mapper.Update();
          File.Delete("comb.pvtk");
          File.Delete("comb.0.vtk");
          File.Delete("comb.1.vtk");
          File.Delete("comb.2.vtk");
          File.Delete("comb.3.vtk");
          actor = new vtkActor();
          actor.SetMapper((vtkMapper)mapper);
          actor.SetPosition((double)-5,(double)0,(double)-29);
          // Add the actors to the renderer, set the background and size[]
          //[]
          ren1.AddActor((vtkProp)actor);
          // ====== ImageData ======[]
          // First save out a grid in parallel form.[]
          fractal = new vtkImageMandelbrotSource();
          fractal.SetWholeExtent((int)0,(int)9,(int)0,(int)9,(int)0,(int)9);
          fractal.SetSampleCX((double)0.1,(double)0.1,(double)0.1,(double)0.1);
          fractal.SetMaximumNumberOfIterations((ushort)10);
          writer2 = new vtkPDataSetWriter();
          writer.SetFileName((string)"fractal.pvtk");
          writer.SetInputConnection((vtkAlgorithmOutput)fractal.GetOutputPort());
          writer.SetNumberOfPieces((int)4);
          writer.Write();
          pReader2 = new vtkPDataSetReader();
          pReader2.SetFileName((string)"fractal.pvtk");
          iso = new vtkContourFilter();
          iso.SetInputConnection((vtkAlgorithmOutput)pReader2.GetOutputPort());
          iso.SetValue((int)0,(double)4);
          mapper2 = vtkPolyDataMapper.New();
          mapper2.SetInputConnection((vtkAlgorithmOutput)iso.GetOutputPort());
          mapper2.SetNumberOfPieces((int)3);
          mapper2.SetPiece((int)0);
          mapper2.SetGhostLevel((int)0);
          mapper2.Update();
          File.Delete("fractal.pvtk");
          File.Delete("fractal.0.vtk");
          File.Delete("fractal.1.vtk");
          File.Delete("fractal.2.vtk");
          File.Delete("fractal.3.vtk");
          actor2 = new vtkActor();
          actor2.SetMapper((vtkMapper)mapper2);
          actor2.SetScale((double)5,(double)5,(double)5);
          actor2.SetPosition((double)6,(double)6,(double)6);
          // Add the actors to the renderer, set the background and size[]
          //[]
          ren1.AddActor((vtkProp)actor2);
          // ====== PolyData ======[]
          // First save out a grid in parallel form.[]
          sphere = new vtkSphereSource();
          sphere.SetRadius((double)2);
          writer3 = new vtkPDataSetWriter();
          writer3.SetFileName((string)"sphere.pvtk");
          writer3.SetInputConnection((vtkAlgorithmOutput)sphere.GetOutputPort());
          writer3.SetNumberOfPieces((int)4);
          writer3.Write();
          pReader3 = new vtkPDataSetReader();
          pReader3.SetFileName((string)"sphere.pvtk");
          mapper3 = vtkPolyDataMapper.New();
          mapper3.SetInputConnection((vtkAlgorithmOutput)pReader3.GetOutputPort());
          mapper3.SetNumberOfPieces((int)2);
          mapper3.SetPiece((int)0);
          mapper3.SetGhostLevel((int)1);
          mapper3.Update();
          File.Delete("sphere.pvtk");
          File.Delete("sphere.0.vtk");
          File.Delete("sphere.1.vtk");
          File.Delete("sphere.2.vtk");
          File.Delete("sphere.3.vtk");
          actor3 = new vtkActor();
          actor3.SetMapper((vtkMapper)mapper3);
          actor3.SetPosition((double)6,(double)6,(double)6);
          // Add the actors to the renderer, set the background and size[]
          //[]
          ren1.AddActor((vtkProp)actor3);
          }

        ren1.SetBackground((double)0.1,(double)0.2,(double)0.4);
        renWin.SetSize((int)300,(int)300);
        // render the image[]
        //[]
        cam1 = ren1.GetActiveCamera();
        cam1.Azimuth((double)20);
        cam1.Elevation((double)40);
        ren1.ResetCamera();
        cam1.Zoom((double)1.2);
        iren.Initialize();
        // prevent the tk window from showing up then start the event loop[]

        //deleteAllVTKObjects();
    }
 ///<summary> A Set Method for Static Variables </summary>
 public static void Setwriter3(vtkPDataSetWriter toSet)
 {
     writer3 = toSet;
 }
 ///<summary> A Set Method for Static Variables </summary>
 public static void Setwriter3(vtkPDataSetWriter toSet)
 {
     writer3 = toSet;
 }
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestPDataSetReaderGrid(String [] argv)
    {
        //Prefix Content is: ""

        // Create the RenderWindow, Renderer and both Actors[]
        //[]
        ren1   = vtkRenderer.New();
        renWin = vtkRenderWindow.New();
        renWin.AddRenderer((vtkRenderer)ren1);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        //[]
        // If the current directory is writable, then test the witers[]
        //[]
        try
        {
            channel       = new StreamWriter("test.tmp");
            tryCatchError = "NOERROR";
        }
        catch (Exception)
        {
            tryCatchError = "ERROR";
        }
        if (tryCatchError.Equals("NOERROR"))
        {
            channel.Close();
            File.Delete("test.tmp");
            // ====== Structured Grid ======[]
            // First save out a grid in parallel form.[]
            reader = new vtkMultiBlockPLOT3DReader();
            reader.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin");
            reader.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin");
            writer = new vtkPDataSetWriter();
            writer.SetFileName((string)"comb.pvtk");
            writer.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
            writer.SetNumberOfPieces((int)4);
            writer.Write();
            pReader = new vtkPDataSetReader();
            pReader.SetFileName((string)"comb.pvtk");
            surface = new vtkDataSetSurfaceFilter();
            surface.SetInputConnection((vtkAlgorithmOutput)pReader.GetOutputPort());
            mapper = vtkPolyDataMapper.New();
            mapper.SetInputConnection((vtkAlgorithmOutput)surface.GetOutputPort());
            mapper.SetNumberOfPieces((int)2);
            mapper.SetPiece((int)0);
            mapper.SetGhostLevel((int)1);
            mapper.Update();
            File.Delete("comb.pvtk");
            File.Delete("comb.0.vtk");
            File.Delete("comb.1.vtk");
            File.Delete("comb.2.vtk");
            File.Delete("comb.3.vtk");
            actor = new vtkActor();
            actor.SetMapper((vtkMapper)mapper);
            actor.SetPosition((double)-5, (double)0, (double)-29);
            // Add the actors to the renderer, set the background and size[]
            //[]
            ren1.AddActor((vtkProp)actor);
            // ====== ImageData ======[]
            // First save out a grid in parallel form.[]
            fractal = new vtkImageMandelbrotSource();
            fractal.SetWholeExtent((int)0, (int)9, (int)0, (int)9, (int)0, (int)9);
            fractal.SetSampleCX((double)0.1, (double)0.1, (double)0.1, (double)0.1);
            fractal.SetMaximumNumberOfIterations((ushort)10);
            writer2 = new vtkPDataSetWriter();
            writer.SetFileName((string)"fractal.pvtk");
            writer.SetInputConnection((vtkAlgorithmOutput)fractal.GetOutputPort());
            writer.SetNumberOfPieces((int)4);
            writer.Write();
            pReader2 = new vtkPDataSetReader();
            pReader2.SetFileName((string)"fractal.pvtk");
            iso = new vtkContourFilter();
            iso.SetInputConnection((vtkAlgorithmOutput)pReader2.GetOutputPort());
            iso.SetValue((int)0, (double)4);
            mapper2 = vtkPolyDataMapper.New();
            mapper2.SetInputConnection((vtkAlgorithmOutput)iso.GetOutputPort());
            mapper2.SetNumberOfPieces((int)3);
            mapper2.SetPiece((int)0);
            mapper2.SetGhostLevel((int)0);
            mapper2.Update();
            File.Delete("fractal.pvtk");
            File.Delete("fractal.0.vtk");
            File.Delete("fractal.1.vtk");
            File.Delete("fractal.2.vtk");
            File.Delete("fractal.3.vtk");
            actor2 = new vtkActor();
            actor2.SetMapper((vtkMapper)mapper2);
            actor2.SetScale((double)5, (double)5, (double)5);
            actor2.SetPosition((double)6, (double)6, (double)6);
            // Add the actors to the renderer, set the background and size[]
            //[]
            ren1.AddActor((vtkProp)actor2);
            // ====== PolyData ======[]
            // First save out a grid in parallel form.[]
            sphere = new vtkSphereSource();
            sphere.SetRadius((double)2);
            writer3 = new vtkPDataSetWriter();
            writer3.SetFileName((string)"sphere.pvtk");
            writer3.SetInputConnection((vtkAlgorithmOutput)sphere.GetOutputPort());
            writer3.SetNumberOfPieces((int)4);
            writer3.Write();
            pReader3 = new vtkPDataSetReader();
            pReader3.SetFileName((string)"sphere.pvtk");
            mapper3 = vtkPolyDataMapper.New();
            mapper3.SetInputConnection((vtkAlgorithmOutput)pReader3.GetOutputPort());
            mapper3.SetNumberOfPieces((int)2);
            mapper3.SetPiece((int)0);
            mapper3.SetGhostLevel((int)1);
            mapper3.Update();
            File.Delete("sphere.pvtk");
            File.Delete("sphere.0.vtk");
            File.Delete("sphere.1.vtk");
            File.Delete("sphere.2.vtk");
            File.Delete("sphere.3.vtk");
            actor3 = new vtkActor();
            actor3.SetMapper((vtkMapper)mapper3);
            actor3.SetPosition((double)6, (double)6, (double)6);
            // Add the actors to the renderer, set the background and size[]
            //[]
            ren1.AddActor((vtkProp)actor3);
        }


        ren1.SetBackground((double)0.1, (double)0.2, (double)0.4);
        renWin.SetSize((int)300, (int)300);
        // render the image[]
        //[]
        cam1 = ren1.GetActiveCamera();
        cam1.Azimuth((double)20);
        cam1.Elevation((double)40);
        ren1.ResetCamera();
        cam1.Zoom((double)1.2);
        iren.Initialize();
        // prevent the tk window from showing up then start the event loop[]

        //deleteAllVTKObjects();
    }