Topic: Obtain specific element type from abstract class element

Hi all,

Does any one know how to get specific element type form abstract class element. For example,

Element *el = localizer->giveElementContainingPoint(mTipInfo.mGlobalCoord);

how can I know the element type, PlaneStress2dXfem, Qtrplanestress2dxfem, or else.

Thanks!

Re: Obtain specific element type from abstract class element

You can use dynamic_cast to test the element type, i.e.

StructuralElement *el = dynamic_cast< StructuralElement * >( domain->giveElement(1) );

if the cast is successful, dynamic_cast returns a value of type new_type. If the cast fails  it returns a null pointer.

Martin