Date: 2021-09-20T09:44:15+00:00

Actual source code: slepcfn.h
slepc-3.15.2 2021-09-20
Report Typos and Errors

      1: /*
      2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
      4:    Copyright (c) 2002-2021, 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: */
     10: /*
     11:    User interface for the mathematical function object in SLEPc
     12: */

     14: #if !defined(SLEPCFN_H)
     15: #define SLEPCFN_H
     16: #include <slepcsys.h>

     18: #define FN_MAX_SOLVE 16

     20: SLEPC_EXTERN PetscErrorCode FNInitializePackage(void);
     21: /*S
     22:    FN - Abstraction of a mathematical function.

     24:    Level: beginner

     26: .seealso: FNCreate()
     27: S*/
     28: typedef struct _p_FN* FN;

     30: /*J
     31:    FNType - String with the name of the mathematical function.

     33:    Level: beginner

     35: .seealso: FNSetType(), FN
     36: J*/
     37: typedef const char* FNType;
     38: #define FNCOMBINE  "combine"
     39: #define FNRATIONAL "rational"
     40: #define FNEXP      "exp"
     41: #define FNLOG      "log"
     42: #define FNPHI      "phi"
     43: #define FNSQRT     "sqrt"
     44: #define FNINVSQRT  "invsqrt"

     46: /* Logging support */
     47: SLEPC_EXTERN PetscClassId FN_CLASSID;

     49: /*E
     50:     FNCombineType - Determines how two functions are combined

     52:     Level: advanced

     54: .seealso: FNCombineSetChildren()
     55: E*/
     56: typedef enum { FN_COMBINE_ADD,
     57:                FN_COMBINE_MULTIPLY,
     58:                FN_COMBINE_DIVIDE,
     59:                FN_COMBINE_COMPOSE } FNCombineType;

     61: /*E
     62:     FNParallelType - Indicates the parallel mode that will be used for matrix evaluation

     64:     Level: advanced

     66: .seealso: FNSetParallel()
     67: E*/
     68: typedef enum { FN_PARALLEL_REDUNDANT,
     69:                FN_PARALLEL_SYNCHRONIZED } FNParallelType;
     70: SLEPC_EXTERN const char *FNParallelTypes[];

     72: SLEPC_EXTERN PetscErrorCode FNCreate(MPI_Comm,FN*);
     73: SLEPC_EXTERN PetscErrorCode FNSetType(FN,FNType);
     74: SLEPC_EXTERN PetscErrorCode FNGetType(FN,FNType*);
     75: SLEPC_EXTERN PetscErrorCode FNSetOptionsPrefix(FN,const char *);
     76: SLEPC_EXTERN PetscErrorCode FNAppendOptionsPrefix(FN,const char *);
     77: SLEPC_EXTERN PetscErrorCode FNGetOptionsPrefix(FN,const char *[]);
     78: SLEPC_EXTERN PetscErrorCode FNSetFromOptions(FN);
     79: SLEPC_EXTERN PetscErrorCode FNView(FN,PetscViewer);
     80: SLEPC_EXTERN PetscErrorCode FNViewFromOptions(FN,PetscObject,const char[]);
     81: SLEPC_EXTERN PetscErrorCode FNDestroy(FN*);
     82: SLEPC_EXTERN PetscErrorCode FNDuplicate(FN,MPI_Comm,FN*);

     84: SLEPC_EXTERN PetscErrorCode FNSetScale(FN,PetscScalar,PetscScalar);
     85: SLEPC_EXTERN PetscErrorCode FNGetScale(FN,PetscScalar*,PetscScalar*);
     86: SLEPC_EXTERN PetscErrorCode FNSetMethod(FN,PetscInt);
     87: SLEPC_EXTERN PetscErrorCode FNGetMethod(FN,PetscInt*);
     88: SLEPC_EXTERN PetscErrorCode FNSetParallel(FN,FNParallelType);
     89: SLEPC_EXTERN PetscErrorCode FNGetParallel(FN,FNParallelType*);

     91: SLEPC_EXTERN PetscErrorCode FNEvaluateFunction(FN,PetscScalar,PetscScalar*);
     92: SLEPC_EXTERN PetscErrorCode FNEvaluateDerivative(FN,PetscScalar,PetscScalar*);
     93: SLEPC_EXTERN PetscErrorCode FNEvaluateFunctionMat(FN,Mat,Mat);
     94: SLEPC_EXTERN PetscErrorCode FNEvaluateFunctionMatVec(FN,Mat,Vec);

     96: SLEPC_EXTERN PetscFunctionList FNList;
     97: SLEPC_EXTERN PetscErrorCode FNRegister(const char[],PetscErrorCode(*)(FN));

     99: /* --------- options specific to particular functions -------- */

    101: SLEPC_EXTERN PetscErrorCode FNRationalSetNumerator(FN,PetscInt,PetscScalar*);
    102: SLEPC_EXTERN PetscErrorCode FNRationalGetNumerator(FN,PetscInt*,PetscScalar**);
    103: SLEPC_EXTERN PetscErrorCode FNRationalSetDenominator(FN,PetscInt,PetscScalar*);
    104: SLEPC_EXTERN PetscErrorCode FNRationalGetDenominator(FN,PetscInt*,PetscScalar**);

    106: SLEPC_EXTERN PetscErrorCode FNCombineSetChildren(FN,FNCombineType,FN,FN);
    107: SLEPC_EXTERN PetscErrorCode FNCombineGetChildren(FN,FNCombineType*,FN*,FN*);

    109: SLEPC_EXTERN PetscErrorCode FNPhiSetIndex(FN,PetscInt);
    110: SLEPC_EXTERN PetscErrorCode FNPhiGetIndex(FN,PetscInt*);

    112: #endif