[vtkusers] best_way_of_writing_transient_multiblocks(unstructured grid dataSets)
Giorgos Ragkousis
giorgosragos at gmail.com
Thu Jan 7 07:53:10 EST 2016
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160107/76d64d16/attachment.html>
More information about the vtkusers
mailing list