[petsc-dev] PetscInitialize in Fortran

Satish Balay balay at mcs.anl.gov
Tue Oct 29 16:46:03 CDT 2013


Sorry - I don't reemeber why it was done this way. It could be MPI
stuff [mpi datatpes needing initialization from fortran?] or fortran
command line stuff?

Wrt fortran command line stuff - perhaps that part can be cleaned up
similar to the f90 interface [by using fortran using fortran code -
and not attempting to call getarg/narg and variants directly from C]

Satish

On Tue, 29 Oct 2013, Barry Smith wrote:

> 
>    Is your question, why is there a 
> 
> PETSC_EXTERN void PETSC_STDCALL petscinitialize_(CHAR filename PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))
> {
> #if defined (PETSC_USE_NARGS)
>   short       flg,i;
> #else
>   int         i;
> #if !defined(PETSC_HAVE_PXFGETARG_NEW) && !defined (PETSC_HAVE_PXFGETARG_NEW)
>   int         j;
> #endif
> #endif
> 
> function in zstart.c that has a great deal of code duplication (yuck) with the C PetscInitialize() function? 
> 
> The reason is because a long long long time ago we had great difficulty using the exact same code for most of the initialization in C and Fortran for a bunch of subtle and machine specific reasons I forgot (Satish may remember). We introduced the code duplication and have had no problems since (except sometimes forgetting to put new things added to PetscInitialize() into petscinitialize_() !)    Yes ideally we would eliminate the code duplication with a refactorization but the gain would mostly be a good feeling and since Satish and I sweated a lot of tears long ago with crazy stuff that went wrong until we duplicated code I would vote against trying to put them together.
> 
> If your question is something else then please restate your question.
> 
>    Barry
> 
> 
> 
> On Oct 29, 2013, at 4:03 PM, Matthew Knepley <knepley at gmail.com> wrote:
> 
> > Why do we have a copy of PetscInitialize() in zstart.c? We just call PetscFinalize()
> > from there.
> > 
> >    Matt
> > 
> > -- 
> > 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
> 
> 




More information about the petsc-dev mailing list