On Fri, Apr 25, 2008 at 11:09:37PM +0100, Garth N. Wells wrote: > > > Anders Logg wrote: > > Why should the functions be virtual? > > > > This was discussed the other day (brought up by Ola) > > http://www.fenics.org/pipermail/dolfin-dev/2008-April/007496.html > > and has been implemented for a few functions in various la classes. I > was indifferent before to it, but now I see a benefit with the matrix > classes. If it's clear to me that a function is a virtual function, I > know that it can't be inlined and there will be some overhead which is > important to know for some operations. > > Garth
ok, now I remember. I also remember I thought it was a good idea at the time, but I'm not so sure now. Ola wrote: > Should we put adding the virtual keyword to > virtual methods on the todo-list? After all, the virtual keyword > adds information to the user. I think it's the opposite. The virtual keyword does not add information to the user, it confuses the user. If someone sees "virtual", he will think that it might be a good idea to subclass and overload the function, but that's not the intention here. Our clear intention is that Vector, uBlasVector, PETScVector, EpetraVector etc should be final implementations and not be subclassed. Of course it can be done but we shouldn't encourage it. So I think we should not have virtual in these classes, which adds information, namely that we don't want users to subclass them. -- Anders _______________________________________________ DOLFIN-dev mailing list [email protected] http://www.fenics.org/mailman/listinfo/dolfin-dev
