xref: /petsc/src/mat/utils/gcreate.c (revision 9e25ed09632ec91e2227f4e6f1ce3bfe794e20d8)
1 #ifndef lint
2 static char vcid[] = "$Id: $";
3 #endif
4 
5 #include "sys.h"
6 #include "options.h"
7 #include "sysio.h"
8 #include "mat.h"
9 
10 /*@C
11       MatCreateInitialMatrix - Reads from command line to determine
12            what type of matrix to create. Also uses MPI matrices if
13            number processors in MPI_COMM_WORLD greater then one.
14 
15   Input Parameters:
16 .   m,n - matrix dimensions
17 
18   Output Parameter:
19 .   V - location to stash resulting matrix.
20 @*/
21 int MatCreateInitialMatrix(int m,int n,Mat *V)
22 {
23   int numtid;
24   MPI_Comm_size(MPI_COMM_WORLD,&numtid);
25   if (OptionsHasName(0,0,"-dense_mat")) {
26     return MatCreateSequentialDense(m,n,V);
27   }
28   if (OptionsHasName(0,0,"-mpi_mats") || numtid >1) {
29     return MatCreateMPIAIJ(MPI_COMM_WORLD,-1,-1,m,n,5,0,0,0,V);
30   }
31   return MatCreateSequentialAIJ(m,n,10,0,V);
32 }
33 
34