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 12b3fa1ec5SBarry Smith #define petscviewergetsubviewer_ PETSCVIEWERGETSUBVIEWER 13b3fa1ec5SBarry Smith #define petscviewerrestoresubviewer_ PETSCVIEWERRESTORESUBVIEWER 145c6c1daeSBarry Smith #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) 155c6c1daeSBarry Smith #define petscviewersetformat_ petscviewersetformat 165c6c1daeSBarry Smith #define petscviewersettype_ petscviewersettype 17df863907SAlex Fikl #define petscviewergettype_ petscviewergettype 185c6c1daeSBarry Smith #define petscviewerpushformat_ petscviewerpushformat 195c6c1daeSBarry Smith #define petscviewerpopformat_ petscviewerpopformat 201cb03803SBarry Smith #define petscviewerandformatcreate_ petscviewerandformatcreate 211cb03803SBarry Smith #define petscviewerandformatdestroy_ petscviewerandformatdestroy 22b3fa1ec5SBarry Smith #define petscviewergetsubviewer_ petscviewergetsubviewer 23b3fa1ec5SBarry Smith #define petscviewerrestoresubviewer_ petscviewerrestoresubviewer 245c6c1daeSBarry Smith #endif 255c6c1daeSBarry Smith 26*19caf8f3SSatish Balay PETSC_EXTERN void petscviewergetsubviewer_(PetscViewer *vin,MPI_Fint * comm,PetscViewer *outviewer, PetscErrorCode *ierr) 27b3fa1ec5SBarry Smith { 28b3fa1ec5SBarry Smith PetscViewer v; 29b3fa1ec5SBarry Smith PetscPatchDefaultViewers_Fortran(vin, v); 30b3fa1ec5SBarry Smith *ierr = PetscViewerGetSubViewer(v,MPI_Comm_f2c(*(comm)),outviewer); 31b3fa1ec5SBarry Smith } 32b3fa1ec5SBarry Smith 33*19caf8f3SSatish Balay PETSC_EXTERN void petscviewerrestoresubviewer_(PetscViewer *vin,MPI_Fint * comm,PetscViewer *outviewer, PetscErrorCode *ierr) 34b3fa1ec5SBarry Smith { 35b3fa1ec5SBarry Smith PetscViewer v; 36b3fa1ec5SBarry Smith PetscPatchDefaultViewers_Fortran(vin, v); 37b3fa1ec5SBarry Smith *ierr = PetscViewerRestoreSubViewer(v,MPI_Comm_f2c(*(comm)),outviewer); 38b3fa1ec5SBarry Smith } 39b3fa1ec5SBarry Smith 406a9046bcSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerSetFormatDeprecated(PetscViewer, PetscViewerFormat); 416a9046bcSBarry Smith 42*19caf8f3SSatish Balay PETSC_EXTERN void petscviewerandformatcreate_(PetscViewer *vin, PetscViewerFormat *format, PetscViewerAndFormat **vf, PetscErrorCode *ierr) 431cb03803SBarry Smith { 441cb03803SBarry Smith PetscViewer v; 451cb03803SBarry Smith PetscPatchDefaultViewers_Fortran(vin, v); 461cb03803SBarry Smith *ierr = PetscViewerAndFormatCreate(v, *format, vf); 471cb03803SBarry Smith } 481cb03803SBarry Smith 49732dd666SBarry Smith PETSC_EXTERN void petscviewerandformatdestroy_(PetscViewerAndFormat **vf, PetscErrorCode *ierr) 501cb03803SBarry Smith { 511cb03803SBarry Smith *ierr = PetscViewerAndFormatDestroy(vf); 521cb03803SBarry Smith } 531cb03803SBarry Smith 54*19caf8f3SSatish Balay PETSC_EXTERN void petscviewersetformat_(PetscViewer *vin, PetscViewerFormat *format, PetscErrorCode *ierr) 556a9046bcSBarry Smith { 566a9046bcSBarry Smith PetscViewer v; 576a9046bcSBarry Smith PetscPatchDefaultViewers_Fortran(vin, v); 586a9046bcSBarry Smith *ierr = PetscViewerSetFormatDeprecated(v, *format); 596a9046bcSBarry Smith } 606a9046bcSBarry Smith 61*19caf8f3SSatish Balay PETSC_EXTERN void petscviewersettype_(PetscViewer *x, char* type_name, PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len) 625c6c1daeSBarry Smith { 635c6c1daeSBarry Smith char *t; 645c6c1daeSBarry Smith 655c6c1daeSBarry Smith FIXCHAR(type_name, len, t); 66d49bb8f9SBarry Smith *ierr = PetscViewerSetType(*x, t);if (*ierr) return; 675c6c1daeSBarry Smith FREECHAR(type_name, t); 685c6c1daeSBarry Smith } 695c6c1daeSBarry Smith 70*19caf8f3SSatish Balay PETSC_EXTERN void petscviewergettype_(PetscViewer *viewer, char* type, PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len) 71df863907SAlex Fikl { 72df863907SAlex Fikl const char *c1; 736a9046bcSBarry Smith 74df863907SAlex Fikl *ierr = PetscViewerGetType(*viewer, &c1); 75df863907SAlex Fikl *ierr = PetscStrncpy(type, c1, len); 76df863907SAlex Fikl FIXRETURNCHAR(PETSC_TRUE, type, len); 77df863907SAlex Fikl } 785c6c1daeSBarry Smith 79*19caf8f3SSatish Balay PETSC_EXTERN void petscviewerpushformat_(PetscViewer *vin, PetscViewerFormat *format, PetscErrorCode *ierr) 805c6c1daeSBarry Smith { 815c6c1daeSBarry Smith PetscViewer v; 825c6c1daeSBarry Smith PetscPatchDefaultViewers_Fortran(vin, v); 835c6c1daeSBarry Smith *ierr = PetscViewerPushFormat(v, *format); 845c6c1daeSBarry Smith } 855c6c1daeSBarry Smith 86*19caf8f3SSatish Balay PETSC_EXTERN void petscviewerpopformat_(PetscViewer *vin, PetscErrorCode *ierr) 875c6c1daeSBarry Smith { 885c6c1daeSBarry Smith PetscViewer v; 895c6c1daeSBarry Smith PetscPatchDefaultViewers_Fortran(vin, v); 905c6c1daeSBarry Smith *ierr = PetscViewerPopFormat(v); 915c6c1daeSBarry Smith } 92