Page MenuHomec4science

CheckFindMumps.c
No OneTemporary

File Metadata

Created
Sun, May 5, 11:28

CheckFindMumps.c

/**
* @file CheckFindMumps.c
*
* @brief
*
* @copyright
* Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* SPC (Swiss Plasma Center)
*
* SPClibs is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* SPClibs is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* @author
* (in alphabetical order)
* @author Nicolas Richart <nicolas.richart@epfl.ch>
*/
#include <stdio.h>
#if !defined(MUMPS_SEQ)
# include <mpi.h>
#endif
#define JOB_INIT -1
#define JOB_END -2
#define JOB_COMPLETE 6
#define USE_COMM_WORLD -987654
#define icntl(n) id.icntl[n - 1]
int main(int argc, char **argv) {
int n = 2;
int nz = 2;
int irn[2] = {1, 2};
int jcn[2] = {1, 2};
Real a[2];
Real rhs[2];
#if !defined(MUMPS_SEQ)
MPI_Init(&argc, &argv);
#endif
rhs[0] = 1.0; rhs[1]=4.0;
a[0] = 1.0; a[1] = 2.0;
id.job = JOB_INIT;
id.par = 1;
id.sym = 0;
#if !defined(MUMPS_SEQ)
id.comm_fortran = USE_COMM_WORLD;
#endif
mumps_c(&id);
// Default Scaling
icntl(8) = 77;
// Assembled matrix
icntl(5) = 0;
/// Default centralized dense second member
icntl(20) = 0;
icntl(21) = 0;
// automatic choice for analysis analysis
icntl(28) = 0;
// fully distributed
icntl(18) = 3;
id.n = n;
id.nz_loc = nz;
id.irn_loc = irn;
id.jcn_loc = jcn;
id.a_loc = a;
id.rhs = rhs;
icntl(1) = -1;
icntl(2) = -1;
icntl(3) = -1;
icntl(4) = 0;
id.job = JOB_COMPLETE;
mumps_c(&id);
id.job=JOB_END;
mumps_c(&id);
printf("Solution is : (%8.2f %8.2f)\n", rhs[0], rhs[1]);
return 0;
}

Event Timeline