Hi,
I don’t quite understand how vtkCell::Clip() returns the information about the clipping artifacts.
As far as I can see the connectivity is returned as a vtkCellArray called connectivity in the documentation. To my understanding the array is of the form number of points, followed by point is for the clipping artefact cells.
However, how do I know what type of cell (tetra, wedge, etc) the artefact pieces are?
It’s a bit of a special case related to reservoir simulations. I try to calculate the liquid level in each cell for a given saturation. For this I need to clip each cell (which can be any shape, including a polyhedron) through multiple points (each of its vertex elevations, plus more auxiliary levels), and calculate the volume of the clipped part. Using vtkTableBasedClipDataSet would be inefficient since it would clip the whole dataset for each required elevation.
Since you have a given saturation in mind, first use a vtkThreshold filter to get the subset of your dataset that you wanna clip and then use a vtkTableBasedClipDataSet to perform the clip. This way, clip is only performed on the subset of dataset that you care about.
Creating your own clipping algorithm will not beat the combination of two highly optimized memory/performance wise filters such as vtkThreshold, vtkTableBasedClipDataSet.
But since vtkTableBasedClipDataSet is publication-worthy optimized, i would compare vtkThreshold and vtkTableBasedClipDataSet vs just vtkTableBasedClipDataSet.
That’s not quite my intention, there is no specific global saturation for which I could create a liquid level (in which case your methods would work well).
Rather, for each cell I need to figure out where the liquid level would be, given an individual saturation (volume fraction) for that cell. Since my grids are unstructured and can contain polyhedron cells this needs to be done on a cell-by-cell analysis.
Oh so you wanna use the clip filter with a point scalar array named saturation and the isovalue is the given saturation? If yes, then just use vtkTableBasedClipDataSet and set the array and isovalue to it.
vtkTableBasedClipDataSet will handle all cell types, including polyhedrons (which are delegated to vtkClipDataSet).
Note that given the fact that clipping operates on a point scalar array, if the array you care about is a cell scalar array, you will need to use a vtkCellDataToPointData to do what you want.
For the given geometry of the cell, and a known saturation (say 20%, different for each cell), I need to work out where the liquid level in that particular cell is located.
My intended approach is to analyze each cell once and then to use quadratic interpolations. This way I can output the liquid level many times over without additional computational costs after the analysis phase.
To analyse the cell I want to determine the volume of the lower part of the cell a) at each unique elevation of the cell vertices, and b) at mid-points, since I need additional points to fit quadratic functions.
Using vtkCell::Clip() gives me the correct answer for each cell. However I am just struggling to put the results from that operation back together. I am currently looking at vtkOrderedTriangulator which could work on the points created. I am actually not interested in creating the clipped cell artifacts; all I want to do is figure out their volume, for which tetrahedrons would be ideal.
Thanks for the hint. It looks like for 3D cells the clip artifacts are either a VTK_WEDGE or VTK_TETRA, nothing else. So the cell type can be identified via the number of points (4 or 6). That’s probably all I needed from there.