<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1458" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff
size=2>Ferdinando, </FONT></SPAN></DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff size=2>If
you call mesh->BuildCellLinks() then a data structure is created linking
points back to their cells. This information is held in the "cell links
container". Calling mesh->GetCellLinks() returns the container of cell
links. If the mesh is using the default mesh traits,
this</FONT></SPAN></DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff
size=2>container is a VectorContainer (subclass of Object and std::vector)
indexed by the PointId. </FONT></SPAN></DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff
size=2> </FONT></SPAN></DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff
size=2> mesh->GetLinks()[PointId] </FONT></SPAN></DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff size=2>will
return a PointCellLinksContainer. Again if the mesh trait is the default
mesh trait, the PointCellLinksContainer will be an
std::set<CellIdentifier>. So by calling</FONT></SPAN></DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff
size=2> mesh->BuildCellLinks();</FONT></SPAN></DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=383132613-22102004> <FONT face=Verdana
color=#0000ff size=2>MeshType::PointCellLinksContainer
cells;</FONT></SPAN></DIV>
<DIV><SPAN class=383132613-22102004> <FONT face=Verdana
color=#0000ff size=2>cells = mesh->GetLinks()[PointId];</FONT></SPAN></DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff
size=2>"cells" will hold the set of cell ids for a point (or the identifiers for
all the cells that use the point referred to by PointId).</FONT></SPAN></DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff size=2>You
can then iterate through this set of cells, to identify neighboring
points.</FONT></SPAN></DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff size=2>You
can get more detailed, looking for points that are actually connected to a
specified point by looking at the edges of the cells. You might want to look at
the </FONT></SPAN></DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff
size=2> </FONT></SPAN></DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff
size=2> MeshType::GetCellNeighbors(), </FONT></SPAN></DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff
size=2>
MeshType::GetCellBoundaryFeatureNeighbors().</FONT></SPAN></DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=383132613-22102004><FONT face=Verdana color=#0000ff
size=2>Jim</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> Ferdinando Rodriguez y Baena
[mailto:ferdinando.rodriguez@imperial.ac.uk]<BR><B>Sent:</B> Friday, October
22, 2004 7:53 AM<BR><B>To:</B> insight-users@itk.org<BR><B>Subject:</B>
[Insight-users] Obtaining a list of Cell IDs from a point
ID<BR><BR></FONT></DIV>
<DIV><FONT face=Arial size=2>Hi there,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>In the itkMesh type, is there any way I can sort
cell information according to a point ID? In other words, I know that each
cell contains pointers to a number of points in the mesh (i.e. list
of point IDs). However, as I am implementing a mesh closest point
search, I also need to get a list of cells connected to a specific
point. I use a KD tree search of the points to find the closest vertex in the
mesh, but then I need cell information related to that vertex to search the
surrounding facets.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Any help would be much appreciated.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thank you.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Ferdinando</FONT></DIV></BLOCKQUOTE></BODY></HTML>