Re: [petsc-users] Fortran Interface NULL object / Casting

2024-02-23 Thread Matthew Knepley
On Thu, Dec 8, 2022 at 2:56 PM Barry Smith wrote: > >You would use *PETSC_NULL_DM*LABEL but Matt needs to customize the > PETSc Fortran stub for DMAddField() for you to handle accepting the NULL > from PETSc. > Sorry, I missed this message. The customization is done. Thanks, Matt

Re: [petsc-users] fortran interface to snes matrix-free jacobian

2023-12-20 Thread Barry Smith
n analytical one to implement. >> >> Best, Yi >> >> -Original Message- >> From: Jed Brown >> Sent: Wednesday, December 20, 2023 5:40 PM >> To: Yi Hu ; petsc-users@mcs.anl.gov >> Subject: Re: [petsc-users] fortran interface to snes matrix-fr

Re: [petsc-users] fortran interface to snes matrix-free jacobian

2023-12-20 Thread Barry Smith
etsc-users@mcs.anl.gov > Subject: Re: [petsc-users] fortran interface to snes matrix-free jacobian > > Are you wanting an analytic matrix-free operator or one created for you based > on finite differencing? If the latter, just use -snes_mf or -snes_mf_operator. > > https://petsc.o

Re: [petsc-users] fortran interface to snes matrix-free jacobian

2023-12-20 Thread Jed Brown
implement. > > Best, Yi > > -Original Message- > From: Jed Brown > Sent: Wednesday, December 20, 2023 5:40 PM > To: Yi Hu ; petsc-users@mcs.anl.gov > Subject: Re: [petsc-users] fortran interface to snes matrix-free jacobian > > Are you wanting an analytic matr

Re: [petsc-users] fortran interface to snes matrix-free jacobian

2023-12-20 Thread Yi Hu
Dear Jed, Thanks for your reply. I have an analytical one to implement. Best, Yi -Original Message- From: Jed Brown Sent: Wednesday, December 20, 2023 5:40 PM To: Yi Hu ; petsc-users@mcs.anl.gov Subject: Re: [petsc-users] fortran interface to snes matrix-free jacobian Are you wanting

Re: [petsc-users] fortran interface to snes matrix-free jacobian

2023-12-20 Thread Jed Brown
Are you wanting an analytic matrix-free operator or one created for you based on finite differencing? If the latter, just use -snes_mf or -snes_mf_operator. https://petsc.org/release/manual/snes/#jacobian-evaluation Yi Hu writes: > Dear PETSc team, > > My  solution scheme relies on a matrix-

[petsc-users] fortran interface to snes matrix-free jacobian

2023-12-20 Thread Yi Hu
Dear PETSc team, My  solution scheme relies on a matrix-free jacobian in the SNES solver. I saw the useful C interface like MatCreateSNESMF(), DMSNESCreateJacobianMF(). I am wondering if you have the fortran equivalence? I think for my problem in the main program I need to do DMDASNESsetJaco

Re: [petsc-users] Fortran Interface

2023-12-13 Thread Palmer, Bruce J via petsc-users
Thanks, that clears things up nicely. Bruce From: Barry Smith Date: Wednesday, December 13, 2023 at 6:28 AM To: Sanjay Govindjee Cc: Palmer, Bruce J , petsc-users@mcs.anl.gov Subject: Re: [petsc-users] Fortran Interface fixed On Dec 12, 2023, at 11:17 PM, Sanjay Govindjee wrote: did you

Re: [petsc-users] Fortran Interface

2023-12-13 Thread Barry Smith
;> type. What type should I use? Is there something called PETSC_NULL_VOID or >>> PETSC_NULL_CONTEXT or do I use something else? >>> >>> From: Matthew Knepley mailto:knep...@gmail.com>> >>> Date: Tuesday, December 12, 2023 at 8:33 AM >>> To: Pa

Re: [petsc-users] Fortran Interface

2023-12-13 Thread Mark Adams
set this to null, but apparently you have to specify the >> type. What type should I use? Is there something called PETSC_NULL_VOID or >> PETSC_NULL_CONTEXT or do I use something else? >> >> >> *From: *Matthew Knepley >> *Date: *Tuesday, December 12, 2023 at 8:

Re: [petsc-users] Fortran Interface

2023-12-12 Thread Sanjay Govindjee via petsc-users
hat type should I use? Is there something called PETSC_NULL_VOID or > PETSC_NULL_CONTEXT or do I use something else? > > > *From: *Matthew Knepley > *Date: *Tuesday, December 12, 2023 at 8:33 AM > *To: *Palmer, Bruce J > *Cc: *petsc-users@mcs.anl.gov > *Subject: *Re: [p

Re: [petsc-users] Fortran Interface

2023-12-12 Thread Barry Smith
do I use something else? > > From: Matthew Knepley mailto:knep...@gmail.com>> > Date: Tuesday, December 12, 2023 at 8:33 AM > To: Palmer, Bruce J mailto:bruce.pal...@pnnl.gov>> > Cc: petsc-users@mcs.anl.gov <mailto:petsc-users@mcs.anl.gov> > mailto:petsc-users@

Re: [petsc-users] Fortran Interface

2023-12-12 Thread Palmer, Bruce J via petsc-users
PETSC_NULL_CONTEXT or do I use something else? From: Matthew Knepley Date: Tuesday, December 12, 2023 at 8:33 AM To: Palmer, Bruce J Cc: petsc-users@mcs.anl.gov Subject: Re: [petsc-users] Fortran Interface Check twice before you click! This email originated from outside PNNL. On Tue, Dec 12, 2023 at

Re: [petsc-users] Fortran Interface

2023-12-12 Thread Palmer, Bruce J via petsc-users
it makes it relatively easy to fix everything up if you make changes. Bruce From: Barry Smith Date: Tuesday, December 12, 2023 at 9:07 AM To: Palmer, Bruce J Cc: Matthew Knepley , petsc-users@mcs.anl.gov Subject: Re: [petsc-users] Fortran Interface It is unlikely we will ever be able to

Re: [petsc-users] Fortran Interface

2023-12-12 Thread Sanjay Govindjee via petsc-users
: Thanks! It might be useful if there were a link to this page near the top of the C/Fortran API page. Bruce *From:*Matthew Knepley *Date:*Tuesday, December 12, 2023 at 8:33 AM *To:*Palmer, Bruce J *Cc:*petsc-users@mcs.anl.gov *Subject:*Re: [petsc-users] Fortran Interface Check twice before

Re: [petsc-users] Fortran Interface

2023-12-12 Thread Barry Smith
Date: Tuesday, December 12, 2023 at 8:33 AM > To: Palmer, Bruce J mailto:bruce.pal...@pnnl.gov>> > Cc: petsc-users@mcs.anl.gov <mailto:petsc-users@mcs.anl.gov> > mailto:petsc-users@mcs.anl.gov>> > Subject: Re: [petsc-users] Fortran Interface > > Check twice befo

Re: [petsc-users] Fortran Interface

2023-12-12 Thread Palmer, Bruce J via petsc-users
Thanks! It might be useful if there were a link to this page near the top of the C/Fortran API page. Bruce From: Matthew Knepley Date: Tuesday, December 12, 2023 at 8:33 AM To: Palmer, Bruce J Cc: petsc-users@mcs.anl.gov Subject: Re: [petsc-users] Fortran Interface Check twice before you

Re: [petsc-users] Fortran Interface

2023-12-12 Thread Matthew Knepley
On Tue, Dec 12, 2023 at 11:27 AM Palmer, Bruce J via petsc-users < petsc-users@mcs.anl.gov> wrote: > Does documentation for the PETSc fortran interface still exist? I looked > at the web pages for 3.20 (petsc.org/release) but if you go under the tab > C/Fortran API, only descriptions for the C int

[petsc-users] Fortran Interface

2023-12-12 Thread Palmer, Bruce J via petsc-users
Does documentation for the PETSc fortran interface still exist? I looked at the web pages for 3.20 (petsc.org/release) but if you go under the tab C/Fortran API, only descriptions for the C interface are there. Bruce Palmer

Re: [petsc-users] Fortran Interface NULL object / Casting

2022-12-08 Thread Barry Smith
You would use PETSC_NULL_DMLABEL but Matt needs to customize the PETSc Fortran stub for DMAddField() for you to handle accepting the NULL from PETSc. Barry > On Dec 8, 2022, at 1:05 PM, Nicholas Arnold-Medabalimi > wrote: > > Hi Petsc Users > > I am trying to use DMAddField in a F

[petsc-users] Fortran Interface NULL object / Casting

2022-12-08 Thread Nicholas Arnold-Medabalimi
Hi Petsc Users I am trying to use DMAddField in a Fortran code. I had some questions on casting/passing NULL. I follow how to pass NULL for standard types (INT, CHAR, etc). Is there a method/best practice for passing NULL for Petsc type arguments? (In this case DMAddLabel I'd want to pass NULL to

Re: [petsc-users] Fortran interface of some petsc routines seem to be missing

2018-11-29 Thread Natacha BEREUX via petsc-users
Dear Barry thank you very much for this very detailed answer. It's perfectly clear now. I'll start writing the missing interfaces I need to wait until I have made progress on writing the interfaces before deciding whether to create a pull request or send part of the interface definitions. In any ca

Re: [petsc-users] Fortran interface of some petsc routines seem to be missing

2018-11-27 Thread Smith, Barry F. via petsc-users
PETSc uses the Sowing packages bfort tool for automatically generating "Fortran stub functions" and interface definitions. There are certain C functions that bfort cannot handling including (at least) 1) functions with character string arguments 2) functions with function pointer argument

Re: [petsc-users] Fortran interface of MatNullSpaceCreate

2018-02-26 Thread Smith, Barry F.
> On Feb 26, 2018, at 5:38 PM, Sanjay Govindjee wrote: > > If PETSc is expecting an integer, I presume it is fine to pass > PETSC_NULL_INTEGER(1)? Not if the function has an interface definition. Fortran interfaces distinguish between passing an integer a and an integer a(1) so you can o

Re: [petsc-users] Fortran interface of MatNullSpaceCreate

2018-02-26 Thread Sanjay Govindjee
If PETSc is expecting an integer, I presume it is fine to pass PETSC_NULL_INTEGER(1)? On 2/26/18 11:53 PM, Smith, Barry F. wrote: PETSC_NULL_INTEGER is actually declared as an array of size 1 (this is why you get the confusing message about no specific subroutine that matches). PETSC_NULL_INT

Re: [petsc-users] Fortran interface of MatNullSpaceCreate

2018-02-26 Thread Smith, Barry F.
> On Feb 26, 2018, at 4:47 PM, frank wrote: > > Hello, > > It works after changing PETSC_NULL_INTEGER to 0. Thank you so much. > > Does this mean the 3rd argument is a Fortran integer rather than PestcInt? No it is actually a PetscInt so technically you should declare PetscInt zero

Re: [petsc-users] Fortran interface of MatNullSpaceCreate

2018-02-26 Thread Smith, Barry F.
It should be > call MatNullSpaceCreate( PETSC_COMM_WORLD, PETSC_TRUE, 0, dummyVecs, > nullspace, ierr) If this doesn't work please send your test code that I can compile myself and figure out what is going on. Barry > On Feb 26, 2018, at 4:18 PM, frank wrote: > > Hello, > > I ha

[petsc-users] Fortran interface of MatNullSpaceCreate

2018-02-26 Thread frank
Hello, I have a question of the Fortran interface of subroutine MatNullSpaceCreate. I tried to call the subroutine in the following form: Vec :: dummyVec, dummyVecs(1) MatNullSpace :: nullspace INTEGER :: ierr (a) call MatNullSpaceCreate( PETSC_COMM_WORLD, PETSC_TRUE,

Re: [petsc-users] Fortran interface -- low level access to petsc data

2013-10-28 Thread Hossein Talebi
1. You really need to profile. Copying a vector is cheap. >>>You are right. Maybe I make a big thing for this copy in/out and it is not that problematic or slow even for the whole 2D matrix. I have to test it with a large one to see. > 2. If you make your functions (to evaluate residuals, etc)

Re: [petsc-users] Fortran interface -- low level access to petsc data

2013-10-28 Thread Jed Brown
Hossein Talebi writes: > Exactly, I personally look for: > > 1) type checking during the function calls. This helps also not looking > into the manual for every single petsc function call. > > 2) low level access to petsc data structure. For example in my own code I > already have my own hadnling

Re: [petsc-users] Fortran interface -- low level access to petsc data

2013-10-28 Thread Hossein Talebi
Exactly, I personally look for: 1) type checking during the function calls. This helps also not looking into the manual for every single petsc function call. 2) low level access to petsc data structure. For example in my own code I already have my own hadnling of parallel vectors and matrices. Wh

Re: [petsc-users] Fortran interface -- low level access to petsc data

2013-10-28 Thread Jed Brown
Hossein Talebi writes: > What was in my mind is to create an interface additional to what is already > there in petsc. So this should be compiled along with anyone's code if the > used ocmpiler supports F03 or the necessary features of F03. I don't think anyone will want to manually maintain the

Re: [petsc-users] Fortran interface -- low level access to petsc data

2013-10-28 Thread Hossein Talebi
Well, when dealing with Fortran I also often encounter software which cannot be changed or upgraded to a more modern style. What was in my mind is to create an interface additional to what is already there in petsc. So this should be compiled along with anyone's code if the used ocmpiler supports

Re: [petsc-users] Fortran interface -- low level access to petsc data

2013-10-27 Thread Tabrez Ali
On 10/27/2013 12:36 PM, Hossein Talebi wrote: Thank you for your answer. It is not true that F2003 support is that limited: Gfortran, Intel Fortran, Cray Fortran, IBM Fortran and PGI Fortran all support nearly full F2003. Some other ones support the C portability of F2003 although not support

Re: [petsc-users] Fortran interface -- low level access to petsc data

2013-10-27 Thread Hossein Talebi
Thank you for your answer. It is not true that F2003 support is that limited: Gfortran, Intel Fortran, Cray Fortran, IBM Fortran and PGI Fortran all support nearly full F2003. Some other ones support the C portability of F2003 although not supporting the rest. * I can contribute on creating this

Re: [petsc-users] Fortran interface -- low level access to petsc data

2013-10-27 Thread Satish Balay
On Sun, 27 Oct 2013, Matthew Knepley wrote: > On Sun, Oct 27, 2013 at 6:16 AM, Hossein Talebi > wrote: > > > Hello All, > > > > I am trying to use petsc with Fortran. The initial mechanism to use petsc > > with FORTRAN77 that works fine. However, I found the Fortran 90 interfaces > > difficult

Re: [petsc-users] Fortran interface -- low level access to petsc data

2013-10-27 Thread Matthew Knepley
On Sun, Oct 27, 2013 at 6:16 AM, Hossein Talebi wrote: > Hello All, > > I am trying to use petsc with Fortran. The initial mechanism to use petsc > with FORTRAN77 that works fine. However, I found the Fortran 90 interfaces > difficult to work with. The very first issue is one has to recompile pet

[petsc-users] Fortran interface -- low level access to petsc data

2013-10-27 Thread Hossein Talebi
Hello All, I am trying to use petsc with Fortran. The initial mechanism to use petsc with FORTRAN77 that works fine. However, I found the Fortran 90 interfaces difficult to work with. The very first issue is one has to recompile petsc with the Fortran compiler in case different to the one which w