On Wed, Oct 8, 2008 at 10:52 AM, Tim Kroeger
<[EMAIL PROTECTED]> wrote:
> Dear all,
>
> thank you very much for all your suggestions.
>
> I started implementing the thing now.  Find attached a patch that contains
> my first attempt.  It compiles well at the moment, but it most probably will
> not work as expected, because I did not have the time to test it yet, and I
> am not too much experienced in PETSc programming.

OK, I'd be interested to see the results of your testing.

> Any comments are welcome.  I will test the thing in the next days (by
> implementing the application that I need it for) and let you know when it
> works.

I'm a little nervous about casting a function pointer to a void*.
Technically this is not allowed (something about void* being reserved
for data pointers, google for "function pointer to void*" on
comp.lang.c++.moderated) which I assume is why you have used the
implementation-defined reinterpret_cast.  I think the main problem is
that "a void* is not required to be of adequate size to hold a
function pointer" but it is on all POSIX systems.

One possiblity might be instead of a vector<void*> for inner_ctx, a
pair<void*, void(*)(void)> unless you anticipate adding more and more
stuff to the inner_ctx vector...

This may be one of those things that is not allowed, but is
nevertheless done by everyone anyway?  We may have to do slightly
non-portable stuff to get around PETSc function prototype
requirements.  At the very least it might be worth checking the
results of the void* casts against NULL before you try to use them,
though I think only dynamic_cast is required to return NULL upon
failure.  Also, we might ask you to make this code
backwards-compatible with older versions of PETSc (or at least throw
errors) before we check it in.

-- 
John

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to