[vtkusers] Fwd: problems with GetCellNeighbors

Andy Bauer andy.bauer at kitware.com
Thu Jan 21 13:00:31 EST 2010


To clear up some confusion, the only topological grid structures that
vtkUnstructuredGrid has are points and cells.  For vtkUnstructuredGrid
though there are a bunch of cell types (e.g. lines, quads, tris, vertices,
tets, hexes, etc.).  So neighbors/adjacency is really only determined
through cells that share the same points (if two points have the same
coordinate location this still does not count in the neighbor calculation).

Also, you may want to clarify your concept of neighbors.  It looks like when
you say face neighbors of a tet you mean another 3D cell that shares 3
points with that tet (could be another tet, a prism, or a pyramid).  Of
course it's possible that someone specified a tri cell in the grid that also
uses those same 3 points and then according to VTK this cell would also be
considered a neighbor of that tet.  Other people may consider a neighbor any
cell that shares at least one point with the specified cell.

So to hopefully finally answer your question (assuming I can infer the
specifics of your question), an algorithm to get the 3D neighbor cells of a
tet you'd have to call GetCellNeighbors() 4 times where the cellId is the
vtkIdType of the cell you want the neighbors of, the ptIds list for each
call would be {cell point 0, cell point 1, cell point 2}, {cell point 0,
cell point 1, cell point 3}, {cell point 0, cell point 2, cell point 3}, and
{cell point 1, cell point 2, cell point 3}.  Assuming you have no 2D cells
in your mesh that use any of the list of points and you have a valid
topological grid, the cellIds list returned would either have size 0 (no
neighbor for the given list of points) or 1 (the cell Id of the 3D cell that
also uses the given list of points).

You may want to get the VTK User's Guide to get a better idea of the grid
data structures inside of VTK (p. 334 & 335 have the cell definitions in UG
#5).

Andy


> Date: Thu, 21 Jan 2010 10:06:04 +0200
> From: Bill Chivas <noo134 at googlemail.com>
> Subject: [vtkusers] Fwd: problems with GetCellNeighbors
> To: vtkusers at vtk.org
> Message-ID:
>        <1668c8ff1001210006g76bbe198ve5ed73c75addfc3e at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
>  *GetCellNeighbors*   (  vtkIdType  *cellId*,    vtkIdList *  *ptIds*,
> vtkIdList *  *cellIds*   )
>
> 1) cellid is the cell i want its neighbors. As "cell" is a e.g. tetrahedron
> cell or one of its faces?
> 2) ptids are cell's points or one of its faces' points?
> 3) cellids are cells (e.g. neighboring tetrahedra) or faces (neighboring
> faces)?
>
> I'm a little confused!
>
>
> 2010/1/20 Dominik Szczerba <domi at vision.ee.ethz.ch>
>
> -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > Yes, GetCellNeighbours is the way to go. AFAIR it expect cell FACE ids
> > and will return all cells containing all given points.
> >
> > Dominik
> >
> > Bill Chivas wrote:
> > > It is an old post (/Tue Jun 27 04:01:59 EDT 2006/).
> > > Is it correct?
> > > How can i get all neighbors (for cell NOT cell face)?
> > >
> > >>OK just for others in future - I figured it out.
> > >>It is nowhere clearlystated but GetCellNeighbours needs
> > >>cell face points and not cell points.
> > >>It returns cell face neighbours and not all neighbours.
> > >>Dominik
> >
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.9 (GNU/Linux)
> >
> > iEYEARECAAYFAktW+JsACgkQ/EBMh9bUuzJuMwCgpx0v8VEqJNbkg2v14dyFUaHC
> > 5wcAoNJRWwdua2vxF4mzM+NgTqtyrejP
> > =Uo3b
> > -----END PGP SIGNATURE-----
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://www.vtk.org/pipermail/vtkusers/attachments/20100121/b44c1be8/attachment-0001.htm
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100121/02b86911/attachment.htm>


More information about the vtkusers mailing list