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