Quantcast

best_way_of_writing_transient_multiblocks(unstructured grid dataSets)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

best_way_of_writing_transient_multiblocks(unstructured grid dataSets)

Giorgos Ragkousis

Dear vtkusers,


I am trying to develop an efficient method for writing different vtk unstructured grid datasets which change with time in a single vtk file.


In particular, we have an in-house Boundary Element solver and we would like to save element and node information (unstructured grid DataSets) in a single file. Then, by using vtk methods we would like to visualise the results.


The main question I would like to ask is whether any of you have developed similar vtk applications and what would be the optimal way. I found that multiblocks can be saved in either exodus or vtm file. What is the difference? Is there any other way?


How could I save different time steps of these multiblocks? Is there any simple example of creating such a file? Moreover, I found that vtkHierrarchicalBoxDataSet is for Adaptive Meshing. Is there any example?


Lastly, how I could extract a specific block from a multiblock by giving its name. In the following code I have managed to extract a certain block by giving its index only. Is it possible to call a block from each name?


       private void MultiBlockDisplay()
        {
            string path;
            string domainName;
            string fileName;

            vtkRenderer ren = vtkRenderer.New();
            ren.SetBackground(0.2, 0.3, 0.4);
            vtkRenderWindow renWin = renderWindowControl1.RenderWindow;
            renWin.AddRenderer(ren);
            vtkRenderWindowInteractor iren = vtkRenderWindowInteractor.New();
            iren.SetRenderWindow(renWin);

            uint number = 2;
            vtkMultiBlockDataSet mbset = vtkMultiBlockDataSet.New();
            mbset.SetNumberOfBlocks(number);

            for (uint i = 0; i < number; i++)
            {
                vtkUnstructuredGridReader reader = vtkUnstructuredGridReader.New();

                path = @"C:\\A_directory\\";
                domainName = "MultiBlock_" + i.ToString();
                fileName = path + domainName + ".vtk";

                reader.SetFileName(fileName);
                reader.SetReadAllScalars(1);
                reader.SetReadAllVectors(1);
                reader.Update();

                mbset.SetBlock(i, reader.GetOutput());

                mbset.GetMetaData(i).Set(vtkCompositeDataSet.NAME(), domainName);

                //The following bit prints the name for each block
                string nameDOM = mbset.GetMetaData(i).Get(vtkCompositeDataSet.NAME());
                Debug.Print(nameDOM);
               
            }

            vtkUnstructuredGrid ug = vtkUnstructuredGrid.SafeDownCast(mbset.GetBlock(1));

            vtkDataSetMapper mapper = vtkDataSetMapper.New();
            mapper.SetInput(ug);

            vtkActor actor = vtkActor.New();
            actor.SetMapper(mapper);

            ren.AddActor(actor);

            ren.SetBackground(0.2, 0.3, 0.4);

        }

 

Many thanks in advance.

 

Kindest regards,


Giorgos


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: best_way_of_writing_transient_multiblocks(unstructured grid dataSets)

kayarre

Hi Giorgos,
   I am interested in a similar problem. I have some ensight Gold files that I want to convert to a vtk/paraview format, but the files don't have time information and I would like to include that.


Were you able to construct a solution to include the time information into each file?

Regards,
   ~Kurt
Loading...