xref: /petsc/src/sys/memory/ftn-custom/zmtrf.c (revision 7a4fe282d1b349e95b3be72d69d8dd3d3bcd7bc6)
1 #include "private/fortranimpl.h"
2 #include "petsc.h"
3 
4 #if defined(PETSC_HAVE_FORTRAN_CAPS)
5 #define petscmallocdump_           PETSCMALLOCDUMP
6 #define petscmallocdumplog_        PETSCMALLOCDUMPLOG
7 #define petscmallocvalidate_       PETSCMALLOCVALIDATE
8 #define petscmemoryshowusage_      PETSCMEMORYSHOWUSAGE
9 #define petscmemorysetgetmaximumusage_ PETSCMEMORYSETGETMAXIMUMUSAGE
10 #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
11 #define petscmallocdump_           petscmallocdump
12 #define petscmallocdumplog_        petscmallocdumplog
13 #define petscmallocvalidate_       petscmallocvalidate
14 #define petscmemoryshowusage_      petscmemoryshowusage
15 #define petscmemorysetgetmaximumusage_ petscmemorysetgetmaximumusage
16 #endif
17 
18 EXTERN_C_BEGIN
19 void PETSC_STDCALL  petscmallocdump_(PetscErrorCode *ierr)
20 {
21   *ierr = PetscMallocDump(stdout);
22 }
23 void PETSC_STDCALL petscmallocdumplog_(PetscErrorCode *ierr)
24 {
25   *ierr = PetscMallocDumpLog(stdout);
26 }
27 
28 void PETSC_STDCALL petscmallocvalidate_(PetscErrorCode *ierr)
29 {
30   *ierr = PetscMallocValidate(0,"Unknown Fortran",0,0);
31 }
32 
33 void PETSC_STDCALL petscmemorysetgetmaximumusage_(PetscErrorCode *ierr)
34 {
35   *ierr = PetscMemorySetGetMaximumUsage();
36 }
37 
38 void PETSC_STDCALL petscmemoryshowusage_(PetscViewer *vin, CHAR message PETSC_MIXED_LEN(len), PetscErrorCode *ierr PETSC_END_LEN(len))
39 {
40   PetscViewer v;
41   char *msg;
42 
43   FIXCHAR(message,len,msg);
44   PetscPatchDefaultViewers_Fortran(vin,v);
45   *ierr = PetscMemoryShowUsage(v,msg);
46   FREECHAR(message,msg);
47 }
48 
49 EXTERN_C_END
50