Actual source code: slepcimpl.h

slepc-3.8.3 2018-04-03
Report Typos and Errors
  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2017, 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(_SLEPCIMPL)
 12: #define _SLEPCIMPL

 14: #include <slepcsys.h>
 15: #include <petsc/private/petscimpl.h>

 17: PETSC_INTERN PetscBool SlepcBeganPetsc;

 19: /*@C
 20:     SlepcHeaderCreate - Creates a SLEPc object

 22:     Input Parameters:
 23: +   classid - the classid associated with this object
 24: .   class_name - string name of class; should be static
 25: .   descr - string containing short description; should be static
 26: .   mansec - string indicating section in manual pages; should be static
 27: .   comm - the MPI Communicator
 28: .   destroy - the destroy routine for this object
 29: -   view - the view routine for this object

 31:     Output Parameter:
 32: .   h - the newly created object

 34:     Note:
 35:     This is equivalent to PetscHeaderCreate but makes sure that SlepcInitialize
 36:     has been called.

 38:     Level: developer
 39: @*/
 40: #define SlepcHeaderCreate(h,classid,class_name,descr,mansec,comm,destroy,view) \
 41:     ((!SlepcInitializeCalled && \
 42:     PetscError(comm,__LINE__,PETSC_FUNCTION_NAME,__FILE__,1,PETSC_ERROR_INITIAL, \
 43:     "Must call SlepcInitialize instead of PetscInitialize to use SLEPc classes")) ||  \
 44:     PetscHeaderCreate(h,classid,class_name,descr,mansec,comm,destroy,view))

 46: /* context for monitors of type XXXMonitorConverged */
 47: struct _n_SlepcConvMonitor {
 48:   PetscViewer       viewer;
 49:   PetscViewerFormat format;
 50:   PetscInt          oldnconv;
 51: };

 53: /*
 54:   SlepcPrintEigenvalueASCII - Print an eigenvalue on an ASCII viewer.
 55: */
 56: PETSC_STATIC_INLINE PetscErrorCode SlepcPrintEigenvalueASCII(PetscScalar eigr,PetscScalar eigi)
 57: {
 59:   PetscReal      re,im;

 62: #if defined(PETSC_USE_COMPLEX)
 63:   re = PetscRealPart(eigr);
 64:   im = PetscImaginaryPart(eigr);
 65: #else
 66:   re = eigr;
 67:   im = eigi;
 68: #endif
 69:   /* print zero instead of tiny value */
 70:   if (PetscAbs(im) && PetscAbs(re)/PetscAbs(im)<PETSC_SMALL) re = 0.0;
 71:   if (PetscAbs(re) && PetscAbs(im)/PetscAbs(re)<PETSC_SMALL) im = 0.0;
 72:   /* print as real if imaginary part is zero */
 73:   if (im!=0.0) {
 74:     PetscPrintf(PETSC_COMM_WORLD,"%.5f%+.5fi",(double)re,(double)im);
 75:   } else {
 76:     PetscPrintf(PETSC_COMM_WORLD,"%.5f",(double)re);
 77:   }
 78:   return(0);
 79: }

 81: /* Private functions that are shared by several classes */
 82: PETSC_EXTERN PetscErrorCode SlepcBasisReference_Private(PetscInt,Vec*,PetscInt*,Vec**);
 83: PETSC_EXTERN PetscErrorCode SlepcBasisDestroy_Private(PetscInt*,Vec**);

 85: PETSC_INTERN PetscErrorCode SlepcCitationsInitialize(void);
 86: PETSC_INTERN PetscErrorCode SlepcInitialize_DynamicLibraries(void);
 87: PETSC_INTERN PetscErrorCode SlepcInitialize_Packages(void);

 89: #endif