[petsc-dev] Questions about MatMatTransposeMult/MatMatMultTranspose

Jed Brown jedbrown at mcs.anl.gov
Tue Nov 1 12:23:08 CDT 2011


On Tue, Nov 1, 2011 at 11:14, Dmitry Karpeev <karpeev at mcs.anl.gov> wrote:

> In fact, it could be done rather easily even in the most general case.
>  For example, using a pair of variadic functions:
> PetscMethodRegister(void (*f)(void), const char* name, const char*
> arg1Type, const char* arg2Type, ...)
> PetscMethodQuery(void (**f)(void), const char* name, const char* arg1Type,
> const char* arg2Type, ...)
>

Do you really mean for this to be a variadic function? How would you know
how many args to pick off?


> The only wrinkle here is the need to cast f to the right function pointer
> type.
>

It's a dynamic lookup anyway, so the caller chooses the type and everything
underneath works with void(*)(void).

Your suggestion to use a single PetscFList is okay, but any time it makes
sense to list the available types, we want to resolve the first type before
consulting the FList, because then -help can work. This is purely an
end-user interface detail, so if you make the change above, we can adjust
the internal data structure without touching the call sites.


> Under the hood it's a simple search through an FList on the name and the
> arg types.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20111101/32d771ba/attachment.html>


More information about the petsc-dev mailing list