[Insight-developers] Cell Faces

Brad King brad.king@kitware.com
Tue, 19 Jun 2001 17:05:19 -0400 (EDT)


>       Cell::Pointer testCell2;
>       mesh->GetCell(0, &testCell2);
[snip]
>           facePointer = ((TetraCell::Pointer)testCell2)->GetFace(i);

This is where RTTI can come in handy.  You want code like this:

typename TetraCell::Pointer tetraCell =
  dynamic_cast<TetraCell*>(testCell2.GetPointer());

if(tetraCell)
  {
  for(int i=0;i < numFaces;++i)
    {
    facePointer = tetraCell->GetFace(i);
    //...
    }
  }
else
  {
  // cell was not a tetrahedron, so dynamic_cast returned null.
  }

I think a better interface is needed to do this, though.  I will see
about adding one soon.

-Brad