Create a reader plugin to read multiple files into one vtkMultiBlockDataSet

(sharon) #1

Dear Experts,
Is it possible to write a reader plugin that can read multiple files’ content into one vtkMultiBlockDataSet?

In my situation, the data in each file is just a small block of the whole data, so i need to read them into one vtkMultiBlockDataSet then user selected all the files from UI.

Then in the pipeline browser view, all the file blocks will have the same parent

Any suggestion how to do this?

Thanks and Best Regards,

Sharon

(Mathieu Westphal (Kitware)) #2

You can’t create a reader that will output a single multiblockdataset and at the same time, have an item in the pipeline browser for each block.
But take a look into the Multiblock inspector instead (View -> MultiblockInspector)

Other then that, it is definitelly possible to a plugin that expose a reader that read multiples files into one vtkMultiBlockDataSet.

(sharon) #3

Thank you Mathieu!
I tried GroupDatasets filter, it works.
However, if i load 2 files, after this filter, there will be 3 groupDataSets and the last one is the one that contain all the blocks.

I expected result is only one groupDataSet, and its children under it, just like a tree view

Thank you!

Best Regards,
Sharon

(Mathieu Westphal (Kitware)) #4

If you implement your own filter, you have a full freedom on how the block are organized.

(sharon) #5

How to implement this? i found the pipeline already hard code one reader can only receive one file name…

(Mathieu Westphal (Kitware)) #6

A reader can receive a directory name.

1 Like
(sharon) #7

Thank you Mathieu!

I will have a try for this!

Best Regards

(sharon) #8

You mean I can read all the files under the same directory when user choose one file?

I am confused when user choose a directory, how can paraview know which reader to use?

And if i write my own reader, how can tell paraview to use my reader after user select certain directory?

Because for a file, there is a suffix to tell reader, but for a directory, how to know?

(Mathieu Westphal (Kitware)) #9

Yes

There is a pattern mechanism in the XML definition of the reader, see AMReX Particles Reader in readers.xml

(sharon) #10

Yes, I just tried to open a directory and found the reader you mentioned is appeared on the UI.
OK, I will take a look at it!

Big Thank You to you, Mathieu!

You really give me some ideas!

very Best Regards to you,
Sharon