Martin Sandve Alnæs wrote:
> 2008/4/13, Garth N. Wells <[EMAIL PROTECTED]>:
>> In the down casting functions in GenericTensor, what's the difference
>>  between
>>
>>    T* t = dynamic_cast<T*>(instance());
>>
>>  and
>>
>>    T* t = dynamic_cast<T*>(this);
>>  ?
> 
> 
> // Assume this is configured to use a PETScVector:
> GenericVector * v = new Vector();
> 
> // This won't work:
> PETScVector * pv = dynamic_cast<PETScVector*>(v);
> 
> // This will work (and is what down_cast does):
> PETScVector * pv = dynamic_cast<PETScVector*>(v->instance());
> 
> This was the only intended usage for instance().
> 

OK. Thanks!

Garth

> 
>>  Is there much overhead associated with a dynamic cast?
>>
>>  Garth
> 
> I have no idea how much overhead there is, but I'm assuming it won't
> be placed in inner loops anyway.
> 
> --
> Martin

_______________________________________________
DOLFIN-dev mailing list
[email protected]
http://www.fenics.org/mailman/listinfo/dolfin-dev

Reply via email to