Date: 2022-11-02T11:47:50+00:00

Actual source code: slepcfn.h
slepc-3.18.1 2022-11-02
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: */
     10: /*
     11:    User interface for the mathematical function object in SLEPc
     12: */

     14: #if !defined(SLEPCFN_H)
     15: #define SLEPCFN_H

     17: #include <slepcsys.h>

     19: /* SUBMANSEC = FN */

     21: #define FN_MAX_SOLVE 16

     23: SLEPC_EXTERN PetscErrorCode FNInitializePackage(void);
     24: /*S
     25:    FN - Abstraction of a mathematical function.

     27:    Level: beginner

     29: .seealso: FNCreate()
     30: S*/
     31: typedef struct _p_FN* FN;

     33: /*J
     34:    FNType - String with the name of the mathematical function.

     36:    Level: beginner

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

     49: /* Logging support */
     50: SLEPC_EXTERN PetscClassId FN_CLASSID;

     52: /*E
     53:     FNCombineType - Determines how two functions are combined

     55:     Level: advanced

     57: .seealso: FNCombineSetChildren()
     58: E*/
     59: typedef enum { FN_COMBINE_ADD,
     60:                FN_COMBINE_MULTIPLY,
     61:                FN_COMBINE_DIVIDE,
     62:                FN_COMBINE_COMPOSE } FNCombineType;

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

     67:     Level: advanced

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

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

     87: SLEPC_EXTERN PetscErrorCode FNSetScale(FN,PetscScalar,PetscScalar);
     88: SLEPC_EXTERN PetscErrorCode FNGetScale(FN,PetscScalar*,PetscScalar*);
     89: SLEPC_EXTERN PetscErrorCode FNSetMethod(FN,PetscInt);
     90: SLEPC_EXTERN PetscErrorCode FNGetMethod(FN,PetscInt*);
     91: SLEPC_EXTERN PetscErrorCode FNSetParallel(FN,FNParallelType);
     92: SLEPC_EXTERN PetscErrorCode FNGetParallel(FN,FNParallelType*);

     94: SLEPC_EXTERN PetscErrorCode FNEvaluateFunction(FN,PetscScalar,PetscScalar*);
     95: SLEPC_EXTERN PetscErrorCode FNEvaluateDerivative(FN,PetscScalar,PetscScalar*);
     96: SLEPC_EXTERN PetscErrorCode FNEvaluateFunctionMat(FN,Mat,Mat);
     97: SLEPC_EXTERN PetscErrorCode FNEvaluateFunctionMatVec(FN,Mat,Vec);

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

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

    104: SLEPC_EXTERN PetscErrorCode FNRationalSetNumerator(FN,PetscInt,PetscScalar*);
    105: SLEPC_EXTERN PetscErrorCode FNRationalGetNumerator(FN,PetscInt*,PetscScalar**);
    106: SLEPC_EXTERN PetscErrorCode FNRationalSetDenominator(FN,PetscInt,PetscScalar*);
    107: SLEPC_EXTERN PetscErrorCode FNRationalGetDenominator(FN,PetscInt*,PetscScalar**);

    109: SLEPC_EXTERN PetscErrorCode FNCombineSetChildren(FN,FNCombineType,FN,FN);
    110: SLEPC_EXTERN PetscErrorCode FNCombineGetChildren(FN,FNCombineType*,FN*,FN*);

    112: SLEPC_EXTERN PetscErrorCode FNPhiSetIndex(FN,PetscInt);
    113: SLEPC_EXTERN PetscErrorCode FNPhiGetIndex(FN,PetscInt*);

    115: #endif