Paraview Sample Over Line

Hi,

what is the equivalent vtk class used in the Paraview sample over line GUI? I would like to replicate it in python with the vtk wrappers

Best

Internally, ParaView is using the custom vtkPVProbeLineFilter. I believe this is basically doing a vtkProbeFilter with a vtkLineSource but with a lot of special sauce to make it work in parallel.

Thanks a lot!
It seems that I was able to find it but I am unable to locate the equivalent of Sampling Pattern in the vtk python wrapper where only the following methods are exposed

    def CategoricalDataOff(self) -> None: ...
    def CategoricalDataOn(self) -> None: ...
    def ComputeToleranceOff(self) -> None: ...
    def ComputeToleranceOn(self) -> None: ...
    def GetCategoricalData(self) -> int: ...
    def GetCellLocatorPrototype(self) -> 'vtkAbstractCellLocator': ...
    def GetComputeTolerance(self) -> bool: ...
    def GetFindCellStrategy(self) -> 'vtkFindCellStrategy': ...
    def GetNumberOfGenerationsFromBase(self, type:str) -> int: ...
    @staticmethod
    def GetNumberOfGenerationsFromBaseType(type:str) -> int: ...
    def GetPassCellArrays(self) -> int: ...
    def GetPassFieldArrays(self) -> int: ...
    def GetPassPointArrays(self) -> int: ...
    def GetSnapToCellWithClosestPoint(self) -> bool: ...
    def GetSource(self) -> 'vtkDataObject': ...
    def GetSpatialMatch(self) -> int: ...
    def GetTolerance(self) -> float: ...
    def GetValidPointMaskArrayName(self) -> str: ...
    def GetValidPoints(self) -> 'vtkIdTypeArray': ...
    def IsA(self, type:str) -> int: ...
    @staticmethod
    def IsTypeOf(type:str) -> int: ...
    def NewInstance(self) -> 'vtkProbeFilter': ...
    def PassCellArraysOff(self) -> None: ...
    def PassCellArraysOn(self) -> None: ...
    def PassFieldArraysOff(self) -> None: ...
    def PassFieldArraysOn(self) -> None: ...
    def PassPointArraysOff(self) -> None: ...
    def PassPointArraysOn(self) -> None: ...
    @staticmethod
    def SafeDownCast(o:'vtkObjectBase') -> 'vtkProbeFilter': ...
    def SetCategoricalData(self, _arg:int) -> None: ...
    def SetCellLocatorPrototype(self, __a:'vtkAbstractCellLocator') -> None: ...
    def SetComputeTolerance(self, _arg:bool) -> None: ...
    def SetFindCellStrategy(self, __a:'vtkFindCellStrategy') -> None: ...
    def SetPassCellArrays(self, _arg:int) -> None: ...
    def SetPassFieldArrays(self, _arg:int) -> None: ...
    def SetPassPointArrays(self, _arg:int) -> None: ...
    def SetSnapToCellWithClosestPoint(self, _arg:bool) -> None: ...
    def SetSourceConnection(self, algOutput:'vtkAlgorithmOutput') -> None: ...
    def SetSourceData(self, source:'vtkDataObject') -> None: ...
    def SetSpatialMatch(self, _arg:int) -> None: ...
    def SetTolerance(self, _arg:float) -> None: ...
    def SetValidPointMaskArrayName(self, _arg:str) -> None: ...
    def SnapToCellWithClosestPointOff(self) -> None: ...
    def SnapToCellWithClosestPointOn(self) -> None: ...
    def SpatialMatchOff(self) -> None: ...
    def SpatialMatchOn(self) -> None: ...

Best

Uh, weird. The class has SetPoint1 and SetPoint2 methods. I don’t know why those are not coming through in the python bindings. (They must work with the client/server bindings.)

Maybe someone who knows more about the wrapping could answer.

I believe this is basically doing a vtkProbeFilter with a vtkLineSource but with a lot of special sauce to make it work in parallel.

After checking it is like that but I get different results when using the GUI in paraview and the vtk python bindings (Same starting and end point and same file)

GUI

python

Where the python bindings have been used as:

        line = LineSource(pointa, pointb, resolution).output
        alg = vtkProbeFilter()  # Construct the ProbeFilter object
        alg.SetInputData(line)  # Set the Input data (actually the source i.e. where to sample from)
        # Set the Source data (actually the target, i.e. where to sample to)
        alg.SetSourceData(wrap(self._obj))
        alg.SetPassCellArrays(True)
        alg.SetPassPointArrays(True)
        alg.SetPassFieldArrays(True)

        if locator:
            if isinstance(locator, str):
                locator_map = {
                    'cell': vtkCellLocator(),
                    'cell_tree': vtkCellTreeLocator(),
                    'obb_tree': vtkOBBTree(),
                    'static_cell': vtkStaticCellLocator(),
                }
                try:
                    locator = locator_map[locator]
                except KeyError as err:
                    msg = f'locator must be a string from {locator_map.keys()}, got {locator}'
                    raise ValueError(msg) from err
            alg.SetCellLocatorPrototype(locator)

        if tolerance is not None:
            alg.SetComputeTolerance(False)
            alg.SetTolerance(tolerance)

        _update_alg(alg, progress_bar, 'Resampling array Data from a Passed Mesh onto Mesh')
        return _get_output(alg), only_valid)

Vtk is installed as version

vtk                     9.4.2

The issue appear to be very close to the wall region where the local resolution is higher.

Any idea?