Actual source code: zepsf.c
slepc-3.21.1 2024-04-26
Report Typos and Errors

      1: /*
      2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
      4:    Copyright (c) 2002-, Universitat Politecnica de Valencia, Spain

      6:    This file is part of SLEPc.
      7:    SLEPc is distributed under a 2-clause BSD license (see LICENSE).
      8:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      9: */

     11: #include <petsc/private/fortranimpl.h>
     12: #include <slepceps.h>

     14: #if defined(PETSC_HAVE_FORTRAN_CAPS)
     15: #define epsdestroy_                       EPSDESTROY
     16: #define epsview_                          EPSVIEW
     17: #define epsviewfromoptions_               EPSVIEWFROMOPTIONS
     18: #define epserrorview_                     EPSERRORVIEW
     19: #define epsconvergedreasonview_           EPSCONVERGEDREASONVIEW
     20: #define epsvaluesview_                    EPSVALUESVIEW
     21: #define epsvectorsview_                   EPSVECTORSVIEW
     22: #define epssetoptionsprefix_              EPSSETOPTIONSPREFIX
     23: #define epsappendoptionsprefix_           EPSAPPENDOPTIONSPREFIX
     24: #define epsgetoptionsprefix_              EPSGETOPTIONSPREFIX
     25: #define epssettype_                       EPSSETTYPE
     26: #define epsgettype_                       EPSGETTYPE
     27: #define epsmonitorset_                    EPSMONITORSET
     28: #define epsmonitorall_                    EPSMONITORALL
     29: #define epsmonitorfirst_                  EPSMONITORFIRST
     30: #define epsmonitorconverged_              EPSMONITORCONVERGED
     31: #define epsmonitorconvergedcreate_        EPSMONITORCONVERGEDCREATE
     32: #define epsmonitorconvergeddestroy_       EPSMONITORCONVERGEDDESTROY
     33: #define epsconvergedabsolute_             EPSCONVERGEDABSOLUTE
     34: #define epsconvergedrelative_             EPSCONVERGEDRELATIVE
     35: #define epsconvergednorm_                 EPSCONVERGEDNORM
     36: #define epssetconvergencetestfunction_    EPSSETCONVERGENCETESTFUNCTION
     37: #define epssetstoppingtestfunction_       EPSSETSTOPPINGTESTFUNCTION
     38: #define epsseteigenvaluecomparison_       EPSSETEIGENVALUECOMPARISON
     39: #define epssetarbitraryselection_         EPSSETARBITRARYSELECTION
     40: #define epsgetdimensions000_              EPSGETDIMENSIONS000
     41: #define epsgetdimensions100_              EPSGETDIMENSIONS100
     42: #define epsgetdimensions010_              EPSGETDIMENSIONS010
     43: #define epsgetdimensions001_              EPSGETDIMENSIONS001
     44: #define epsgetdimensions110_              EPSGETDIMENSIONS110
     45: #define epsgetdimensions011_              EPSGETDIMENSIONS011
     46: #define epsgetdimensions101_              EPSGETDIMENSIONS101
     47: #define epsgeteigenpair00_                EPSGETEIGENPAIR00
     48: #define epsgeteigenpair10_                EPSGETEIGENPAIR10
     49: #define epsgeteigenpair01_                EPSGETEIGENPAIR01
     50: #define epsgeteigenpair11_                EPSGETEIGENPAIR11
     51: #define epsgeteigenvalue00_               EPSGETEIGENVALUE00
     52: #define epsgeteigenvalue10_               EPSGETEIGENVALUE10
     53: #define epsgeteigenvalue01_               EPSGETEIGENVALUE01
     54: #define epsgettolerances00_               EPSGETTOLERANCES00
     55: #define epsgettolerances10_               EPSGETTOLERANCES10
     56: #define epsgettolerances01_               EPSGETTOLERANCES01
     57: #define epsgetbalance000_                 EPSGETBALANCE000
     58: #define epsgetbalance100_                 EPSGETBALANCE100
     59: #define epsgetbalance010_                 EPSGETBALANCE010
     60: #define epsgetbalance001_                 EPSGETBALANCE001
     61: #define epsgetbalance110_                 EPSGETBALANCE110
     62: #define epsgetbalance011_                 EPSGETBALANCE011
     63: #define epsgetbalance101_                 EPSGETBALANCE101
     64: #define epssetdeflationspace0_            EPSSETDEFLATIONSPACE0
     65: #define epssetdeflationspace1_            EPSSETDEFLATIONSPACE1
     66: #define epssetinitialspace0_              EPSSETINITIALSPACE0
     67: #define epssetinitialspace1_              EPSSETINITIALSPACE1
     68: #define epssetleftinitialspace0_          EPSSETLEFTINITIALSPACE0
     69: #define epssetleftinitialspace1_          EPSSETLEFTINITIALSPACE1
     70: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
     71: #define epsdestroy_                       epsdestroy
     72: #define epsview_                          epsview
     73: #define epsviewfromoptions_               epsviewfromoptions
     74: #define epserrorview_                     epserrorview
     75: #define epsconvergedreasonview_           epsconvergedreasonview
     76: #define epsvaluesview_                    epsvaluesview
     77: #define epsvectorsview_                   epsvectorsview
     78: #define epssetoptionsprefix_              epssetoptionsprefix
     79: #define epsappendoptionsprefix_           epsappendoptionsprefix
     80: #define epsgetoptionsprefix_              epsgetoptionsprefix
     81: #define epssettype_                       epssettype
     82: #define epsgettype_                       epsgettype
     83: #define epsmonitorset_                    epsmonitorset
     84: #define epsmonitorall_                    epsmonitorall
     85: #define epsmonitorfirst_                  epsmonitorfirst
     86: #define epsmonitorconverged_              epsmonitorconverged
     87: #define epsmonitorconvergedcreate_        epsmonitorconvergedcreate
     88: #define epsmonitorconvergeddestroy_       epsmonitorconvergeddestroy
     89: #define epsconvergedabsolute_             epsconvergedabsolute
     90: #define epsconvergedrelative_             epsconvergedrelative
     91: #define epsconvergednorm_                 epsconvergednorm
     92: #define epssetconvergencetestfunction_    epssetconvergencetestfunction
     93: #define epssetstoppingtestfunction_       epssetstoppingtestfunction
     94: #define epsseteigenvaluecomparison_       epsseteigenvaluecomparison
     95: #define epssetarbitraryselection_         epssetarbitraryselection
     96: #define epsgetdimensions000_              epsgetdimensions000
     97: #define epsgetdimensions100_              epsgetdimensions100
     98: #define epsgetdimensions010_              epsgetdimensions010
     99: #define epsgetdimensions001_              epsgetdimensions001
    100: #define epsgetdimensions110_              epsgetdimensions110
    101: #define epsgetdimensions011_              epsgetdimensions011
    102: #define epsgetdimensions101_              epsgetdimensions101
    103: #define epsgeteigenpair00_                epsgeteigenpair00
    104: #define epsgeteigenpair10_                epsgeteigenpair10
    105: #define epsgeteigenpair01_                epsgeteigenpair01
    106: #define epsgeteigenpair11_                epsgeteigenpair11
    107: #define epsgeteigenvalue00_               epsgeteigenvalue00
    108: #define epsgeteigenvalue10_               epsgeteigenvalue10
    109: #define epsgeteigenvalue01_               epsgeteigenvalue01
    110: #define epsgettolerances00_               epsgettolerances00
    111: #define epsgettolerances10_               epsgettolerances10
    112: #define epsgettolerances01_               epsgettolerances01
    113: #define epsgetbalance000_                 epsgetbalance000
    114: #define epsgetbalance100_                 epsgetbalance100
    115: #define epsgetbalance010_                 epsgetbalance010
    116: #define epsgetbalance001_                 epsgetbalance001
    117: #define epsgetbalance110_                 epsgetbalance110
    118: #define epsgetbalance011_                 epsgetbalance011
    119: #define epsgetbalance101_                 epsgetbalance101
    120: #define epssetdeflationspace0_            epssetdeflationspace0
    121: #define epssetdeflationspace1_            epssetdeflationspace1
    122: #define epssetinitialspace0_              epssetinitialspace0
    123: #define epssetinitialspace1_              epssetinitialspace1
    124: #define epssetleftinitialspace0_          epssetleftinitialspace0
    125: #define epssetleftinitialspace1_          epssetleftinitialspace1
    126: #endif

    128: /*
    129:    These are not usually called from Fortran but allow Fortran users
    130:    to transparently set these monitors from .F code
    131: */
    132: SLEPC_EXTERN void epsmonitorall_(EPS *eps,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,PetscViewerAndFormat **vf,PetscErrorCode *ierr)
    133: {
    134:   *ierr = EPSMonitorAll(*eps,*it,*nconv,eigr,eigi,errest,*nest,*vf);
    135: }

    137: SLEPC_EXTERN void epsmonitorfirst_(EPS *eps,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,PetscViewerAndFormat **vf,PetscErrorCode *ierr)
    138: {
    139:   *ierr = EPSMonitorFirst(*eps,*it,*nconv,eigr,eigi,errest,*nest,*vf);
    140: }

    142: SLEPC_EXTERN void epsmonitorconverged_(EPS *eps,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,PetscViewerAndFormat **vf,PetscErrorCode *ierr)
    143: {
    144:   *ierr = EPSMonitorConverged(*eps,*it,*nconv,eigr,eigi,errest,*nest,*vf);
    145: }

    147: SLEPC_EXTERN void epsmonitorconvergedcreate_(PetscViewer *vin,PetscViewerFormat *format,void *ctx,PetscViewerAndFormat **vf,PetscErrorCode *ierr)
    148: {
    149:   PetscViewer v;
    150:   PetscPatchDefaultViewers_Fortran(vin,v);
    151:   CHKFORTRANNULLOBJECT(ctx);
    152:   *ierr = EPSMonitorConvergedCreate(v,*format,ctx,vf);
    153: }

    155: SLEPC_EXTERN void epsmonitorconvergeddestroy_(PetscViewerAndFormat **vf,PetscErrorCode *ierr)
    156: {
    157:   *ierr = EPSMonitorConvergedDestroy(vf);
    158: }

    160: static struct {
    161:   PetscFortranCallbackId monitor;
    162:   PetscFortranCallbackId monitordestroy;
    163:   PetscFortranCallbackId convergence;
    164:   PetscFortranCallbackId convdestroy;
    165:   PetscFortranCallbackId stopping;
    166:   PetscFortranCallbackId stopdestroy;
    167:   PetscFortranCallbackId comparison;
    168:   PetscFortranCallbackId arbitrary;
    169: } _cb;

    171: /* These are not extern C because they are passed into non-extern C user level functions */
    172: static PetscErrorCode ourmonitor(EPS eps,PetscInt i,PetscInt nc,PetscScalar *er,PetscScalar *ei,PetscReal *d,PetscInt l,void* ctx)
    173: {
    174:   PetscObjectUseFortranCallback(eps,_cb.monitor,(EPS*,PetscInt*,PetscInt*,PetscScalar*,PetscScalar*,PetscReal*,PetscInt*,void*,PetscErrorCode*),(&eps,&i,&nc,er,ei,d,&l,_ctx,&ierr));
    175: }

    177: static PetscErrorCode ourdestroy(void** ctx)
    178: {
    179:   EPS eps = (EPS)*ctx;
    180:   PetscObjectUseFortranCallback(eps,_cb.monitordestroy,(void*,PetscErrorCode*),(_ctx,&ierr));
    181: }

    183: static PetscErrorCode ourconvergence(EPS eps,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx)
    184: {
    185:   PetscObjectUseFortranCallback(eps,_cb.convergence,(EPS*,PetscScalar*,PetscScalar*,PetscReal*,PetscReal*,void*,PetscErrorCode*),(&eps,&eigr,&eigi,&res,errest,_ctx,&ierr));
    186: }

    188: static PetscErrorCode ourconvdestroy(void *ctx)
    189: {
    190:   EPS eps = (EPS)ctx;
    191:   PetscObjectUseFortranCallback(eps,_cb.convdestroy,(void*,PetscErrorCode*),(_ctx,&ierr));
    192: }

    194: static PetscErrorCode ourstopping(EPS eps,PetscInt its,PetscInt max_it,PetscInt nconv,PetscInt nev,EPSConvergedReason *reason,void *ctx)
    195: {
    196:   PetscObjectUseFortranCallback(eps,_cb.stopping,(EPS*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,EPSConvergedReason*,void*,PetscErrorCode*),(&eps,&its,&max_it,&nconv,&nev,reason,_ctx,&ierr));
    197: }

    199: static PetscErrorCode ourstopdestroy(void *ctx)
    200: {
    201:   EPS eps = (EPS)ctx;
    202:   PetscObjectUseFortranCallback(eps,_cb.stopdestroy,(void*,PetscErrorCode*),(_ctx,&ierr));
    203: }

    205: static PetscErrorCode oureigenvaluecomparison(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx)
    206: {
    207:   EPS eps = (EPS)ctx;
    208:   PetscObjectUseFortranCallback(eps,_cb.comparison,(PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscInt*,void*,PetscErrorCode*),(&ar,&ai,&br,&bi,r,_ctx,&ierr));
    209: }

    211: static PetscErrorCode ourarbitraryfunc(PetscScalar er,PetscScalar ei,Vec xr,Vec xi,PetscScalar *rr,PetscScalar *ri,void *ctx)
    212: {
    213:   EPS eps = (EPS)ctx;
    214:   PetscObjectUseFortranCallback(eps,_cb.arbitrary,(PetscScalar*,PetscScalar*,Vec*,Vec*,PetscScalar*,PetscScalar*,void*,PetscErrorCode*),(&er,&ei,&xr,&xi,rr,ri,_ctx,&ierr));
    215: }

    217: SLEPC_EXTERN void epsdestroy_(EPS *eps,PetscErrorCode *ierr)
    218: {
    219:   PETSC_FORTRAN_OBJECT_F_DESTROYED_TO_C_NULL(eps);
    220:   *ierr = EPSDestroy(eps); if (*ierr) return;
    221:   PETSC_FORTRAN_OBJECT_C_NULL_TO_F_DESTROYED(eps);
    222: }

    224: SLEPC_EXTERN void epsview_(EPS *eps,PetscViewer *viewer,PetscErrorCode *ierr)
    225: {
    226:   PetscViewer v;
    227:   PetscPatchDefaultViewers_Fortran(viewer,v);
    228:   *ierr = EPSView(*eps,v);
    229: }

    231: SLEPC_EXTERN void epsviewfromoptions_(EPS *eps,PetscObject obj,char* type,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
    232: {
    233:   char *t;

    235:   FIXCHAR(type,len,t);
    236:   CHKFORTRANNULLOBJECT(obj);
    237:   *ierr = EPSViewFromOptions(*eps,obj,t);if (*ierr) return;
    238:   FREECHAR(type,t);
    239: }

    241: SLEPC_EXTERN void epsconvergedreasonview_(EPS *eps,PetscViewer *viewer,PetscErrorCode *ierr)
    242: {
    243:   PetscViewer v;
    244:   PetscPatchDefaultViewers_Fortran(viewer,v);
    245:   *ierr = EPSConvergedReasonView(*eps,v);
    246: }

    248: SLEPC_EXTERN void epserrorview_(EPS *eps,EPSErrorType *etype,PetscViewer *viewer,PetscErrorCode *ierr)
    249: {
    250:   PetscViewer v;
    251:   PetscPatchDefaultViewers_Fortran(viewer,v);
    252:   *ierr = EPSErrorView(*eps,*etype,v);
    253: }

    255: SLEPC_EXTERN void epsvaluesview_(EPS *eps,PetscViewer *viewer,PetscErrorCode *ierr)
    256: {
    257:   PetscViewer v;
    258:   PetscPatchDefaultViewers_Fortran(viewer,v);
    259:   *ierr = EPSValuesView(*eps,v);
    260: }

    262: SLEPC_EXTERN void epsvectorsview_(EPS *eps,PetscViewer *viewer,PetscErrorCode *ierr)
    263: {
    264:   PetscViewer v;
    265:   PetscPatchDefaultViewers_Fortran(viewer,v);
    266:   *ierr = EPSVectorsView(*eps,v);
    267: }

    269: SLEPC_EXTERN void epssettype_(EPS *eps,char *type,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
    270: {
    271:   char *t;

    273:   FIXCHAR(type,len,t);
    274:   *ierr = EPSSetType(*eps,t);if (*ierr) return;
    275:   FREECHAR(type,t);
    276: }

    278: SLEPC_EXTERN void epsgettype_(EPS *eps,char *name,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
    279: {
    280:   EPSType tname;

    282:   *ierr = EPSGetType(*eps,&tname);if (*ierr) return;
    283:   *ierr = PetscStrncpy(name,tname,len);if (*ierr) return;
    284:   FIXRETURNCHAR(PETSC_TRUE,name,len);
    285: }

    287: SLEPC_EXTERN void epssetoptionsprefix_(EPS *eps,char *prefix,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
    288: {
    289:   char *t;

    291:   FIXCHAR(prefix,len,t);
    292:   *ierr = EPSSetOptionsPrefix(*eps,t);if (*ierr) return;
    293:   FREECHAR(prefix,t);
    294: }

    296: SLEPC_EXTERN void epsappendoptionsprefix_(EPS *eps,char *prefix,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
    297: {
    298:   char *t;

    300:   FIXCHAR(prefix,len,t);
    301:   *ierr = EPSAppendOptionsPrefix(*eps,t);if (*ierr) return;
    302:   FREECHAR(prefix,t);
    303: }

    305: SLEPC_EXTERN void epsgetoptionsprefix_(EPS *eps,char *prefix,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
    306: {
    307:   const char *tname;

    309:   *ierr = EPSGetOptionsPrefix(*eps,&tname); if (*ierr) return;
    310:   *ierr = PetscStrncpy(prefix,tname,len);if (*ierr) return;
    311:   FIXRETURNCHAR(PETSC_TRUE,prefix,len);
    312: }

    314: SLEPC_EXTERN void epsmonitorset_(EPS *eps,void (*monitor)(EPS*,PetscInt*,PetscInt*,PetscScalar*,PetscScalar*,PetscReal*,PetscInt*,void*,PetscErrorCode*),void *mctx,void (*monitordestroy)(void *,PetscErrorCode*),PetscErrorCode *ierr)
    315: {
    316:   CHKFORTRANNULLOBJECT(mctx);
    317:   CHKFORTRANNULLFUNCTION(monitordestroy);
    318:   if ((PetscVoidFunction)monitor == (PetscVoidFunction)epsmonitorall_) {
    319:     *ierr = EPSMonitorSet(*eps,(PetscErrorCode (*)(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*))EPSMonitorAll,*(PetscViewerAndFormat**)mctx,(PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
    320:   } else if ((PetscVoidFunction)monitor == (PetscVoidFunction)epsmonitorconverged_) {
    321:     *ierr = EPSMonitorSet(*eps,(PetscErrorCode (*)(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*))EPSMonitorConverged,*(PetscViewerAndFormat**)mctx,(PetscErrorCode (*)(void**))EPSMonitorConvergedDestroy);
    322:   } else if ((PetscVoidFunction)monitor == (PetscVoidFunction)epsmonitorfirst_) {
    323:     *ierr = EPSMonitorSet(*eps,(PetscErrorCode (*)(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*))EPSMonitorFirst,*(PetscViewerAndFormat**)mctx,(PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
    324:   } else {
    325:     *ierr = PetscObjectSetFortranCallback((PetscObject)*eps,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.monitor,(PetscVoidFunction)monitor,mctx); if (*ierr) return;
    326:     *ierr = PetscObjectSetFortranCallback((PetscObject)*eps,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.monitordestroy,(PetscVoidFunction)monitordestroy,mctx); if (*ierr) return;
    327:     *ierr = EPSMonitorSet(*eps,ourmonitor,*eps,ourdestroy);
    328:   }
    329: }

    331: SLEPC_EXTERN void epsconvergedabsolute_(EPS *eps,PetscScalar *eigr,PetscScalar *eigi,PetscReal *res,PetscReal *errest,void *ctx,PetscErrorCode *ierr)
    332: {
    333:   *ierr = EPSConvergedAbsolute(*eps,*eigr,*eigi,*res,errest,ctx);
    334: }

    336: SLEPC_EXTERN void epsconvergedrelative_(EPS *eps,PetscScalar *eigr,PetscScalar *eigi,PetscReal *res,PetscReal *errest,void *ctx,PetscErrorCode *ierr)
    337: {
    338:   *ierr = EPSConvergedRelative(*eps,*eigr,*eigi,*res,errest,ctx);
    339: }

    341: SLEPC_EXTERN void epsconvergednorm_(EPS *eps,PetscScalar *eigr,PetscScalar *eigi,PetscReal *res,PetscReal *errest,void *ctx,PetscErrorCode *ierr)
    342: {
    343:   *ierr = EPSConvergedNorm(*eps,*eigr,*eigi,*res,errest,ctx);
    344: }

    346: SLEPC_EXTERN void epssetconvergencetestfunction_(EPS *eps,void (*func)(EPS*,PetscScalar*,PetscScalar*,PetscReal*,PetscReal*,void*,PetscErrorCode*),void* ctx,void (*destroy)(void*,PetscErrorCode*),PetscErrorCode *ierr)
    347: {
    348:   CHKFORTRANNULLOBJECT(ctx);
    349:   CHKFORTRANNULLFUNCTION(destroy);
    350:   if ((PetscVoidFunction)func == (PetscVoidFunction)epsconvergedabsolute_) {
    351:     *ierr = EPSSetConvergenceTest(*eps,EPS_CONV_ABS);
    352:   } else if ((PetscVoidFunction)func == (PetscVoidFunction)epsconvergedrelative_) {
    353:     *ierr = EPSSetConvergenceTest(*eps,EPS_CONV_REL);
    354:   } else if ((PetscVoidFunction)func == (PetscVoidFunction)epsconvergednorm_) {
    355:     *ierr = EPSSetConvergenceTest(*eps,EPS_CONV_NORM);
    356:   } else {
    357:     *ierr = PetscObjectSetFortranCallback((PetscObject)*eps,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.convergence,(PetscVoidFunction)func,ctx); if (*ierr) return;
    358:     *ierr = PetscObjectSetFortranCallback((PetscObject)*eps,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.convdestroy,(PetscVoidFunction)destroy,ctx); if (*ierr) return;
    359:     *ierr = EPSSetConvergenceTestFunction(*eps,ourconvergence,*eps,ourconvdestroy);
    360:   }
    361: }

    363: SLEPC_EXTERN void epsstoppingbasic_(EPS *eps,PetscInt *its,PetscInt *max_it,PetscInt *nconv,PetscInt *nev,EPSConvergedReason *reason,void *ctx,PetscErrorCode *ierr)
    364: {
    365:   *ierr = EPSStoppingBasic(*eps,*its,*max_it,*nconv,*nev,reason,ctx);
    366: }

    368: SLEPC_EXTERN void epssetstoppingtestfunction_(EPS *eps,void (*func)(EPS*,PetscInt,PetscInt,PetscInt,PetscInt,EPSConvergedReason*,void*,PetscErrorCode*),void* ctx,void (*destroy)(void*,PetscErrorCode*),PetscErrorCode *ierr)
    369: {
    370:   CHKFORTRANNULLOBJECT(ctx);
    371:   CHKFORTRANNULLFUNCTION(destroy);
    372:   if ((PetscVoidFunction)func == (PetscVoidFunction)epsstoppingbasic_) {
    373:     *ierr = EPSSetStoppingTest(*eps,EPS_STOP_BASIC);
    374:   } else {
    375:     *ierr = PetscObjectSetFortranCallback((PetscObject)*eps,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.stopping,(PetscVoidFunction)func,ctx); if (*ierr) return;
    376:     *ierr = PetscObjectSetFortranCallback((PetscObject)*eps,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.stopdestroy,(PetscVoidFunction)destroy,ctx); if (*ierr) return;
    377:     *ierr = EPSSetStoppingTestFunction(*eps,ourstopping,*eps,ourstopdestroy);
    378:   }
    379: }

    381: SLEPC_EXTERN void epsseteigenvaluecomparison_(EPS *eps,void (*func)(PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscInt*,void*),void* ctx,PetscErrorCode *ierr)
    382: {
    383:   CHKFORTRANNULLOBJECT(ctx);
    384:   *ierr = PetscObjectSetFortranCallback((PetscObject)*eps,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.comparison,(PetscVoidFunction)func,ctx); if (*ierr) return;
    385:   *ierr = EPSSetEigenvalueComparison(*eps,oureigenvaluecomparison,*eps);
    386: }

    388: SLEPC_EXTERN void epssetarbitraryselection_(EPS *eps,void (*func)(PetscScalar*,PetscScalar*,Vec*,Vec*,PetscScalar*,PetscScalar*,void*,PetscErrorCode*),void *ctx,PetscErrorCode *ierr)
    389: {
    390:   CHKFORTRANNULLOBJECT(ctx);
    391:   *ierr = PetscObjectSetFortranCallback((PetscObject)*eps,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.arbitrary,(PetscVoidFunction)func,ctx); if (*ierr) return;
    392:   *ierr = EPSSetArbitrarySelection(*eps,ourarbitraryfunc,*eps);
    393: }

    395: SLEPC_EXTERN void epsgetdimensions_(EPS *eps,PetscInt *nev,PetscInt *ncv,PetscInt *mpd,PetscErrorCode *ierr)
    396: {
    397:   CHKFORTRANNULLINTEGER(nev);
    398:   CHKFORTRANNULLINTEGER(ncv);
    399:   CHKFORTRANNULLINTEGER(mpd);
    400:   *ierr = EPSGetDimensions(*eps,nev,ncv,mpd);
    401: }

    403: SLEPC_EXTERN void epsgetdimensions000_(EPS *eps,PetscInt *nev,PetscInt *ncv,PetscInt *mpd,PetscErrorCode *ierr)
    404: {
    405:   epsgetdimensions_(eps,nev,ncv,mpd,ierr);
    406: }

    408: SLEPC_EXTERN void epsgetdimensions100_(EPS *eps,PetscInt *nev,PetscInt *ncv,PetscInt *mpd,PetscErrorCode *ierr)
    409: {
    410:   epsgetdimensions_(eps,nev,ncv,mpd,ierr);
    411: }

    413: SLEPC_EXTERN void epsgetdimensions010_(EPS *eps,PetscInt *nev,PetscInt *ncv,PetscInt *mpd,PetscErrorCode *ierr)
    414: {
    415:   epsgetdimensions_(eps,nev,ncv,mpd,ierr);
    416: }

    418: SLEPC_EXTERN void epsgetdimensions001_(EPS *eps,PetscInt *nev,PetscInt *ncv,PetscInt *mpd,PetscErrorCode *ierr)
    419: {
    420:   epsgetdimensions_(eps,nev,ncv,mpd,ierr);
    421: }

    423: SLEPC_EXTERN void epsgetdimensions110_(EPS *eps,PetscInt *nev,PetscInt *ncv,PetscInt *mpd,PetscErrorCode *ierr)
    424: {
    425:   epsgetdimensions_(eps,nev,ncv,mpd,ierr);
    426: }

    428: SLEPC_EXTERN void epsgetdimensions011_(EPS *eps,PetscInt *nev,PetscInt *ncv,PetscInt *mpd,PetscErrorCode *ierr)
    429: {
    430:   epsgetdimensions_(eps,nev,ncv,mpd,ierr);
    431: }

    433: SLEPC_EXTERN void epsgetdimensions101_(EPS *eps,PetscInt *nev,PetscInt *ncv,PetscInt *mpd,PetscErrorCode *ierr)
    434: {
    435:   epsgetdimensions_(eps,nev,ncv,mpd,ierr);
    436: }

    438: SLEPC_EXTERN void epsgeteigenpair_(EPS *eps,PetscInt *i,PetscScalar *eigr,PetscScalar *eigi,Vec *Vr,Vec *Vi,PetscErrorCode *ierr)
    439: {
    440:   CHKFORTRANNULLSCALAR(eigr);
    441:   CHKFORTRANNULLSCALAR(eigi);
    442:   *ierr = EPSGetEigenpair(*eps,*i,eigr,eigi,*Vr,*Vi);
    443: }

    445: SLEPC_EXTERN void epsgeteigenpair00_(EPS *eps,PetscInt *i,PetscScalar *eigr,PetscScalar *eigi,Vec *Vr,Vec *Vi,PetscErrorCode *ierr)
    446: {
    447:   epsgeteigenpair_(eps,i,eigr,eigi,Vr,Vi,ierr);
    448: }

    450: SLEPC_EXTERN void epsgeteigenpair10_(EPS *eps,PetscInt *i,PetscScalar *eigr,PetscScalar *eigi,Vec *Vr,Vec *Vi,PetscErrorCode *ierr)
    451: {
    452:   epsgeteigenpair_(eps,i,eigr,eigi,Vr,Vi,ierr);
    453: }

    455: SLEPC_EXTERN void epsgeteigenpair01_(EPS *eps,PetscInt *i,PetscScalar *eigr,PetscScalar *eigi,Vec *Vr,Vec *Vi,PetscErrorCode *ierr)
    456: {
    457:   epsgeteigenpair_(eps,i,eigr,eigi,Vr,Vi,ierr);
    458: }

    460: SLEPC_EXTERN void epsgeteigenpair11_(EPS *eps,PetscInt *i,PetscScalar *eigr,PetscScalar *eigi,Vec *Vr,Vec *Vi,PetscErrorCode *ierr)
    461: {
    462:   epsgeteigenpair_(eps,i,eigr,eigi,Vr,Vi,ierr);
    463: }

    465: SLEPC_EXTERN void epsgeteigenvalue_(EPS *eps,PetscInt *i,PetscScalar *eigr,PetscScalar *eigi,PetscErrorCode *ierr)
    466: {
    467:   CHKFORTRANNULLSCALAR(eigr);
    468:   CHKFORTRANNULLSCALAR(eigi);
    469:   *ierr = EPSGetEigenvalue(*eps,*i,eigr,eigi);
    470: }

    472: SLEPC_EXTERN void epsgeteigenvalue00_(EPS *eps,PetscInt *i,PetscScalar *eigr,PetscScalar *eigi,PetscErrorCode *ierr)
    473: {
    474:   epsgeteigenvalue_(eps,i,eigr,eigi,ierr);
    475: }

    477: SLEPC_EXTERN void epsgeteigenvalue10_(EPS *eps,PetscInt *i,PetscScalar *eigr,PetscScalar *eigi,PetscErrorCode *ierr)
    478: {
    479:   epsgeteigenvalue_(eps,i,eigr,eigi,ierr);
    480: }

    482: SLEPC_EXTERN void epsgeteigenvalue01_(EPS *eps,PetscInt *i,PetscScalar *eigr,PetscScalar *eigi,PetscErrorCode *ierr)
    483: {
    484:   epsgeteigenvalue_(eps,i,eigr,eigi,ierr);
    485: }

    487: SLEPC_EXTERN void epsgettolerances_(EPS *eps,PetscReal *tol,PetscInt *maxits,PetscErrorCode *ierr)
    488: {
    489:   CHKFORTRANNULLREAL(tol);
    490:   CHKFORTRANNULLINTEGER(maxits);
    491:   *ierr = EPSGetTolerances(*eps,tol,maxits);
    492: }

    494: SLEPC_EXTERN void epsgettolerances00_(EPS *eps,PetscReal *tol,PetscInt *maxits,PetscErrorCode *ierr)
    495: {
    496:   epsgettolerances_(eps,tol,maxits,ierr);
    497: }

    499: SLEPC_EXTERN void epsgettolerances10_(EPS *eps,PetscReal *tol,PetscInt *maxits,PetscErrorCode *ierr)
    500: {
    501:   epsgettolerances_(eps,tol,maxits,ierr);
    502: }

    504: SLEPC_EXTERN void epsgettolerances01_(EPS *eps,PetscReal *tol,PetscInt *maxits,PetscErrorCode *ierr)
    505: {
    506:   epsgettolerances_(eps,tol,maxits,ierr);
    507: }

    509: SLEPC_EXTERN void epsgetbalance_(EPS *eps,EPSBalance *bal,PetscInt *its,PetscReal *cutoff,PetscErrorCode *ierr)
    510: {
    511:   CHKFORTRANNULLINTEGER(bal);
    512:   CHKFORTRANNULLINTEGER(its);
    513:   CHKFORTRANNULLREAL(cutoff);
    514:   *ierr = EPSGetBalance(*eps,bal,its,cutoff);
    515: }

    517: SLEPC_EXTERN void epsgetbalance000_(EPS *eps,EPSBalance *bal,PetscInt *its,PetscReal *cutoff,PetscErrorCode *ierr)
    518: {
    519:   epsgetbalance_(eps,bal,its,cutoff,ierr);
    520: }

    522: SLEPC_EXTERN void epsgetbalance100_(EPS *eps,EPSBalance *bal,PetscInt *its,PetscReal *cutoff,PetscErrorCode *ierr)
    523: {
    524:   epsgetbalance_(eps,bal,its,cutoff,ierr);
    525: }

    527: SLEPC_EXTERN void epsgetbalance010_(EPS *eps,EPSBalance *bal,PetscInt *its,PetscReal *cutoff,PetscErrorCode *ierr)
    528: {
    529:   epsgetbalance_(eps,bal,its,cutoff,ierr);
    530: }

    532: SLEPC_EXTERN void epsgetbalance001_(EPS *eps,EPSBalance *bal,PetscInt *its,PetscReal *cutoff,PetscErrorCode *ierr)
    533: {
    534:   epsgetbalance_(eps,bal,its,cutoff,ierr);
    535: }

    537: SLEPC_EXTERN void epsgetbalance110_(EPS *eps,EPSBalance *bal,PetscInt *its,PetscReal *cutoff,PetscErrorCode *ierr)
    538: {
    539:   epsgetbalance_(eps,bal,its,cutoff,ierr);
    540: }

    542: SLEPC_EXTERN void epsgetbalance011_(EPS *eps,EPSBalance *bal,PetscInt *its,PetscReal *cutoff,PetscErrorCode *ierr)
    543: {
    544:   epsgetbalance_(eps,bal,its,cutoff,ierr);
    545: }

    547: SLEPC_EXTERN void epsgetbalance101_(EPS *eps,EPSBalance *bal,PetscInt *its,PetscReal *cutoff,PetscErrorCode *ierr)
    548: {
    549:   epsgetbalance_(eps,bal,its,cutoff,ierr);
    550: }

    552: SLEPC_EXTERN void epssetdeflationspace0_(EPS *eps,PetscInt *n,Vec *ds,PetscErrorCode *ierr)
    553: {
    554:   CHKFORTRANNULLOBJECT(ds);
    555:   *ierr = EPSSetDeflationSpace(*eps,*n,ds);
    556: }

    558: SLEPC_EXTERN void epssetdeflationspace1_(EPS *eps,PetscInt *n,Vec *ds,PetscErrorCode *ierr)
    559: {
    560:   CHKFORTRANNULLOBJECT(ds);
    561:   *ierr = EPSSetDeflationSpace(*eps,*n,ds);
    562: }

    564: SLEPC_EXTERN void epssetinitialspace0_(EPS *eps,PetscInt *n,Vec *is,PetscErrorCode *ierr)
    565: {
    566:   CHKFORTRANNULLOBJECT(is);
    567:   *ierr = EPSSetInitialSpace(*eps,*n,is);
    568: }

    570: SLEPC_EXTERN void epssetinitialspace1_(EPS *eps,PetscInt *n,Vec *is,PetscErrorCode *ierr)
    571: {
    572:   CHKFORTRANNULLOBJECT(is);
    573:   *ierr = EPSSetInitialSpace(*eps,*n,is);
    574: }

    576: SLEPC_EXTERN void epssetleftinitialspace0_(EPS *eps,PetscInt *n,Vec *isl,PetscErrorCode *ierr)
    577: {
    578:   CHKFORTRANNULLOBJECT(isl);
    579:   *ierr = EPSSetLeftInitialSpace(*eps,*n,isl);
    580: }

    582: SLEPC_EXTERN void epssetleftinitialspace1_(EPS *eps,PetscInt *n,Vec *isl,PetscErrorCode *ierr)
    583: {
    584:   CHKFORTRANNULLOBJECT(isl);
    585:   *ierr = EPSSetLeftInitialSpace(*eps,*n,isl);
    586: }