Actual source code: zfnf.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 <slepcfn.h>

     14: #if defined(PETSC_HAVE_FORTRAN_CAPS)
     15: #define fndestroy_                 FNDESTROY
     16: #define fnview_                    FNVIEW
     17: #define fnviewfromoptions_         FNVIEWFROMOPTIONS
     18: #define fnsetoptionsprefix_        FNSETOPTIONSPREFIX
     19: #define fnappendoptionsprefix_     FNAPPENDOPTIONSPREFIX
     20: #define fngetoptionsprefix_        FNGETOPTIONSPREFIX
     21: #define fnsettype_                 FNSETTYPE
     22: #define fngettype_                 FNGETTYPE
     23: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
     24: #define fndestroy_                 fndestroy
     25: #define fnview_                    fnview
     26: #define fnviewfromoptions_         fnviewfromoptions
     27: #define fnsetoptionsprefix_        fnsetoptionsprefix
     28: #define fnappendoptionsprefix_     fnappendoptionsprefix
     29: #define fngetoptionsprefix_        fngetoptionsprefix
     30: #define fnsettype_                 fnsettype
     31: #define fngettype_                 fngettype
     32: #endif

     34: SLEPC_EXTERN void fndestroy_(FN *fn,PetscErrorCode *ierr)
     35: {
     36:   PETSC_FORTRAN_OBJECT_F_DESTROYED_TO_C_NULL(fn);
     37:   *ierr = FNDestroy(fn); if (*ierr) return;
     38:   PETSC_FORTRAN_OBJECT_C_NULL_TO_F_DESTROYED(fn);
     39: }

     41: SLEPC_EXTERN void fnview_(FN *fn,PetscViewer *viewer,PetscErrorCode *ierr)
     42: {
     43:   PetscViewer v;
     44:   PetscPatchDefaultViewers_Fortran(viewer,v);
     45:   *ierr = FNView(*fn,v);
     46: }

     48: SLEPC_EXTERN void fnviewfromoptions_(FN *fn,PetscObject obj,char* type,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
     49: {
     50:   char *t;

     52:   FIXCHAR(type,len,t);
     53:   CHKFORTRANNULLOBJECT(obj);
     54:   *ierr = FNViewFromOptions(*fn,obj,t);if (*ierr) return;
     55:   FREECHAR(type,t);
     56: }

     58: SLEPC_EXTERN void fnsetoptionsprefix_(FN *fn,char *prefix,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
     59: {
     60:   char *t;

     62:   FIXCHAR(prefix,len,t);
     63:   *ierr = FNSetOptionsPrefix(*fn,t);if (*ierr) return;
     64:   FREECHAR(prefix,t);
     65: }

     67: SLEPC_EXTERN void fnappendoptionsprefix_(FN *fn,char *prefix,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
     68: {
     69:   char *t;

     71:   FIXCHAR(prefix,len,t);
     72:   *ierr = FNAppendOptionsPrefix(*fn,t);if (*ierr) return;
     73:   FREECHAR(prefix,t);
     74: }

     76: SLEPC_EXTERN void fngetoptionsprefix_(FN *fn,char *prefix,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
     77: {
     78:   const char *tname;

     80:   *ierr = FNGetOptionsPrefix(*fn,&tname); if (*ierr) return;
     81:   *ierr = PetscStrncpy(prefix,tname,len);if (*ierr) return;
     82:   FIXRETURNCHAR(PETSC_TRUE,prefix,len);
     83: }

     85: SLEPC_EXTERN void fnsettype_(FN *fn,char *type,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
     86: {
     87:   char *t;

     89:   FIXCHAR(type,len,t);
     90:   *ierr = FNSetType(*fn,t);if (*ierr) return;
     91:   FREECHAR(type,t);
     92: }

     94: SLEPC_EXTERN void fngettype_(FN *fn,char *name,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len)
     95: {
     96:   FNType tname;

     98:   *ierr = FNGetType(*fn,&tname);if (*ierr) return;
     99:   *ierr = PetscStrncpy(name,tname,len);if (*ierr) return;
    100:   FIXRETURNCHAR(PETSC_TRUE,name,len);
    101: }