Actual source code: slepcfn.h

slepc-3.22.2 2024-12-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: #pragma once

 16: #include <slepcsys.h>

 18: /* SUBMANSEC = FN */

 20: #define FN_MAX_SOLVE 16

 22: SLEPC_EXTERN PetscErrorCode FNInitializePackage(void);
 23: SLEPC_EXTERN PetscErrorCode FNFinalizePackage(void);

 25: /*S
 26:    FN - Abstraction of a mathematical function.

 28:    Level: beginner

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

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

 37:    Level: beginner

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

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

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

 56:     Level: advanced

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

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

 68:     Level: advanced

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

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

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

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

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

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

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

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

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