1 /* 2 XLiFE++ is an extended library of finite elements written in C++ 3 Copyright (C) 2014 Lunéville, Eric; Kielbasiewicz, Nicolas; Lafranche, Yvon; Nguyen, Manh-Ha; Chambeyron, Colin 4 5 This program is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation, either version 3 of the License, or 8 (at your option) any later version. 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 You should have received a copy of the GNU General Public License 14 along with this program. If not, see <http://www.gnu.org/licenses/>. 15 */ 16 17 /*! 18 \file UmfPackWrappers.hpp 19 \authors Manh Ha NGUYEN 20 \since 29 August 2013 21 \date 04 September 2013 22 23 \brief Wrapper of some important functions of UMFPACK in order to solver (non)-symmetric problem 24 */ 25 26 #ifndef XLIFEPP_UMFPACK_WRAPPERS_HPP 27 #define XLIFEPP_UMFPACK_WRAPPERS_HPP 28 29 #include "UmfPackTypeDefs.hpp" 30 31 #define UMFPACK_MANGLE(type,func) umfpack ## _ ## type ## _ ## func 32 33 // Primary functions of case int/double 34 #define DISYMBOLIC UMFPACK_MANGLE(di,symbolic) 35 #define DINUMERIC UMFPACK_MANGLE(di,numeric) 36 #define DISOLVE UMFPACK_MANGLE(di,solve) 37 #define DIFREESYMBOLIC UMFPACK_MANGLE(di,free_symbolic) 38 #define DIFREENUMERIC UMFPACK_MANGLE(di,free_numeric) 39 #define DIGETLUNZ UMFPACK_MANGLE(di,get_lunz) 40 #define DIGETNUMERIC UMFPACK_MANGLE(di,get_numeric) 41 #define DIGETDET UMFPACK_MANGLE(di,get_determinant) 42 43 // Primary functions of case int/complex 44 #define ZISYMBOLIC UMFPACK_MANGLE(zi,symbolic) 45 #define ZINUMERIC UMFPACK_MANGLE(zi,numeric) 46 #define ZISOLVE UMFPACK_MANGLE(zi,solve) 47 #define ZIFREESYMBOLIC UMFPACK_MANGLE(zi,free_symbolic) 48 #define ZIFREENUMERIC UMFPACK_MANGLE(zi,free_numeric) 49 #define ZIGETLUNZ UMFPACK_MANGLE(zi,get_lunz) 50 #define ZIGETNUMERIC UMFPACK_MANGLE(zi,get_numeric) 51 #define ZIGETDET UMFPACK_MANGLE(zi,get_determinant) 52 53 // Primary functions of case suitesparse long/double 54 #define DLSYMBOLIC UMFPACK_MANGLE(dl,symbolic) 55 #define DLNUMERIC UMFPACK_MANGLE(dl,numeric) 56 #define DLSOLVE UMFPACK_MANGLE(dl,solve) 57 #define DLFREESYMBOLIC UMFPACK_MANGLE(dl,free_symbolic) 58 #define DLFREENUMERIC UMFPACK_MANGLE(dl,free_numeric) 59 #define DLGETLUNZ UMFPACK_MANGLE(dl,get_lunz) 60 #define DLGETNUMERIC UMFPACK_MANGLE(dl,get_numeric) 61 #define DLGETDET UMFPACK_MANGLE(dl,get_determinant) 62 63 // Primary functions of case suitesparse long/complex 64 #define ZLSYMBOLIC UMFPACK_MANGLE(zl,symbolic) 65 #define ZLNUMERIC UMFPACK_MANGLE(zl,numeric) 66 #define ZLSOLVE UMFPACK_MANGLE(zl,solve) 67 #define ZLFREESYMBOLIC UMFPACK_MANGLE(zl,free_symbolic) 68 #define ZLFREENUMERIC UMFPACK_MANGLE(zl,free_numeric) 69 #define ZLGETLUNZ UMFPACK_MANGLE(zl,get_lunz) 70 #define ZLGETNUMERIC UMFPACK_MANGLE(zl,get_numeric) 71 #define ZLGETDET UMFPACK_MANGLE(zl,get_determinant) 72 73 #ifdef __cplusplus 74 extern "C" { 75 #endif 76 77 int DISYMBOLIC(int n_row, int n_col, const int Ap[], const int Ai[], const double Ax[], void** Symbolic, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]); 78 int DINUMERIC(const int Ap[], const int Ai[], const double Ax[], void* Symbolic, void** Numeric, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]); 79 int DISOLVE(int sys, const int Ap[], const int Ai[], const double Ax[], double X[], const double B[], void* Numeric, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]); 80 void DIFREESYMBOLIC(void** Symbolic); 81 void DIFREENUMERIC(void** Numeric); 82 int DIGETLUNZ(int* lnz, int* unz, int* n_row, int* n_col, int* nz_udiag, void* Numeric); 83 int DIGETNUMERIC(int Lp[], int Lj[], double Lx[], int Up[], int Ui[], double Ux[], int P[], int Q[], double Dx[], int* do_recip, double Rs[], void* Numeric); 84 int DIGETDET(double* Mx, double* Ex, void* NumericHandle, double User_Info[UMFPACK_INFO]); 85 86 int ZISYMBOLIC(int n_row, int n_col, const int Ap[], const int Ai[], const double Ax[], const double Az[], void** Symbolic, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]); 87 int ZINUMERIC(const int Ap[], const int Ai[], const double Ax[], const double Az[], void* Symbolic, void** Numeric, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]); 88 int ZISOLVE(int sys, const int Ap[], const int Ai[], const double Ax[], const double Az[], double Xx[], double Xz[], const double Bx[], const double Bz[], void* Numeric, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]); 89 void ZIFREESYMBOLIC(void** Symbolic); 90 void ZIFREENUMERIC(void** Numeric); 91 int ZIGETLUNZ(int* lnz, int* unz, int* n_row, int* n_col, int* nz_udiag, void* Numeric); 92 int ZIGETNUMERIC(int Lp[], int Lj[], double Lx[], double Lz[], int Up[], int Ui[], double Ux[], double Uz[], int P[], int Q[], double Dx[], double Dz[], int* do_recip, double Rs[], void* Numeric); 93 int ZIGETDET(double* Mx, double* Mz, double* Ex, void* NumericHandle, double User_Info[UMFPACK_INFO]); 94 95 SuiteSparseLong DLSYMBOLIC(SuiteSparseLong n_row, SuiteSparseLong n_col, const SuiteSparseLong Ap[], const SuiteSparseLong Ai[], const double Ax[], void** Symbolic, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]); 96 SuiteSparseLong DLNUMERIC(const SuiteSparseLong Ap[], const SuiteSparseLong Ai[], const double Ax[], void* Symbolic, void** Numeric, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]); 97 SuiteSparseLong DLSOLVE(SuiteSparseLong sys, const SuiteSparseLong Ap[], const SuiteSparseLong Ai[], const double Ax[], double X[], const double B[], void* Numeric, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]); 98 void DLFREESYMBOLIC(void** Symbolic); 99 void DLFREENUMERIC(void** Numeric); 100 SuiteSparseLong DLGETLUNZ(SuiteSparseLong* lnz, SuiteSparseLong* unz, SuiteSparseLong* n_row, SuiteSparseLong* n_col, SuiteSparseLong* nz_udiag, void* Numeric); 101 SuiteSparseLong DLGETNUMERIC(SuiteSparseLong Lp[], SuiteSparseLong Lj[], double Lx[], SuiteSparseLong Up[], SuiteSparseLong Ui[], double Ux[], SuiteSparseLong P[], SuiteSparseLong Q[], double Dx[], SuiteSparseLong* do_recip, double Rs[], void* Numeric); 102 SuiteSparseLong DLGETDET(double* Mx, double* Ex, void* NumericHandle, double User_Info[UMFPACK_INFO]); 103 104 SuiteSparseLong ZLSYMBOLIC(SuiteSparseLong n_row, SuiteSparseLong n_col, const SuiteSparseLong Ap[], const SuiteSparseLong Ai[], const double Ax[], const double Az[], void** Symbolic, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]); 105 SuiteSparseLong ZLNUMERIC(const SuiteSparseLong Ap[], const SuiteSparseLong Ai[], const double Ax[], const double Az[], void* Symbolic, void** Numeric, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]); 106 SuiteSparseLong ZLSOLVE(SuiteSparseLong sys, const SuiteSparseLong Ap[], const SuiteSparseLong Ai[], const double Ax[], const double Az[], double Xx[], double Xz[], const double Bx[], const double Bz[], void* Numeric, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]); 107 void ZLFREESYMBOLIC(void** Symbolic); 108 void ZLFREENUMERIC(void** Numeric); 109 SuiteSparseLong ZLGETLUNZ(SuiteSparseLong* lnz, SuiteSparseLong* unz, SuiteSparseLong* n_row, SuiteSparseLong* n_col, SuiteSparseLong* nz_udiag, void* Numeric); 110 SuiteSparseLong ZLGETNUMERIC(SuiteSparseLong Lp[], SuiteSparseLong Lj[], double Lx[], double Lz[], SuiteSparseLong Up[], SuiteSparseLong Ui[], double Ux[], double Uz[], SuiteSparseLong P[], SuiteSparseLong Q[], double Dx[], double Dz[], SuiteSparseLong* do_recip, double Rs[], void* Numeric); 111 SuiteSparseLong ZLGETDET(double* Mx, double* Mz, double* Ex, void* NumericHandle, double User_Info[UMFPACK_INFO]); 112 #ifdef __cplusplus 113 } 114 #endif 115 116 #endif /* XLIFEPP_UMFPACK_WRAPPERS_HPP */ 117