[Paraview] ExtractBlock on PVDReader object

Arno Mayrhofer arno.mayrhofer at dcs-computing.com
Mon Jun 25 05:23:34 EDT 2018


Hi all,

I am currently working on a small Python script that should extract a 
block from a vtkMultiBlockDataSet. In particular, I have a PVD file 
which links each time step to the respective vtkMultiBlockDataSet. So I 
started with

pvd = OpenDataFile("data.pvd")

in general it's straightforward to extract a block via

eb = ExtractBlock(Input=pvd)
eb.BlockIndices = [1]

now I previously wrote my vtm files in serial. Because of that I knew 
exactly what the index of my block was (1 in this case). Now I'm writing 
my vtm files in parallel and using ParaView's trace functionality told 
me that my indices of the different blocks are completely different. So 
I would like to know how to get the index of the block I want to 
extract. I know the name of the block, so ideally I can have a get 
function that takes the name string as input and gives me the index 
integer as output.

The only success I had was actually reading the name of my blocks using

pvd.GetDataInformation().GetCompositeDataInformation().GetName(1)

or equivalently

pvd.GetDataInformation().GetCompositeDataInformation().GetDataInformation(1).GetCompositeDataSetName()

but I could not figure out how to obtain the index from these 
vtkPVDataInformation objects.

Any help is appreciated.

Kind regards,
Arno



More information about the ParaView mailing list