[Insight-developers] Cell Faces

C. Aaron Cois cacst11+@pitt.edu
Tue, 19 Jun 2001 16:40:58 -0400


This is a multi-part message in MIME format.

------=_NextPart_000_00AD_01C0F8DE.9E3B79E0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Greetings all.  Using the mesh example in cvs as a base, i have been =
trying to get cells and their faces from the mesh.  The mesh i am using =
has a tetrahedron cell in it, which i get using the following lines:

      Cell::Pointer testCell2;
      mesh->GetCell(0, &testCell2);

The next few lines verify that it is a tetrahedron cell:

      const char * name =3D testCell2->GetClassName();
      std::cout << name << std::endl;

      if(name =3D=3D "TetrahedronCell")
      {


when this is proven true, the number of faces can be assumed, and i =
would like to cycle through and get the vertices of each face.  Seems =
logical to use the GetFace function, and then get the vertices from each =
individual face.  Probhlem is, since the type of cell was not known when =
it was found in the mesh, the pointer to it (testCell2) is a generic =
Cell/CellInterface Pointer.  I tried the following code:

        typedef itk::TetrahedronCell<int, CellTraits>  TetraCell;

        int numFaces =3D 4;

        TetraCell::Pointer tetraPointer;
        TetraCell::FacePointer facePointer;

        for(int i=3D0;i < numFaces;i++)
        {
          facePointer =3D ((TetraCell::Pointer)testCell2)->GetFace(i);
        }

which did not work, giving an error on the attempt to type cast the =
generic cell pointer.  I also tried creating a new FacePointer and =
setting it equal to testCell2 with no success.  Is there another way to =
do this?

                                                                         =
                                                                   Aaron =
Cois




------=_NextPart_000_00AD_01C0F8DE.9E3B79E0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2920.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Greetings all.&nbsp; Using the mesh =
example in cvs=20
as a base, i have been trying to get cells and their faces from the =
mesh.&nbsp;=20
The mesh i am using has a tetrahedron cell in it, which i get using the=20
following lines:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;  Cell::Pointer =

testCell2;<BR>&nbsp;&nbsp;&nbsp; &nbsp; mesh-&gt;GetCell(0,=20
&amp;testCell2);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The next few lines verify that it is a =
tetrahedron=20
cell:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><BR>&nbsp;&nbsp;&nbsp; &nbsp; const =
char * name =3D=20
testCell2-&gt;GetClassName();<BR>&nbsp;&nbsp;&nbsp; &nbsp; std::cout =
&lt;&lt;=20
name &lt;&lt; std::endl;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp; if(name =
=3D=3D=20
"TetrahedronCell")<BR>&nbsp;&nbsp;&nbsp; &nbsp; {<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>when this is proven true, the number of =
faces can=20
be assumed, and i would like to cycle through and get the vertices of =
each=20
face.&nbsp; Seems logical to use the GetFace function, and then get the =
vertices=20
from each individual face.&nbsp; Probhlem is, since the type of cell was =
not=20
known when it was found in the mesh, the pointer to it (testCell2) is a =
generic=20
Cell/CellInterface Pointer.&nbsp; I tried the following =
code:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
typedef=20
itk::TetrahedronCell&lt;int, CellTraits&gt;&nbsp; =
TetraCell;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
int numFaces=20
=3D 4;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
TetraCell::Pointer tetraPointer;<BR>&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
TetraCell::FacePointer facePointer;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
for(int i=3D0;i=20
&lt; numFaces;i++)<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; facePointer =3D=20
((TetraCell::Pointer)testCell2)-&gt;GetFace(i);<BR>&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; }<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>which did not work, giving an error on =
the attempt=20
to type cast the generic cell pointer.&nbsp; I also tried creating a new =

FacePointer and setting it equal to testCell2 with no success.&nbsp; Is =
there=20
another way to do this?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; Aaron Cois</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;</DIV></FONT>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_00AD_01C0F8DE.9E3B79E0--