I have a mesh with information of the cell centers.
I have a .vtk file with information on the face centers. These are displayed as gaussian points.
I would like to extract one cell of the domain and get the corresponding face information.
How can I do that? Is there a way to extract closest points to a certain geometry (extracted cell)?
Hi @Chica_ron !
You may want to look to a similar problem described here . The last post contains a script that extracts all cells around a point. You should be able to adapt it for your case.
I will take a look into it. Thanks!
I am kind of lost in this.
I understand what the script should do:
Ask the user for a mesh input and points input:
Ask for a list of cell_id’s
Loop through each cell ID and check which points are inside/on the border of cell from in points input.
Isolate the points together with the cell.
from vtkmodules.vtkCommonDataModel import vtkDataSet
from vtkmodules.util.vtkAlgorithm import VTKPythonAlgorithmBase
from paraview.util.vtkAlgorithm import smproxy, smproperty
@smproxy.filter(label="Extract Points Inside Cells")
self.cell_ids = set()
def RequestData(self, request, inInfo, outInfo):
mesh_input = vtkDataSet.GetData(inInfo)
# points_input = vtkDataSet.GetData(inInfo) This gives an error
def processGrid(self, ug):
# this routine is not working
allCellIdsList = vtk.vtkIdList()
for pointId in self.points:
cellIdsList = vtk.vtkIdList()
for i in range(cellIdsList.GetNumberOfIds()):
# extract all cells into a separate grid
extract = vtk.vtkExtractCells()
@smproperty.intvector(name="Cell ID", default_values=0)
def SetCellIDs(self, cell_ids_str):
self.cell_ids = 
self.cell_ids = [int(cell_id) for cell_id in cell_ids_str.split(',')]
How can I get
Does paraview have any routine given the
cell ID to collect the associated points and check if another point is inside the cell?
How can I
print variables inside these functions. The
print(var)does not appear to work