← Back to team overview

yade-dev team mailing list archive

Re: [Branch ~yade-dev/yade/trunk] Rev 2185: py wrapping for shop::getSpheresVolume(). Used e.g. for computing porosity in a periodic cell.

 

> > Where "sphere" is a pointer to an existing Sphere?
> > "typeid" replaces getCLassIndex?
> Ah, no... it must be the class "Sphere" itself obviously?
> Is there really nothing like classIndex now? Just curious.
There still is getClassIndex(), but it is more complicated and possibly
slower: you need to get index of sphere first, remember it somewhere
etc. typeid is standard operator, which accepts type or object.
Therefore you can test if(typeid(*b->shape)==typeid(Sphere)); the
disadvantage is that (unlike dynamic_cast), it will be false for Shapes
derived from Sphere, which is not so much concern, I think;
getClassIndex() would fail there, too.

v





References