[petsc-users] Set the options NOT from argc and argv

Satish Balay balay at mcs.anl.gov
Tue May 21 16:17:55 CDT 2013


On Tue, 21 May 2013, Satish Balay wrote:

> You should be able to use 'petscrc' file as mentioned before. [without
> any code changes]
> 
> Alternative is to call fortran initialize/finalize from your c code -
> but this is a bit convoluted.. [but appears to work for me]

Or you can do the following... by having a fortran intermediate file..

Satish
---------
balay at asterix /home/balay/download-pine
$ cat main.F
      program main
      call wrap()
      end
balay at asterix /home/balay/download-pine
$ cat wrap.F
      subroutine wrap()
      implicit none
#include <finclude/petsc.h>
      PetscErrorCode ierr
      call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
      call foo()
      call PetscFinalize(ierr)
      end
balay at asterix /home/balay/download-pine
$ cat sub.c
#include <petsc.h>

#if defined(PETSC_HAVE_FORTRAN_CAPS)
#define foo_             FOO
#elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
#define foo_             foo
#endif

void foo_(void)
{
  /* petsc code */
  return;
}




More information about the petsc-users mailing list