[petsc-users] A problem with MatFDColoringSetFunction

Zou, Ling lzou at anl.gov
Mon Jan 10 15:35:31 CST 2022

Hi All,

I would appreciate if you could give some advice for setting the ‘FormFunction’ for the MatFDColoringSetFunction function call.
I follow what is shown in the example:

I setup similar code structure like:
PetscErrorCode FormFunction(SNES,Vec,Vec,void*);
Then use it as:
MatFDColoringSetFunction(fdcoloring, (PetscErrorCode(*)(void))SNESFormFunction, this);

This works fine on my local MacOS. However, when commit it to a remote repo, the compiler there gives me the following error (where warnings are treated as errors):

src/base/PETScProblemInterface.C:100:67: error:
cast between incompatible function types from
'PetscErrorCode (*)(SNES, Vec, Vec, void*)' {aka 'int (*)(_p_SNES*, _p_Vec*, _p_Vec*, void*)'}
'PetscErrorCode (*)()' {aka 'int (*)()'} [-Werror=cast-function-type]

Any help is appreciated.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220110/f6418c79/attachment.html>

More information about the petsc-users mailing list