How to return NaN for the probe located outside the domain?


I am using Paraview functions to read results of various point in my 2D simulation result (vtk format).
However, it returns 0 if I give a point outside the domain. Is it possible to return NaN for the points outside the domain? Or is the any way to check if the entered point is located inside or outside the domain.
Many thanks in advance for your help.

Which functions ? Please be specific.

I’m am quite new at using Paraview. Sorry for my vague question.

I am using Paraview simple module and importing them. This is my code:

from paraview import numpy_support as ns
from paraview.simple import *
probeResults = []
reader = OpenDataFile()
probe = ProbeLocation(reader, ProbeType = “Fixed Radius Point Source”)
probe.ProbeType.Center = # as [x,y,z]
reader.FileNames =
data = servermanager.Fetch(probe)

If I enter a point outside of the domain, it returns 0. Is it possible to get NaN for points outside the domain?

You can use the “vtkValidPointMask” array to know if a point is outside the domain or not.

1 Like

Just now found it out and came to post it, and saw your reply.
Thanks a lot.

Hi Mathieu @mwestphal ,
How I may get the results for multiple points? (like giving an array of points and get an array of results)
I tried to add more than one point in the code above, but it didn’t work.

Thanks a lot for your kind help.

no idea what you mean

For instance, I want to know the results from the dataset for 1000 points (let’s say stored in a list [[x1,y1,z1],[x2,y2,z2],…,[x1000,y1000,z1000]]
Is there a way to give this list to ProbeLocation and return a list of 1000 results corresponding to the 1000 points?
I am asking because, I need to accelerate my code. Currently I need to use a for loop and call the function 1000 times, which is too slow for me.

Many thanks for your kind advice.

If you can pass this point list server side, you can use ResampleWithDataSet

1 Like

Thanks a lot. I will try that.