1af0996ceSBarry Smith #include <petsc/private/fortranimpl.h> 2665c2dedSJed Brown #include <petscviewer.h> 35c6c1daeSBarry Smith 45c6c1daeSBarry Smith #if defined(PETSC_HAVE_FORTRAN_CAPS) 55c6c1daeSBarry Smith #define petscviewerstringopen_ PETSCVIEWERSTRINGOPEN 6*ce78bad3SBarry Smith #define petscviewerstringsetstring_ PETSCVIEWERSTRINGSETSTRING 7*ce78bad3SBarry Smith #define petscviewerstringgetstringread_ PETSCVIEWERSTRINGGETSTRINGREAD 85c6c1daeSBarry Smith #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) 95c6c1daeSBarry Smith #define petscviewerstringopen_ petscviewerstringopen 10*ce78bad3SBarry Smith #define petscviewerstringsetstring_ petscviewerstringsetstring 11*ce78bad3SBarry Smith #define petscviewerstringgetstringread_ petscviewerstringgetstringread 125c6c1daeSBarry Smith #endif 135c6c1daeSBarry Smith 14*ce78bad3SBarry Smith PETSC_EXTERN void petscviewerstringopen_(MPI_Comm *comm, char *name, PetscViewer *str, PetscErrorCode *ierr, PETSC_FORTRAN_CHARLEN_T len1) 155c6c1daeSBarry Smith { 16*ce78bad3SBarry Smith PETSC_FORTRAN_OBJECT_CREATE(str); 17*ce78bad3SBarry Smith *ierr = PetscViewerStringOpen(MPI_Comm_f2c(*(MPI_Fint *)&*comm), name, len1, str); 18*ce78bad3SBarry Smith } 19*ce78bad3SBarry Smith 20*ce78bad3SBarry Smith PETSC_EXTERN void petscviewerstringsetstring_(PetscViewer *str, char *name, PetscErrorCode *ierr, PETSC_FORTRAN_CHARLEN_T len1) 21*ce78bad3SBarry Smith { 22*ce78bad3SBarry Smith PetscViewer v_a = PetscPatchDefaultViewers(str); 23*ce78bad3SBarry Smith *ierr = PetscViewerStringSetString(v_a, name, len1); 24*ce78bad3SBarry Smith } 25*ce78bad3SBarry Smith 26*ce78bad3SBarry Smith PETSC_EXTERN void petscviewerstringgetstringread_(PetscViewer *a, char b[], PetscErrorCode *ierr, PETSC_FORTRAN_CHARLEN_T l_b) 27*ce78bad3SBarry Smith { 28*ce78bad3SBarry Smith size_t len; 29*ce78bad3SBarry Smith char *c_b = PETSC_NULLPTR; 30*ce78bad3SBarry Smith PetscViewer v_a = PetscPatchDefaultViewers(a); 31*ce78bad3SBarry Smith *ierr = PetscViewerStringGetStringRead(v_a, (const char **)&c_b, &len); 32*ce78bad3SBarry Smith if (*ierr) return; 33*ce78bad3SBarry Smith *ierr = PetscStrncpy((char *)b, c_b, l_b); 34*ce78bad3SBarry Smith if (*ierr) return; 355c6c1daeSBarry Smith } 36