/* * * This file is part of MUMPS 4.8.0, built on Fri Jul 25 14:46:02 2008 * */ /* $Id: c_example.c 5043 2008-07-18 08:56:02Z pcombes $ */ /* Example program using the C interface to the * double real arithmetic version of MUMPS, dmumps_c. * We solve the system A x = RHS with * A = diag(1 2) and RHS = [1 4]^T * Solution is [1 2]^T */ /* * Domen Stadler, 18.12.2011 * * USAGE: mumps_solver matrixfile.mtx rhsfile.mtx solutionfile.mtx * * Source code was modified to read matrix (matrix market format) and * right hand side vector (matrix market format) and solve it. Currently * it enables only one RHS vector at a time and symmetric matrices. * Solution is written to the solution file. * * TODO: - parsing first lines from input files to determine if the matrix is not * symmetric and according to this, change the parameter id.sym * (read MUMPS userguide for more instructions) * - implementation for several right hand side vector * (currently I do not know how to do that exactly) * - implementation of other parameters for MUMPS * - test on other windows machines (I only tested it on win xp 32bit) */ #include #include "headers/mpi.h" #include "headers/dmumps_c.h" #define JOB_INIT -1 #define JOB_END -2 #define USE_COMM_WORLD -987654 #include #include #include #include #if defined(UNICODE) #define _tcout wcout #else #define _tcout cout #endif int main(int argc, char* argv[]) { char* matFile = argv[1]; char* rhsFile=argv[2]; char* lhsFile = argv[3]; int * iRn; int * jCn; double * mValues; int * iRHSn; int * jRHSn; double * rhsValues; bool matrixReaded=false; bool vectorReaded=false; int i,j, values ,nR,nC,nonZVmatrix, nLRHS ,n_RHS ,nz_RHS,rhs_old=0,rhs_temp=0 ; double value=0.0; std::string line; std::ifstream matrixfile; std::ifstream vectorfile; std::ofstream solutionfile; //reading matrix std::cout<<"Reading matrix file "<>nR>>nC>>nonZVmatrix; std::cout<<"Number of rows: "<>iRn[i]>>jCn[i]>>mValues[i]; } else { std::cout<<"End of matrix file before it was filled"<>nLRHS>>n_RHS>>nz_RHS; std::cout<<"Length of vector: "<>j>>rhs_temp>>value; rhsValues[j-1]=value; } else { std::cout<<"End of vector file before it was filled"<