[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. Using the mesh =
example in cvs=20
as a base, i have been trying to get cells and their faces from the =
mesh. =20
The mesh i am using has a tetrahedron cell in it, which i get using the=20
following lines:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> Cell::Pointer =
testCell2;<BR> mesh->GetCell(0,=20
&testCell2);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </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> const =
char * name =3D=20
testCell2->GetClassName();<BR> std::cout =
<<=20
name << std::endl;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> if(name =
=3D=3D=20
"TetrahedronCell")<BR> {<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </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. Seems logical to use the GetFace function, and then get the =
vertices=20
from each individual face. 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. I tried the following =
code:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> =
typedef=20
itk::TetrahedronCell<int, CellTraits> =
TetraCell;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> =
int numFaces=20
=3D 4;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> =20
TetraCell::Pointer tetraPointer;<BR> =
=20
TetraCell::FacePointer facePointer;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> =
for(int i=3D0;i=20
< numFaces;i++)<BR> =20
{<BR> facePointer =3D=20
((TetraCell::Pointer)testCell2)->GetFace(i);<BR> =20
}<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. I also tried creating a new =
FacePointer and setting it equal to testCell2 with no success. Is =
there=20
another way to do this?</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> =20
=
=20
=
=20
=
=20
=
=20
=
=20
=
=20
=
=20
=
=20
Aaron Cois</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> </DIV></FONT>
<DIV> </DIV>
<DIV> </DIV></BODY></HTML>
------=_NextPart_000_00AD_01C0F8DE.9E3B79E0--