Actual source code: samgfunc.h

  1: #ifndef SAMGFUNC_H
  2: #define SAMGFUNC_H


  5: /*..Structure to hold SAMG parameters..*/
  6: struct SAMG_PARAM{
  7:   /*....Primary parameters....*/
  8:                  int    MATRIX;
  9:                  int    IFIRST;
 10:                  double EPS;
 11:                  int    NSOLVE;
 12:                  int    NCYC;
 13:                  int    ISWTCH;
 14:                  double A_CMPLX;
 15:                  double G_CMPLX;
 16:                  double P_CMPLX;
 17:                  double W_AVRGE;
 18:                  double CHKTOL;
 19:                  int    IDUMP;
 20:                  int    IOUT;
 21:   /*....Secundary parameters....*/
 22:                  int    LEVELX;
 23:                  int    NPTMN;
 24:                  double ECG;
 25:                  double EWT;
 26:                  int    NCG;
 27:                  int    NWT;
 28:                  double ETR;
 29:                  int    NTR;
 30:                  int    NRD;
 31:                  int    NRU;
 32:                  int    NRC;
 33:                };

 35: /*..We'll use underscores in the name giving of the routines as the 
 36:   Fortran compiler does not distinguish between lower and upper case..*/

 38: #ifdef PETSC_HAVE_FORTRAN_CAPS
 39: #elif defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
 40: #define SAMGPETSC_apply_shift            samgpetsc_apply_shift_ 
 41: #define SAMGPETSC_get_levels             samgpetsc_get_levels_
 42: #define SAMGPETSC_get_dim_operator       samgpetsc_get_dim_operator_
 43: #define SAMGPETSC_get_operator           samgpetsc_get_operator_
 44: #define SAMGPETSC_get_dim_interpol       samgpetsc_get_dim_interpol_
 45: #define SAMGPETSC_get_interpol           samgpetsc_get_interpol_
 46: #else
 47: #define SAMGPETSC_apply_shift            samgpetsc_apply_shift
 48: #define SAMGPETSC_get_levels             samgpetsc_get_levels
 49: #define SAMGPETSC_get_dim_operator       samgpetsc_get_dim_operator
 50: #define SAMGPETSC_get_operator           samgpetsc_get_operator
 51: #define SAMGPETSC_get_dim_interpol       samgpetsc_get_dim_interpol
 52: #define SAMGPETSC_get_interpol           samgpetsc_get_interpol
 53: #endif 

 55: /*..Routine to apply ia_shift on all elements of ia and ja_shift on all 
 56:   elements of ja..*/
 58: void SAMGPETSC_apply_shift(int* ia, int* nnu, int* ia_shift, 
 59:                            int* ja, int* nna, int* ja_shift);

 61: /*..Level 1 routine to get number of levels created..*/
 63: void SAMGPETSC_get_levels(int* levelscp);

 65: /*..Level 1 routines to access grid operators..*/
 67: void SAMGPETSC_get_dim_operator(int* k, int* nnu, int* nna);
 69: void SAMGPETSC_get_operator(int* k, double* aout, int* iaout, int* jaout);

 71: /*..Level 1 routines to access interpolation operator..*/
 73: void SAMGPETSC_get_dim_interpol(int* k, int* nnu, int* nna);
 75: void SAMGPETSC_get_interpol(int* k, double* wout, int* iwout, int* jwout);

 77: /*..Aux function to pass SAMG hierarchy to PETSc..*/
 78: void apply_shift(int*ia, int nnu, int ia_shift, int* ja, int nna, 
 79:                      int ja_shift);

 81: /*..Functions for verifying intermediate results: printing interpolation 
 82:   and coarser grid matrices to file..*/
 83: PetscErrorCode SamgPetscWriteOperator(const int numnodes, const double* Asky, 
 84:                            const int* ia, const int* ja, int extension);
 85: PetscErrorCode SamgPetscWriteInterpol(const int numrows, const double* weights, 
 86:                   const int* iweights, const int* jweights, int extension);
 87: 
 88: #endif//SAMGFUNC_H