I do not know. It depends on how the Fortran compiler decides to interprete 
the [] and pass the address down. In the end the address of the actual array in 
p has to sent down since it will be used later so if the compiler makes a new 
array with [] or does something fancy it may or may not work.

> On Aug 11, 2025, at 12:08 PM, Sanjay Govindjee <s...@berkeley.edu> wrote:
> 
> 
> Would a construct like
> call VecCreateSeqWithArray(PETSC_COMM_WORLD, nvar, nvar*g%nvl, &
>                                 [s%res(1,1)] , p%v_res, ierr); CHKERRQ(ierr)
> or
> call VecCreateSeqWithArray(PETSC_COMM_WORLD, nvar, nvar*g%nvl, &
>                                 (/ s%res(1,1) /), p%v_res, ierr); 
> CHKERRQ(ierr)
> be sufficient in this case?
> 
> -sanjay
> 
> On Mon, Aug 11, 2025 at 7:54 AM Barry Smith <bsm...@petsc.dev 
> <mailto:bsm...@petsc.dev>> wrote:
>>  
>>   PETSc now provides Fortran interface definitions in the Fortran modules 
>> for most PETSc functions. This means the argument types and array dimensions 
>> of the function must match the expected type and dimension. 
>> 
>>    In this case, the argument s%res(1,1) is likely a scalar while 
>> VecCreateSeqWithArray is expected to be a one-dimensional array.  You can 
>> change your code to declare res(1,1) to be a one-dimensional array, or 
>> possibly use reshape to have the compiler treat it as a one-dimensional 
>> array when passing it in as an argument.
>> 
>> 
>> 
>>> On Aug 10, 2025, at 4:12 AM, kiran hegde <kiranhegd...@gmail.com 
>>> <mailto:kiranhegd...@gmail.com>> wrote:
>>> 
>>> Hi,
>>> The error highlighted is gone, the path to the include file was wrong. 
>>> The code was developed during  petsc-3.9 and it looks like i have to fix 
>>> many of the petsc call functions.
>>> There are big  changes in  post petsc-3.9.
>>> 
>>> Currently, the error shifted to another location in the code:
>>> for the below line i am getting error:
>>> call VecCreateSeqWithArray(PETSC_COMM_WORLD, nvar, nvar*g%nvl, &
>>>                                  s%res(1,1), p%v_res, ierr); CHKERRQ(ierr)
>>> 
>>> Error: There is no specific subroutine for the generic 
>>> 'veccreateseqwitharray' at (1)
>>> 
>>> Regards,
>>> Kiran
>>> 
>>> 
>>> 
>>> 
>>> On Fri, Aug 8, 2025 at 6:39 AM Barry Smith <bsm...@petsc.dev 
>>> <mailto:bsm...@petsc.dev>> wrote:
>>>> 
>>>>  Please send (cut and paste) all the output of 
>>>> 
>>>>  make ex5f  (should succeed)
>>>> 
>>>> and
>>>> 
>>>> make "your code"
>>>> 
>>>> we need to see the exact calls for both codes and the exact error message.
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> On Aug 5, 2025, at 12:44 AM, kiran hegde <kiranhegd...@gmail.com 
>>>>> <mailto:kiranhegd...@gmail.com>> wrote:
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> Sorry, the tutorial case run succeeded. No errors reported. When i used 
>>>>> the makefile file flags in my code, my code is still reported error.
>>>>> 
>>>>> Regards,
>>>>> 
>>>>> Kiran Hegde
>>>>> Mobile:+91 9972600235
>>>>> 
>>>>> On Tue, Aug 5, 2025, 6:11 AM Barry Smith <bsm...@petsc.dev 
>>>>> <mailto:bsm...@petsc.dev>> wrote:
>>>>>> 
>>>>>>    "I have tried the options ex5f, but getting the same error."
>>>>>> 
>>>>>>    So you did 
>>>>>> 
>>>>>>     cd src/snes/tutorials/
>>>>>>     make ex5f
>>>>>> 
>>>>>>     and got some errors? Please cut and paste all the output from make 
>>>>>> ex5f and sent it here.
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> On Aug 4, 2025, at 11:15 AM, kiran hegde <kiranhegd...@gmail.com 
>>>>>>> <mailto:kiranhegd...@gmail.com>> wrote:
>>>>>>> 
>>>>>>> Hi Satish,
>>>>>>> 
>>>>>>> I have tried the options ex5f, but getting the same error.
>>>>>>> The code was running without any issues long back and I was using  
>>>>>>> petsc ver 3.9 using gcc 12.X.X.
>>>>>>> My makefile flags are :
>>>>>>> 
>>>>>>> FFLAGS = -march=native -O3 -pipe -ffree-form -cpp 
>>>>>>> -ffree-line-length-none \
>>>>>>>                         -Wall -Wextra -Wtabs -Wintrinsics-std 
>>>>>>> -Wsurprising -Waliasing \
>>>>>>>                         -Wno-unused-parameter 
>>>>>>> -Wno-unused-dummy-argument \
>>>>>>>                         -D$(MODEL) \
>>>>>>>                         -DVERSION=\"$(GIT_VERSION)\" \
>>>>>>>                         -I$(PETSC_DIR)/include
>>>>>>> FPPFLAGS = -cpp -E -dM -C -P -D$(MODEL)
>>>>>>> LDFLAGS = -lpetsc -L$(PETSC_DIR)/lib
>>>>>>> LDFLAGS += -Wl,-rpath=$(PETSC_DIR)/lib
>>>>>>> 
>>>>>>> Have i missed anything? 
>>>>>>> 
>>>>>>> 
>>>>>>> Regards,
>>>>>>> Kiran
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> On Sun, Aug 3, 2025 at 9:56 PM Satish Balay <balay....@fastmail.org 
>>>>>>> <mailto:balay....@fastmail.org>> wrote:
>>>>>>>> On Sun, 3 Aug 2025, kiran hegde wrote:
>>>>>>>> 
>>>>>>>> > Hi,
>>>>>>>> > 
>>>>>>>> > Please find the attached configure.log file.
>>>>>>>> > PETSC installation successfully completes with make check, without 
>>>>>>>> > any
>>>>>>>> > error.
>>>>>>>> > But, when compiling fortan codes with   petsc  library+include in the
>>>>>>>> > makefile i get this error.
>>>>>>>> 
>>>>>>>> Then likely your compile command is missing some options. you can:
>>>>>>>> 
>>>>>>>> - compile a petsc example - say:
>>>>>>>> cd src/snes/tutorials
>>>>>>>> make ex5f
>>>>>>>> 
>>>>>>>> - now compile your application
>>>>>>>> 
>>>>>>>> - And compare the compile commands and see if there are any 
>>>>>>>> differences (missing options, wrong order of include files etc..)
>>>>>>>> 
>>>>>>>> Satish
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> --
>>>>>>> Regards,
>>>>>>> 
>>>>>>> Kiran Hegde
>>>>>>> Mobile:+91 9972600235
>>>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Regards,
>>> 
>>> Kiran Hegde
>>> Mobile:+91 9972600235
>> 

Reply via email to