[vtkusers] matrix of neighborhood

Bryn Lloyd blloyd at vision.ee.ethz.ch
Mon Sep 28 06:49:11 EDT 2009


You can iterate over all points and get the neighboring cells (= cells 
using point). See the function:
	vtkUnstructuredGrid::GetPointCells

Based on these cells you can also get the neighboring points. See the 
function:
	vtkUnstructuredGrid::GetCellPoints


something like this:

vtkIdList cids = vtkIdList::New(); // cell neighbors
vtkIdList pids = vtkIdList::New(); // point neighbors
for(int i=0; i<mesh->GetNumberOfPoints(); i++) {
   mesh->GetPointCells(i, cids);

   for(int k=0; k<cids->GetNumberOfIds(); k++) {
     mesh->GetCellPoints(cids->GetId(k), pids);

     // do something with these neighbors

   }
}
cids->Delete();
pids->Delete();








InfoSeekerr wrote:
> Dear All
> 
> I have a 3D unstructured mesh I need to get matrix of neighborhood for the
> nodes 
> 
> wish any one answer me 
> 
> 
> Best regards 


-- 
-------------------------------------------------
Bryn Lloyd
Computer Vision Laboratory
ETH Zürich, Sternwartstrasse 7, ETF C110
CH - 8092 Zürich, Switzerland
Tel: +41 44 63 26668
Fax: +41 44 63 21199
-------------------------------------------------



More information about the vtkusers mailing list