On Tue, 1 Dec 2009, Kirk, Benjamin (JSC-EG311) wrote:

> there are a number of places where we use function pointers, which seems
> like a pretty C-ish way to do a lot of things.

C-ish, but sometimes preferable to the common C++ virtual function
alternative, because composition and replacement is a little harder with
virtual functions.  In hindsight I wish I'd put the FEMSystem assembly
functions into a separate FEMPhysics class, for example.

> What if instead we declare a virtual function
> ExactSolution::exact_value(...) with the same interface as the function
> pointer.  The default behavior would the then to just call the function
> pointer inside the exact_value() method, but as an alternative the user
> could instead override exact_value() in a derived class?
>
> I'm thinking about this not so much from the perspective of ExactSolution,
> but rather from MaufacturedSolution, which I intend to derive from
> ExactSolution...

What are the advantages of a virtual function here?  Just the implicit
*this argument?  Would it be sufficient to use a functor class
instead?
---
Roy

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Libmesh-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to