Groups of vertices or cells

Hello everyone,

I am an FE guy working with large, unstructured datasets, and I am looking for advice on how to efficiently represent groups of vertices or cells in VTK.

One typical scenario in my work involves selecting or highlighting vertices and cells based on specific criteria, such as applied specific boundary conditions or assigned material type. Each vertex and cell may belong to multiple sets, which are generally sparse and contain only a small number of items.

While I can define point or cell datasets with Boolean values to indicate set membership, this approach becomes memory expensive for large problems.

I would appreciate suggestions for more efficient methods or approaches within VTK to handle set membership representation.

Thank you

Why wouldn’t you use a hashmap or map to create sets indicating membership? Of course the particulars depend on programming language, application needs, etc.

How many sets are you likely to have? If it is a small number, then you can add a scalar array to the dataset where each scalar is a bit mask, each bit indicates membership in a particular group.

If the number of sets is really small, say 16 or less, then you can create a color map with 2^n entries that will provide a specific color for each bit pattern. To change the highlighting, you could either modify the color map or switch to a different color map.

This assumes that your data doesn’t already have scalars that you are using for coloring.

Thank you for suggestion!

For large problems, there can be many sets (>100) and it depends on problem definition. Following your suggestion, one solution would be to use several scalars, each one encoding group of 32 sets, when using 32 bit integer encoding.

I am just not sure how this will impact end-users, as filtering and visualizing entities in individual sets can be elaborate and not straightforward.

Hmm, if there can be a large number of sets, then using scalars won’t be efficient.

Using vtkSelection might be the way to go, because you can create a selection from a list of points or a list of cell indices and if the number of points or cells per set is small, this would be memory-efficient. I’m not experienced with using vtkSelection, myself, so I can’t point you to any good examples, but as far as I understand, the basic idea is that you attach the vtkSelection to a VTK mapper and then you can control the way selected points/cells are displayed as compared to non-selected points/cells.

Thank you, I have been playing with selections in Paraview. The selections can be saved, but saving extracted selection saves the complete datasets (points with coordinates, cells with connectivity, with no reference to original one). However, all this data is already in the original dataset. Optimal approach would be only to store selected IDs. It seems to me that Paraview does not support loading standalone selections (with just IDs) so one needs to implement plugin for this. Will try to have a look on this in more detail.