OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
c_example.c File Reference
#include <stdio.h>
#include <string.h>
#include "mpi.h"
#include "dmumps_c.h"

Go to the source code of this file.

Macros

#define JOB_INIT   -1
#define JOB_END   -2
#define USE_COMM_WORLD   -987654
#define ICNTL(I)

Functions

int main (int argc, char **argv)

Macro Definition Documentation

◆ ICNTL

#define ICNTL ( I)
Value:
icntl[(I)-1] /* macro s.t. indices match documentation */

◆ JOB_END

#define JOB_END   -2

Definition at line 17 of file c_example.c.

◆ JOB_INIT

#define JOB_INIT   -1

Definition at line 16 of file c_example.c.

◆ USE_COMM_WORLD

#define USE_COMM_WORLD   -987654

Definition at line 18 of file c_example.c.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 39 of file c_example.c.

40{
41#endif
43 MUMPS_INT n = 2;
44 MUMPS_INT8 nnz = 2;
45 MUMPS_INT irn[] = {1,2};
46 MUMPS_INT jcn[] = {1,2};
47 double a[2];
48 double rhs[2];
49
50/* When compiling with -DINTSIZE64, MUMPS_INT is 64-bit but MPI
51 ilp64 versions may still require standard int for C interface. */
52/* MUMPS_INT myid, ierr; */
53 int myid, ierr;
54
55 int error = 0;
56#if defined(MAIN_COMP)
57 argv = &name;
58#endif
59 ierr = MPI_Init(&argc, &argv);
61 /* Define A and rhs */
62 rhs[0]=1.0;rhs[1]=4.0;
63 a[0]=1.0;a[1]=2.0;
64
65 /* Initialize a MUMPS instance. Use MPI_COMM_WORLD */
66 id.comm_fortran=USE_COMM_WORLD;
67 id.par=1; id.sym=0;
68 id.job=JOB_INIT;
69 dmumps_c(&id);
70
71 /* Define the problem on the host */
72 if (myid == 0) {
73 id.n = n; id.nnz =nnz; id.irn=irn; id.jcn=jcn;
74 id.a = a; id.rhs = rhs;
75 }
76#define ICNTL(I) icntl[(I)-1] /* macro s.t. indices match documentation */
77 /* No outputs */
78 id.ICNTL(1)=-1; id.ICNTL(2)=-1; id.ICNTL(3)=-1; id.ICNTL(4)=0;
79
80 /* Call the MUMPS package (analyse, factorization and solve). */
81 id.job=6;
82 dmumps_c(&id);
83 if (id.infog[0]<0) {
84 printf(" (PROC %d) ERROR RETURN: \tINFOG(1)= %d\n\t\t\t\tINFOG(2)= %d\n",
85 myid, id.infog[0], id.infog[1]);
86 error = 1;
87 }
88
89 /* Terminate instance. */
90 id.job=JOB_END;
91 dmumps_c(&id);
92 if (myid == 0) {
93 if (!error) {
94 printf("Solution is : (%8.2f %8.2f)\n", rhs[0],rhs[1]);
95 } else {
96 printf("An error has occured, please check error code returned by MUMPS.\n");
97 }
98 }
100 return 0;
101}
#define JOB_END
Definition c_example.c:17
#define JOB_INIT
Definition c_example.c:16
#define USE_COMM_WORLD
Definition c_example.c:18
void MUMPS_CALL dmumps_c(DMUMPS_STRUC_C *dmumps_par)
LIBSEQ_INT LIBSEQ_CALL MPI_Comm_rank(LIBSEQ_INT comm, LIBSEQ_INT *rank)
Definition mpic.c:23
LIBSEQ_INT LIBSEQ_CALL MPI_Finalize(void)
Definition mpic.c:28
static MPI_Comm MPI_COMM_WORLD
Definition mpi.h:51
LIBSEQ_INT LIBSEQ_CALL MPI_Init(LIBSEQ_INT *pargc, char ***pargv)
Definition mpic.c:18
initmumps id
#define MUMPS_INT8
#define MUMPS_INT
integer, save, private myid
Definition cmumps_load.F:57
n