-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to get neighbour cell or points? #2
Comments
I’m not familiar with what a large stencil is, but I’d probably go with using a kdtree as you’ll be able to quickly query the tree once you’ve set it up. pykdtree is one of the best out there, and it carries no dependancies. If you do need me to setup an adjency function, please comment with your intended pseudo-code. |
Still need help on this? |
I agree that it would be nice to have a few different adjacency/neighbourhood functions. These examples come to mind for neighbouring elements on a mesh:
And then this for a point cloud: Would certainly be features that'd be useful to have. |
it is not urgent for me but I think other people might be interested. So the pseudo-code I have in my mind would be let's say we tried to find 2-level of Neighour for each cell
Then This union set for i-cell is the 2-level neighour set. Note that we know all of the spatial information so we can do really fancy things like computing any partial derivatives on any directions, so getting curvature is trivially easy. |
This is different than a meshless kdtree as it requires knowledge of the mesh connectivity. I’d be happy to add in cell based neighbor querying. BTW, I liked the blog. If you wish, you can also visualize within python without heading over to paraview with: grid.Plot(scalars=p2_cell) See help(grid.Plot) for more details on how you can change the color map and other plotting variables. |
@pswpswpsw, could we add your blog post to the Long Examples section of the website? Also, is there a status on the proposed feature requests? Should we outline some features that should/could be added to |
No problem! Indeed, I will have some more fancy figures later within 2 months on that post! I will keep you updated! |
I don't want to look deep into VTK but just simply using your vtkInterface to get the information for a cell or point, getting the index for nearby points.
For example, i can use
grid.cell_arrays
orgrid.point_array
together withgrid.points
to get adict
of all the "nearly useful" information. But I want to obtain the nearest neighbour for a given point, which enables much flexibility in postprocessing the vtk formatted data. Is it possible using the existing method in vtk? I am asking because I find something likeGetCellNeighbors
but since it requires going deep into vtk so I cound't do it on my own.Alternatively, I know I can using another package such as
kdTree
to search fork-nearest neighour
on my own but just curious if there is something already there.By the way, I think using the
kdTree
would enable much more flexibility since if I want to compute a very high order finite difference, I need a large stencil which I thinkGetCellNeighbors
won't give me but selecting a large enough k,k-nearest neighour
might give me. I don't know if it is something also your interests.update on the kdtree to find a large stencil.
Oh, I think if one can get neighour then one can easily use that to recursively get
k-nearest neighour
without using another package such as kdTree, since kdTree requires some sort of computational time.The text was updated successfully, but these errors were encountered: