Is there a way to get information about the partitions in a vtkPartitionedDataSet object? For blocks that are in a vtkPartitionedDataSetCollection, I can see information about the blocks in the MultiBlock Inspector and other places. However, the ParaView GUI treats a vtkPartitionedDataSet as a single entity.
I understand why ParaView is doing this, except sometimes when debugging meshes I really need to inspect the partitions under the vtkPartitionedDataSet. Is there an easy way to do this?
Thanks for the suggestion, @mwestphal . Unfortunately, that is not working for me.
In my case, the vtkPartitionedDataSet is nestled in a vtkPartitionedDataSetCollection. The top level object is converted to a vtkMultiBlockDataSet, but the contained partitions are converted to a vtkMultiPieceDataSet. ParaView seems to be treating the vtkMultiPieceDataSet the same way it treats the vtkPartitionedDataSet.
I hacked away around this. You can use a Programmable Filter to pull out all the partitions to each have its own block. Here is the script that I used:
input0 = inputs[0]
def convert_partitions(src: vtk.vtkPartitionedDataSetCollection,
dest: vtk.vtkPartitionedDataSetCollection):
# Count partitions
num_partitions = 0
for block_i in range(0, src.GetNumberOfPartitionedDataSets()):
block = src.GetPartitionedDataSet(block_i)
num_partitions += block.GetNumberOfPartitions()
print("Num partitions", num_partitions)
dest.SetNumberOfPartitionedDataSets(num_partitions)
# Convert partitions to blocks
partition_i = 0
for block_i in range(0, src.GetNumberOfPartitionedDataSets()):
block = src.GetPartitionedDataSet(block_i)
for block_part_i in range(0, block.GetNumberOfPartitions()):
partition = vtk.vtkPartitionedDataSet()
partition.SetNumberOfPartitions(1)
partition.SetPartition(1, block.GetPartition(block_part_i))
dest.SetPartitionedDataSet(partition_i, partition)
partition_i += 1
convert_partitions(input0.VTKObject, output.VTKObject)
To make this a bit easier, here is a python script that can be loaded as a plugin. It will create a filter named Partitions To Blocks that will do the same thing.
Ha right, my solution seems to work only with a partitioned dataset, not with a pdc.
TBF this could be added to ConvertToMB or ConvertToPDC very easily.