xref: /petsc/src/mat/utils/gcreate.c (revision 5e42470ac62cb63ed26e96b335b06ee82e25fc39)
1 #ifndef lint
2 static char vcid[] = "$Id: gcreate.c,v 1.7 1995/03/21 23:19:28 bsmith Exp curfman $";
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 is greater then one.
14 
15   Input Parameters:
16 .   m,n - global 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,"-row_mat")) {
29     return MatCreateSequentialRow(m,n,10,0,V);
30   }
31   if (numtid > 1 || OptionsHasName(0,0,"-mpi_objects")) {
32     if (OptionsHasName(0,0,"-row_mat")) {
33       return MatCreateMPIRow(MPI_COMM_WORLD,-1,-1,m,n,5,0,0,0,V);
34     }
35     return MatCreateMPIAIJ(MPI_COMM_WORLD,-1,-1,m,n,5,0,0,0,V);
36   }
37   return MatCreateSequentialAIJ(m,n,10,0,V);
38 }
39 
40