[petsc-users] Fortran: PetscDSRestoreTabulation + PetscDSGetTabulation

Barry Smith bsmith at petsc.dev
Thu Aug 29 16:21:19 CDT 2024


   The interface definition and Fortran stub look ok to my eyeballs. However, eyeballs cannot compile code, so using the debugger to determine the cause of the crash is best.

   Barry



> On Aug 29, 2024, at 5:18 PM, Matthew Knepley <knepley at gmail.com> wrote:
> 
> On Thu, Aug 29, 2024 at 9:57 AM Martin Diehl <martin.diehl at kuleuven.be <mailto:martin.diehl at kuleuven.be>> wrote:
>> Dear PETSc team,
>> 
>> I have a question regarding the use of PetscDSGetTabulation from
>> Fortran.
>> PetscDSGetTabulation has a slightly different function signature
>> between Fortran and C. In addition, there is an (undocumented)
>> PetscDSRestoreTabulation in Fortran which cleans up the arrays. Calling
>> it results in a segmentation fault.
>> 
>> I believe that PetscDSRestoreTabulation is not needed. At least our
>> Fortran FEM code compiles and runs without it. However, we have
>> convergence issues that we don't understand so any suspicious code is
>> currently under investigation.
> 
> This may be due to my weak Fortran knowledge. Here is the code
> 
>   https://urldefense.us/v3/__https://gitlab.com/petsc/petsc/-/blob/main/src/dm/dt/interface/f90-custom/zdtdsf90.c?ref_type=heads__;!!G_uCfscf7eWS!c6UMUopH2bMHgSiLAqHoFUrJqajqcyYKZ3EFjfB_9tp9k8ByFqwf12a_M6JkOBU2tA3kSC5h83TvWw9kIrmuwic$ 
> 
> I call F90Array1dCreate() in the GetTabulation and F90Array1dDestroy() in the RestoreTabulation(), which I thought
> was right. However, I remember something about interface declarations, which have now moved somewhere I cannot find.
> 
> Barry, is the interface declaration for this function correct?
> 
>   Thanks,
> 
>       Matt
>  
>> best regards,
>> Martin
>> 
>> -- 
>> KU Leuven
>> Department of Computer Science
>> Department of Materials Engineering
>> Celestijnenlaan 200a
>> 3001 Leuven, Belgium
>> 
> 
> 
> --
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
> -- Norbert Wiener
> 
> https://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!c6UMUopH2bMHgSiLAqHoFUrJqajqcyYKZ3EFjfB_9tp9k8ByFqwf12a_M6JkOBU2tA3kSC5h83TvWw9kyCZ6mUM$  <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!c6UMUopH2bMHgSiLAqHoFUrJqajqcyYKZ3EFjfB_9tp9k8ByFqwf12a_M6JkOBU2tA3kSC5h83TvWw9kZ05AVyI$ >

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


More information about the petsc-users mailing list