Actual source code: vecimplslepc.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: */

 11: #if !defined(SLEPCVECIMPL_H)
 12: #define SLEPCVECIMPL_H

 14: #include <slepcvec.h>
 15: #include <slepc/private/slepcimpl.h>

 17: /* SUBMANSEC = sys */

 19: #if !defined(PETSC_USE_DEBUG)

 21: #define SlepcValidVecComp(y,arg) do {(void)(y);} while (0)

 23: #else

 25: #define SlepcValidVecComp(y,arg) \
 26:   do { \
 28:   } while (0)

 30: #endif

 32: /* Contexts for VecComp */
 33: typedef struct {
 34:   PetscInt      n;        /* number of active subvectors */
 35:   PetscInt      N;        /* virtual global size */
 36:   PetscInt      lN;       /* virtual local size */
 37:   PetscInt      friends;  /* number of vectors sharing this structure */
 38: } Vec_Comp_N;

 40: typedef struct {
 41:   Vec           *x;       /* the vectors */
 42:   PetscInt      nx;       /* number of available subvectors */
 43:   Vec_Comp_N    *n;       /* structure shared by friend vectors */
 44: } Vec_Comp;

 46: /* Operations implemented in VecComp */
 47: SLEPC_INTERN PetscErrorCode VecDuplicateVecs_Comp(Vec,PetscInt,Vec*[]);
 48: SLEPC_INTERN PetscErrorCode VecDestroyVecs_Comp(PetscInt,Vec[]);
 49: SLEPC_INTERN PetscErrorCode VecDuplicate_Comp(Vec,Vec*);
 50: SLEPC_INTERN PetscErrorCode VecDestroy_Comp(Vec);
 51: SLEPC_INTERN PetscErrorCode VecSet_Comp(Vec,PetscScalar);
 52: SLEPC_INTERN PetscErrorCode VecView_Comp(Vec,PetscViewer);
 53: SLEPC_INTERN PetscErrorCode VecScale_Comp(Vec,PetscScalar);
 54: SLEPC_INTERN PetscErrorCode VecCopy_Comp(Vec,Vec);
 55: SLEPC_INTERN PetscErrorCode VecSwap_Comp(Vec,Vec);
 56: SLEPC_INTERN PetscErrorCode VecAXPY_Comp(Vec,PetscScalar,Vec);
 57: SLEPC_INTERN PetscErrorCode VecAYPX_Comp(Vec,PetscScalar,Vec);
 58: SLEPC_INTERN PetscErrorCode VecAXPBY_Comp(Vec,PetscScalar,PetscScalar,Vec);
 59: SLEPC_INTERN PetscErrorCode VecMAXPY_Comp(Vec,PetscInt,const PetscScalar*,Vec*);
 60: SLEPC_INTERN PetscErrorCode VecWAXPY_Comp(Vec,PetscScalar,Vec,Vec);
 61: SLEPC_INTERN PetscErrorCode VecAXPBYPCZ_Comp(Vec,PetscScalar,PetscScalar,PetscScalar,Vec,Vec);
 62: SLEPC_INTERN PetscErrorCode VecPointwiseMult_Comp(Vec,Vec,Vec);
 63: SLEPC_INTERN PetscErrorCode VecPointwiseDivide_Comp(Vec,Vec,Vec);
 64: SLEPC_INTERN PetscErrorCode VecGetSize_Comp(Vec,PetscInt*);
 65: SLEPC_INTERN PetscErrorCode VecGetLocalSize_Comp(Vec,PetscInt*);
 66: SLEPC_INTERN PetscErrorCode VecMax_Comp(Vec,PetscInt*,PetscReal*);
 67: SLEPC_INTERN PetscErrorCode VecMin_Comp(Vec,PetscInt*,PetscReal*);
 68: SLEPC_INTERN PetscErrorCode VecSetRandom_Comp(Vec,PetscRandom);
 69: SLEPC_INTERN PetscErrorCode VecConjugate_Comp(Vec);
 70: SLEPC_INTERN PetscErrorCode VecReciprocal_Comp(Vec);
 71: SLEPC_INTERN PetscErrorCode VecMaxPointwiseDivide_Comp(Vec,Vec,PetscReal*);
 72: SLEPC_INTERN PetscErrorCode VecPointwiseMax_Comp(Vec,Vec,Vec);
 73: SLEPC_INTERN PetscErrorCode VecPointwiseMaxAbs_Comp(Vec,Vec,Vec);
 74: SLEPC_INTERN PetscErrorCode VecPointwiseMin_Comp(Vec,Vec,Vec);
 75: SLEPC_INTERN PetscErrorCode VecDotNorm2_Comp_Seq(Vec,Vec,PetscScalar*,PetscScalar*);
 76: SLEPC_INTERN PetscErrorCode VecDotNorm2_Comp_MPI(Vec,Vec,PetscScalar*,PetscScalar*);
 77: SLEPC_INTERN PetscErrorCode VecSqrtAbs_Comp(Vec);
 78: SLEPC_INTERN PetscErrorCode VecAbs_Comp(Vec);
 79: SLEPC_INTERN PetscErrorCode VecExp_Comp(Vec);
 80: SLEPC_INTERN PetscErrorCode VecLog_Comp(Vec);
 81: SLEPC_INTERN PetscErrorCode VecShift_Comp(Vec,PetscScalar);
 82: SLEPC_EXTERN PetscErrorCode VecCreate_Comp(Vec);

 84: /* VecPool */
 85: typedef struct VecPool_ {
 86:   Vec      v;              /* template vector */
 87:   Vec      *vecs;          /* pool of vectors */
 88:   PetscInt n;              /* size of vecs */
 89:   PetscInt used;           /* number of already used vectors */
 90:   PetscInt guess;          /* expected maximum number of vectors */
 91:   struct VecPool_ *next;   /* list of pool of vectors */
 92: } VecPool_;
 93: typedef VecPool_* VecPool;

 95: SLEPC_EXTERN PetscErrorCode SlepcVecPoolCreate(Vec,PetscInt,VecPool*);
 96: SLEPC_EXTERN PetscErrorCode SlepcVecPoolDestroy(VecPool*);
 97: SLEPC_EXTERN PetscErrorCode SlepcVecPoolGetVecs(VecPool,PetscInt,Vec**);
 98: SLEPC_EXTERN PetscErrorCode SlepcVecPoolRestoreVecs(VecPool,PetscInt,Vec**);
 99: #endif