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 petscviewersetformat_ PETSCVIEWERSETFORMAT 65c6c1daeSBarry Smith #define petscviewersettype_ PETSCVIEWERSETTYPE 7df863907SAlex Fikl #define petscviewergettype_ PETSCVIEWERGETTYPE 85c6c1daeSBarry Smith #define petscviewerpushformat_ PETSCVIEWERPUSHFORMAT 95c6c1daeSBarry Smith #define petscviewerpopformat_ PETSCVIEWERPOPFORMAT 101cb03803SBarry Smith #define petscviewerandformatcreate_ PETSCVIEWERANDFORMATCREATE 111cb03803SBarry Smith #define petscviewerandformatdestroy_ PETSCVIEWERANDFORMATDESTROY 125c6c1daeSBarry Smith #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) 135c6c1daeSBarry Smith #define petscviewersetformat_ petscviewersetformat 145c6c1daeSBarry Smith #define petscviewersettype_ petscviewersettype 15df863907SAlex Fikl #define petscviewergettype_ petscviewergettype 165c6c1daeSBarry Smith #define petscviewerpushformat_ petscviewerpushformat 175c6c1daeSBarry Smith #define petscviewerpopformat_ petscviewerpopformat 181cb03803SBarry Smith #define petscviewerandformatcreate_ petscviewerandformatcreate 191cb03803SBarry Smith #define petscviewerandformatdestroy_ petscviewerandformatdestroy 205c6c1daeSBarry Smith #endif 215c6c1daeSBarry Smith 226a9046bcSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerSetFormatDeprecated(PetscViewer, PetscViewerFormat); 236a9046bcSBarry Smith 241cb03803SBarry Smith PETSC_EXTERN void PETSC_STDCALL petscviewerandformatcreate_(PetscViewer *vin, PetscViewerFormat *format, PetscViewerAndFormat **vf, PetscErrorCode *ierr) 251cb03803SBarry Smith { 261cb03803SBarry Smith PetscViewer v; 271cb03803SBarry Smith PetscPatchDefaultViewers_Fortran(vin, v); 281cb03803SBarry Smith *ierr = PetscViewerAndFormatCreate(v, *format, vf); 291cb03803SBarry Smith } 301cb03803SBarry Smith 31732dd666SBarry Smith PETSC_EXTERN void petscviewerandformatdestroy_(PetscViewerAndFormat **vf, PetscErrorCode *ierr) 321cb03803SBarry Smith { 331cb03803SBarry Smith *ierr = PetscViewerAndFormatDestroy(vf); 341cb03803SBarry Smith } 351cb03803SBarry Smith 366a9046bcSBarry Smith PETSC_EXTERN void PETSC_STDCALL petscviewersetformat_(PetscViewer *vin, PetscViewerFormat *format, PetscErrorCode *ierr) 376a9046bcSBarry Smith { 386a9046bcSBarry Smith PetscViewer v; 396a9046bcSBarry Smith PetscPatchDefaultViewers_Fortran(vin, v); 406a9046bcSBarry Smith *ierr = PetscViewerSetFormatDeprecated(v, *format); 416a9046bcSBarry Smith } 426a9046bcSBarry Smith 43*390e1bf2SBarry Smith PETSC_EXTERN void PETSC_STDCALL petscviewersettype_(PetscViewer *x, char* type_name PETSC_MIXED_LEN(len), PetscErrorCode *ierr PETSC_END_LEN(len)) 445c6c1daeSBarry Smith { 455c6c1daeSBarry Smith char *t; 465c6c1daeSBarry Smith 475c6c1daeSBarry Smith FIXCHAR(type_name, len, t); 485c6c1daeSBarry Smith *ierr = PetscViewerSetType(*x, t); 495c6c1daeSBarry Smith FREECHAR(type_name, t); 505c6c1daeSBarry Smith } 515c6c1daeSBarry Smith 52*390e1bf2SBarry Smith PETSC_EXTERN void PETSC_STDCALL petscviewergettype_(PetscViewer *viewer, char* type PETSC_MIXED_LEN(len), PetscErrorCode *ierr PETSC_END_LEN(len)) 53df863907SAlex Fikl { 54df863907SAlex Fikl const char *c1; 556a9046bcSBarry Smith 56df863907SAlex Fikl *ierr = PetscViewerGetType(*viewer, &c1); 57df863907SAlex Fikl *ierr = PetscStrncpy(type, c1, len); 58df863907SAlex Fikl FIXRETURNCHAR(PETSC_TRUE, type, len); 59df863907SAlex Fikl } 605c6c1daeSBarry Smith 618cc058d9SJed Brown PETSC_EXTERN void PETSC_STDCALL petscviewerpushformat_(PetscViewer *vin, PetscViewerFormat *format, PetscErrorCode *ierr) 625c6c1daeSBarry Smith { 635c6c1daeSBarry Smith PetscViewer v; 645c6c1daeSBarry Smith PetscPatchDefaultViewers_Fortran(vin, v); 655c6c1daeSBarry Smith *ierr = PetscViewerPushFormat(v, *format); 665c6c1daeSBarry Smith } 675c6c1daeSBarry Smith 688cc058d9SJed Brown PETSC_EXTERN void PETSC_STDCALL petscviewerpopformat_(PetscViewer *vin, PetscErrorCode *ierr) 695c6c1daeSBarry Smith { 705c6c1daeSBarry Smith PetscViewer v; 715c6c1daeSBarry Smith PetscPatchDefaultViewers_Fortran(vin, v); 725c6c1daeSBarry Smith *ierr = PetscViewerPopFormat(v); 735c6c1daeSBarry Smith } 74