Re: [petsc-users] A problem with MatFDColoringSetFunction

2022-01-10 Thread Zou, Ling via petsc-users
Thank you Barry.

-Ling

From: Barry Smith 
Date: Monday, January 10, 2022 at 5:13 PM
To: Zou, Ling 
Cc: PETSc 
Subject: Re: [petsc-users] A problem with MatFDColoringSetFunction

  This is annoying. You need to pass in a compiler flag to turn off the error 
conditioner for casting a function pointer. It may be 
-Wnoerror=cast-function-type just google.

  Barry



On Jan 10, 2022, at 4:35 PM, Zou, Ling via petsc-users 
mailto:petsc-users@mcs.anl.gov>> wrote:

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:
https://petsc.org/release/src/snes/tutorials/ex14.c.html

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*)'}
to
'PetscErrorCode (*)()' {aka 'int (*)()'} [-Werror=cast-function-type]

Any help is appreciated.

-Ling



Re: [petsc-users] A problem with MatFDColoringSetFunction

2022-01-10 Thread Barry Smith

  This is annoying. You need to pass in a compiler flag to turn off the error 
conditioner for casting a function pointer. It may be 
-Wnoerror=cast-function-type just google.

  Barry


> On Jan 10, 2022, at 4:35 PM, Zou, Ling via petsc-users 
>  wrote:
> 
> 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:
> https://petsc.org/release/src/snes/tutorials/ex14.c.html 
> 
>  
> 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*)'}
> to 
> 'PetscErrorCode (*)()' {aka 'int (*)()'} [-Werror=cast-function-type]
>  
> Any help is appreciated.
>  
> -Ling



[petsc-users] A problem with MatFDColoringSetFunction

2022-01-10 Thread Zou, Ling via petsc-users
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:
https://petsc.org/release/src/snes/tutorials/ex14.c.html

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*)'}
to
'PetscErrorCode (*)()' {aka 'int (*)()'} [-Werror=cast-function-type]

Any help is appreciated.

-Ling


Re: [petsc-users] Is old ex10.c (separated matrix and rhs) deprecated?

2022-01-10 Thread Barry Smith


  You can put them in different files or in the same file. If you put them in 
the same file you need to know which object comes first the matrix or the 
vector, this tells you if you should call MatLoad first or VecLoad.

  Barry


> On Jan 10, 2022, at 2:33 PM, Danyang Su  wrote:
> 
> Hi All,
> 
> Back to PETSc-3.8 version, the example ex10.c supports reading matrix and 
> vector from separated files. Is this feature deprecated in the new PETSc 
> version? I have some matrix and rhs to test but could not use ex10 example 
> under new PETSc version.
> 
> Thanks,
> 
> Danyang
> 



[petsc-users] Is old ex10.c (separated matrix and rhs) deprecated?

2022-01-10 Thread Danyang Su

Hi All,

Back to PETSc-3.8 version, the example ex10.c supports reading matrix 
and vector from separated files. Is this feature deprecated in the new 
PETSc version? I have some matrix and rhs to test but could not use ex10 
example under new PETSc version.


Thanks,

Danyang