| 1 |
/*! \file Dissection.hpp |
| 2 |
\brief Fortran style interface named as Dissectino-fortran interface |
| 3 |
\author Atsushi Suzuki, Laboratoire Jacques-Louis Lions |
| 4 |
\date Mar. 30th 2012 |
| 5 |
\date Jul. 12th 2015 |
| 6 |
\date Nov. 30th 2016 |
| 7 |
*/ |
| 8 |
|
| 9 |
// This file is part of Dissection |
| 10 |
// |
| 11 |
// Dissection is free software: you can redistribute it and/or modify |
| 12 |
// it under the terms of the GNU General Public License as published by |
| 13 |
// the Free Software Foundation, either version 3 of the License, or |
| 14 |
// (at your option) any later version. |
| 15 |
// |
| 16 |
// Linking Dissection statically or dynamically with other modules is making |
| 17 |
// a combined work based on Disssection. Thus, the terms and conditions of |
| 18 |
// the GNU General Public License cover the whole combination. |
| 19 |
// |
| 20 |
// As a special exception, the copyright holders of Dissection give you |
| 21 |
// permission to combine Dissection program with free software programs or |
| 22 |
// libraries that are released under the GNU LGPL and with independent modules |
| 23 |
// that communicate with Dissection solely through the Dissection-fortran |
| 24 |
// interface. You may copy and distribute such a system following the terms of |
| 25 |
// the GNU GPL for Dissection and the licenses of the other code concerned, |
| 26 |
// provided that you include the source code of that other code when and as |
| 27 |
// the GNU GPL requires distribution of source code and provided that you do |
| 28 |
// not modify the Dissection-fortran interface. |
| 29 |
// |
| 30 |
// Note that people who make modified versions of Dissection are not obligated |
| 31 |
// to grant this special exception for their modified versions; it is their |
| 32 |
// choice whether to do so. The GNU General Public License gives permission to |
| 33 |
// release a modified version without this exception; this exception also makes |
| 34 |
// it possible to release a modified version which carries forward this |
| 35 |
// exception. If you modify the Dissection-fortran interface, this exception |
| 36 |
// does not apply to your modified version of Dissection, and you must remove |
| 37 |
// this exception when you distribute your modified version. |
| 38 |
// |
| 39 |
// This exception is an additional permission under section 7 of the GNU |
| 40 |
// General Public License, version 3 ("GPLv3") |
| 41 |
// |
| 42 |
// Dissection is distributed in the hope that it will be useful, |
| 43 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 44 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 45 |
// GNU General Public License for more details. |
| 46 |
// |
| 47 |
// You should have received a copy of the GNU General Public License |
| 48 |
// along with Dissection. If not, see <http://www.gnu.org/licenses/>. |
| 49 |
// |
| 50 |
|
| 51 |
#ifndef _INTERFACE_CPPAPI_HPP |
| 52 |
# define _INTERFACE_CPPAPI_HPP |
| 53 |
|
| 54 |
#define _COMPILER_OPTIONCOMPILER_H |
| 55 |
#define FORTRAN_DECL_WL(x_windows,x_linux) x_linux |
| 56 |
#define FORTRAN_DECL(x) x##_ |
| 57 |
#define DISSECTION_API |
| 58 |
|
| 59 |
#ifdef BLAS_MKL |
| 60 |
#include <mkl_service.h> |
| 61 |
#endif |
| 62 |
#include <stdint.h> |
| 63 |
# include <cstdlib> |
| 64 |
|
| 65 |
#define DISSECTION_REAL_MATRIX 1 |
| 66 |
#define DISSECTION_COMPLEX_MATRIX 2 |
| 67 |
|
| 68 |
#define DISS_VERSION FORTRAN_DECL_WL(DISS_VERSION, diss_version) |
| 69 |
#define DISS_INIT FORTRAN_DECL_WL(DISS_INIT, diss_init) |
| 70 |
#define DISS_FREE FORTRAN_DECL_WL(DISS_FREE, diss_free) |
| 71 |
#define DISS_NUMERIC_FREE FORTRAN_DECL_WL(DISS_NUMERIC_FREE, diss_numeric_free) |
| 72 |
#define DISS_S_FACT FORTRAN_DECL_WL(DISS_S_FACT, diss_s_fact) |
| 73 |
#define DISS_N_FACT FORTRAN_DECL_WL(DISS_N_FACT, diss_n_fact) |
| 74 |
#define DISS_GET_COLORS FORTRAN_DECL_WL(DISS_GET_COLORS, diss_get_colors) |
| 75 |
#define DISS_GET_KERN_DIM FORTRAN_DECL_WL(DISS_GET_KERN_DIM, diss_get_kern_dim) |
| 76 |
#define DISS_GET_NULLPIVOTS FORTRAN_DECL_WL(DISS_GET_NULLPIVOTS, diss_get_nullpivots) |
| 77 |
#define DISS_GET_SMALLPIVOTS FORTRAN_DECL_WL(DISS_GET_SMALLPIVOTS, diss_get_smallpivots) |
| 78 |
#define DISS_GET_KERN_VECS FORTRAN_DECL_WL(DISS_GET_KERN_VECS, diss_get_kern_vecs) |
| 79 |
#define DISS_GET_KERNT_VECS FORTRAN_DECL_WL(DISS_GET_KERNT_VECS, diss_get_kernt_vecs) |
| 80 |
#define DISS_PROJECT FORTRAN_DECL_WL(DISS_PROJECT, diss_project) |
| 81 |
#define DISS_SOLVE_1 FORTRAN_DECL_WL(DISS_SOLVE_1, diss_solve_1) |
| 82 |
#define DISS_SOLVE_N FORTRAN_DECL_WL(DISS_SOLVE_N, diss_solve_n) |
| 83 |
#define DISS_MATRIX_PRODUCT FORTRAN_DECL_WL(DISS_MATRIX_PRODUCT, diss_matrix_product) |
| 84 |
#define COMPUTE_DIM_KERN FORTRAN_DECL_WL(COMPUTE_DIM_KERN, compute_dim_kern) |
| 85 |
|
| 86 |
extern "C" { |
| 87 |
DISSECTION_API void DISS_VERSION(int *versn, |
| 88 |
int *reles, |
| 89 |
int *patch); |
| 90 |
|
| 91 |
DISSECTION_API void DISS_INIT(uint64_t &dslv_, |
| 92 |
const int &called, |
| 93 |
const int &real_or_complex, |
| 94 |
const int &nthreads, |
| 95 |
const int &verbose); |
| 96 |
|
| 97 |
DISSECTION_API void DISS_FREE(uint64_t &dslv_); |
| 98 |
|
| 99 |
DISSECTION_API void DISS_NUMERIC_FREE(uint64_t &dslv_); |
| 100 |
|
| 101 |
DISSECTION_API void DISS_S_FACT(uint64_t &dslv_, |
| 102 |
const int &dim, |
| 103 |
const int *ptRows, |
| 104 |
const int *indCols, |
| 105 |
const int &sym, |
| 106 |
const int &decomposer); |
| 107 |
|
| 108 |
DISSECTION_API void DISS_N_FACT(uint64_t &dslv_, |
| 109 |
const double *coefs, |
| 110 |
const int &scaling, |
| 111 |
const double &eps_pivot, |
| 112 |
const int &indefinite_flag); |
| 113 |
|
| 114 |
DISSECTION_API void DISS_GET_COLORS(uint64_t &dslv_, int *n); |
| 115 |
DISSECTION_API void DISS_GET_KERN_DIM(uint64_t &dslv_, int *n0); |
| 116 |
|
| 117 |
DISSECTION_API void DISS_GET_NULLPIVOTS(uint64_t &dslv_, int *pivots); |
| 118 |
DISSECTION_API void DISS_GET_SMALLPIVOTS(uint64_t &dslv_, |
| 119 |
const int &n, |
| 120 |
int *pivots); |
| 121 |
|
| 122 |
DISSECTION_API void DISS_GET_KERN_VECS(uint64_t &dslv_, double *vec); |
| 123 |
DISSECTION_API void DISS_GET_KERNT_VECS(uint64_t &dslv_, double *vec); |
| 124 |
|
| 125 |
DISSECTION_API void DISS_PROJECT(uint64_t &dslv_, double *x); |
| 126 |
|
| 127 |
DISSECTION_API void DISS_SOLVE_1(uint64_t &dslv_, double *x, |
| 128 |
const int &projection, |
| 129 |
const int &trans); |
| 130 |
|
| 131 |
DISSECTION_API void DISS_SOLVE_N(uint64_t &dslv_, double *x, |
| 132 |
const int &nrhs, const int &projection, |
| 133 |
const int &trans); |
| 134 |
|
| 135 |
DISSECTION_API void DISS_MATRIX_PRODUCT(uint64_t &dslv_, |
| 136 |
const double* x, double* y); |
| 137 |
|
| 138 |
DISSECTION_API void COMPUTE_DIM_KERN(int* flag, |
| 139 |
int* n0, |
| 140 |
double *a_ini, |
| 141 |
const int &n, |
| 142 |
const int &dim_ag, |
| 143 |
const double &eps, |
| 144 |
const double &machine_eps0, |
| 145 |
const int &flag_sym, |
| 146 |
const int *print_cntrl); |
| 147 |
} |
| 148 |
#endif |