Actual source code: zbvf.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 <slepcbv.h>

     14: #if defined(PETSC_HAVE_FORTRAN_CAPS)
     15: #define bvsettype_                BVSETTYPE
     16: #define bvgettype_                BVGETTYPE
     17: #define bvsetoptionsprefix_       BVSETOPTIONSPREFIX
     18: #define bvappendoptionsprefix_    BVAPPENDOPTIONSPREFIX
     19: #define bvgetoptionsprefix_       BVGETOPTIONSPREFIX
     20: #define bvdestroy_                BVDESTROY
     21: #define bvview_                   BVVIEW
     22: #define bvviewfromoptions_        BVVIEWFROMOPTIONS
     23: #define bvsetvectype_             BVSETVECTYPE
     24: #define bvgetvectype_             BVGETVECTYPE
     25: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
     26: #define bvsettype_                bvsettype
     27: #define bvgettype_                bvgettype
     28: #define bvsetoptionsprefix_       bvsetoptionsprefix
     29: #define bvappendoptionsprefix_    bvappendoptionsprefix
     30: #define bvgetoptionsprefix_       bvgetoptionsprefix
     31: #define bvdestroy_                bvdestroy
     32: #define bvview_                   bvview
     33: #define bvviewfromoptions_        bvviewfromoptions
     34: #define bvsetvectype_             bvsetvectype
     35: #define bvgetvectype_             bvgetvectype
     36: #endif

     38: SLEPC_EXTERN void bvsettype_(BV *bv,char *type,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
     39: {
     40:   char *t;

     42:   FIXCHAR(type,len,t);
     43:   *ierr = BVSetType(*bv,t);if (*ierr) return;
     44:   FREECHAR(type,t);
     45: }

     47: SLEPC_EXTERN void bvgettype_(BV *bv,char *name,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
     48: {
     49:   BVType tname;

     51:   *ierr = BVGetType(*bv,&tname); if (*ierr) return;
     52:   *ierr = PetscStrncpy(name,tname,len);if (*ierr) return;
     53:   FIXRETURNCHAR(PETSC_TRUE,name,len);
     54: }

     56: SLEPC_EXTERN void bvsetoptionsprefix_(BV *bv,char *prefix,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
     57: {
     58:   char *t;

     60:   FIXCHAR(prefix,len,t);
     61:   *ierr = BVSetOptionsPrefix(*bv,t);if (*ierr) return;
     62:   FREECHAR(prefix,t);
     63: }

     65: SLEPC_EXTERN void bvappendoptionsprefix_(BV *bv,char *prefix,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
     66: {
     67:   char *t;

     69:   FIXCHAR(prefix,len,t);
     70:   *ierr = BVAppendOptionsPrefix(*bv,t);if (*ierr) return;
     71:   FREECHAR(prefix,t);
     72: }

     74: SLEPC_EXTERN void bvgetoptionsprefix_(BV *bv,char *prefix,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
     75: {
     76:   const char *tname;

     78:   *ierr = BVGetOptionsPrefix(*bv,&tname); if (*ierr) return;
     79:   *ierr = PetscStrncpy(prefix,tname,len);if (*ierr) return;
     80:   FIXRETURNCHAR(PETSC_TRUE,prefix,len);
     81: }

     83: SLEPC_EXTERN void bvdestroy_(BV *bv,PetscErrorCode *ierr)
     84: {
     85:   PETSC_FORTRAN_OBJECT_F_DESTROYED_TO_C_NULL(bv);
     86:   *ierr = BVDestroy(bv); if (*ierr) return;
     87:   PETSC_FORTRAN_OBJECT_C_NULL_TO_F_DESTROYED(bv);
     88: }

     90: SLEPC_EXTERN void bvview_(BV *bv,PetscViewer *viewer,PetscErrorCode *ierr)
     91: {
     92:   PetscViewer v;
     93:   PetscPatchDefaultViewers_Fortran(viewer,v);
     94:   *ierr = BVView(*bv,v);
     95: }

     97: SLEPC_EXTERN void bvviewfromoptions_(BV *bv,PetscObject obj,char* type,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
     98: {
     99:   char *t;

    101:   FIXCHAR(type,len,t);
    102:   CHKFORTRANNULLOBJECT(obj);
    103:   *ierr = BVViewFromOptions(*bv,obj,t);if (*ierr) return;
    104:   FREECHAR(type,t);
    105: }

    107: SLEPC_EXTERN void bvsetvectype_(BV *bv,char *vtype,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
    108: {
    109:   char *t;

    111:   FIXCHAR(vtype,len,t);
    112:   *ierr = BVSetVecType(*bv,t);if (*ierr) return;
    113:   FREECHAR(vtype, t);
    114: }

    116: SLEPC_EXTERN void bvgetvectype_(BV *bv,char *vtype,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
    117: {
    118:   const char *tname;

    120:   *ierr = BVGetVecType(*bv,&tname);if (*ierr) return;
    121:   if (vtype!=PETSC_NULL_CHARACTER_Fortran) {
    122:     *ierr = PetscStrncpy(vtype,tname,len);if (*ierr) return;
    123:   }
    124:   FIXRETURNCHAR(PETSC_TRUE,vtype,len);
    125: }