1 /*=========================================================================== 2 * 3 * "usr.h": Juin's header funtion 4 * 5 *=========================================================================== 6 */ 7 8 #ifndef __USR_H__ 9 #define __USR_H__ 10 11 #include <FCMangle.h> 12 13 /*=========================================================================== 14 * 15 * "UsrHd": User main struct 16 * 17 *=========================================================================== 18 */ 19 typedef struct _Usr { 20 int eqnType ; /* equation type flag */ 21 double* aperm ; /* permanent data */ 22 double* atemp ; /* temporary data */ 23 double* resf ; /* residual vector */ 24 double* solinc ; /* solution increment */ 25 double* flowDiag ; /* global diagonal of total lhs */ 26 double* sclrDiag ; /* global diagonal of energy lhs */ 27 double* lesP ; /* utility vector for Q = A * P */ 28 double* lesQ ; /* utility vector for Q = A * P */ 29 int* iBC ; /* boundary condition code */ 30 double* BC ; /* boundary condition array */ 31 int* iper ; /* periodic nodal information */ 32 int* ilwork ; /* local MPI communication array */ 33 int numpe ; /* number of processors */ 34 int nNodes ; /* number of nodes */ 35 int nenl ; /* number of element nodes */ 36 int nPermDims ; /* number of permanent data */ 37 int nTmpDims ; /* number of temporary data */ 38 int* rowp ; /* row of p for nonzero's of A */ 39 int* colm ; /* start index for rowp vector */ 40 double* lhsK ; /* sparse K matrix (9,nnzeros) */ 41 double* lhsP ; /* sparse GoC matrix (4,nnzeros) */ 42 double* lhsS ; 43 int* nnz_tot ; /* factor for number of nonzeros) */ 44 double* CGsol; /* pdot after CG solve */ 45 } Usr ; 46 47 typedef struct _Usr* UsrHd ; 48 49 /*=========================================================================== 50 * 51 * C to Fortran naming conversion 52 * 53 *=========================================================================== 54 */ 55 56 #define usrNew FortranCInterface_GLOBAL_(usrnew,USRNEW) 57 #define getSol FortranCInterface_GLOBAL_(getsol,GETSOL) /* extract Dy from usrHd */ 58 59 #define drvlesPrepDiag FortranCInterface_GLOBAL_(drvlesprepdiag,DRVLESPREPDIAG) 60 #define drvLesApG FortranCInterface_GLOBAL_(drvlesapg,DRVLESAPG) 61 #define drvLesApKG FortranCInterface_GLOBAL_(drvlesapkg,DRVLESAPKG) 62 #define drvLesApNGt FortranCInterface_GLOBAL_(drvlesapngt,DRVLESAPNGT) 63 #define drvLesApNGtC FortranCInterface_GLOBAL_(drvlesapngtc,DRVLESAPNGTC) 64 #define drvLesApFull FortranCInterface_GLOBAL_(drvlesapfull,DRVLESAPFULL) 65 66 #define commOut FortranCInterface_GLOBAL_(commout,COMMOUT) 67 #define commIn FortranCInterface_GLOBAL_(commin,COMMIN) 68 #define fLesSparseApSclr FortranCInterface_GLOBAL_(flessparseapsclr,FLESSPARSEAPSCLR) 69 #define fLesSparseApG FortranCInterface_GLOBAL_(flessparseapg,FLESSPARSEAPG) 70 #define fLesSparseApKG FortranCInterface_GLOBAL_(flessparseapkg,FLESSPARSEAPKG) 71 #define fLesSparseApNGt FortranCInterface_GLOBAL_(flessparseapngt,FLESSPARSEAPNGT) 72 #define fLesSparseApNGtC FortranCInterface_GLOBAL_(flessparseapngtc,FLESSPARSEAPNGTC) 73 #define fLesSparseApFull FortranCInterface_GLOBAL_(flessparseapfull,FLESSPARSEAPFULL) 74 75 #define drvsclrDiag FortranCInterface_GLOBAL_(drvsclrdiag,DRVSCLRDIAG) 76 #define drvLesApSclr FortranCInterface_GLOBAL_(drvlesapsclr,DRVLESAPSCLR) 77 #define drvAllreduce FortranCInterface_GLOBAL_(drvallreduce,DRVALLREDUCE) 78 #define drvAllreducesclr FortranCInterface_GLOBAL_(drvallreducesclr,DRVALLREDUCESCLR) 79 #define flesCp FortranCInterface_GLOBAL_(flescp,FLESCP) 80 #define flesScale FortranCInterface_GLOBAL_(flesscale,FLESSCALE) 81 #define flesScaleCp FortranCInterface_GLOBAL_(flesscalecp,FLESSCALECP) 82 #define flesAdd FortranCInterface_GLOBAL_(flesadd,FLESADD) 83 #define flesSub FortranCInterface_GLOBAL_(flessub,FLESSUB) 84 #define flesDot1 FortranCInterface_GLOBAL_(flesdot1,FLESDOT1) 85 #define flesDot2 FortranCInterface_GLOBAL_(flesdot2,FLESDOT2) 86 #define flesDaxpy FortranCInterface_GLOBAL_(flesdaxpy,FLESDAXPY) 87 #define flesDxpay FortranCInterface_GLOBAL_(flesdxpay,FLESDXPAY) 88 #define flesInv FortranCInterface_GLOBAL_(flesinv,FLESINV) 89 #define flesZero FortranCInterface_GLOBAL_(fleszero,FLESZERO) 90 #define fsclrDiag FortranCInterface_GLOBAL_(fsclrdiag,FSCLRDIAG) 91 #define flesApSclr FortranCInterface_GLOBAL_(flesapsclr,FLESAPSCLR) 92 #define fMtxVdimVecMult FortranCInterface_GLOBAL_(fmtxvdimvecmult,FMTXVDIMVECMULT) 93 #define fMtxBlkDot2 FortranCInterface_GLOBAL_(fmtxblkdot2,FMTXBLKDOT2) 94 #define fMtxBlkDaxpy FortranCInterface_GLOBAL_(fmtxblkdaxpy,FMTXBLKDAXPY) 95 #define fMtxBlkDyeax FortranCInterface_GLOBAL_(fmtxblkdyeax,FMTXBLKDYEAX) 96 #define fMtxBlkDmaxpy FortranCInterface_GLOBAL_(fmtxblkdmaxpy,FMTXBLKDMAXPY) 97 #define fMtxVdimVecCp FortranCInterface_GLOBAL_(fmtxvdimveccp,FMTXVDIMVECCP) 98 #define fMtxVdimVecDot2 FortranCInterface_GLOBAL_(fmtxvdimvecdot2,FMTXVDIMVECDOT2) 99 #define fMtxVdimVecDaxpy FortranCInterface_GLOBAL_(fmtxvdimvecdaxpy,FMTXVDIMVECDAXPY) 100 #define ramg_interface FortranCInterface_GLOBAL_(ramg_interface,RAMG_INTERFACE) 101 #define ramg_normcheck FortranCInterface_GLOBAL_(ramg_normcheck,RAMG_NORMCHECK) 102 103 /*=========================================================================== 104 * 105 * Function declaration 106 * 107 *=========================================================================== 108 */ 109 void usrNew( UsrHd usrHd, 110 int* eqnType, 111 double* aperm, 112 double* atemp, 113 double* resf, 114 double* solinc, 115 double* flowDiag, 116 double* sclrDiag, 117 double* lesP, 118 double* lesQ, 119 int* iBC, 120 double* BC, 121 int* iper, 122 int* ilwork, 123 int* numpe, 124 int* nNodes, 125 int* nenl, 126 int* nPermDims, 127 int* nTmpDims, 128 int* rowp, 129 int* colm, 130 double* lhsK, 131 double* lhsP, 132 double* lhsS, 133 int* nnz_tot, 134 double* CGsol) ; 135 136 double* usrPointer( UsrHd usrHd, 137 int id, 138 int offset, 139 int nDims ) ; 140 141 void getSol( UsrHd usrHd, 142 double* Dy ) ; 143 144 /*=========================================================================== 145 * 146 * Fortran Function declaration 147 * 148 *=========================================================================== 149 */ 150 double flesDot1( double* a, 151 int* m, 152 int* n ) ; 153 double flesDot2( double* a, 154 double* b, 155 int* m, 156 int* n ) ; 157 158 /*=========================================================================== 159 * 160 * End of the file 161 * 162 *=========================================================================== 163 */ 164 165 #endif /* __USR_H__ */ 166 167