xref: /petsc/src/mat/utils/gcreate.c (revision ff756334e2018b5f0451f164c7597e7e4cdc144c)
1 #ifndef lint
2 static char vcid[] = "$Id: gcreate.c,v 1.11 1995/04/15 03:28:26 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 .   comm - MPI communicator
18 
19   Output Parameter:
20 .   V - location to stash resulting matrix
21 @*/
22 int MatCreateInitialMatrix(MPI_Comm comm,int m,int n,Mat *V)
23 {
24   int numtid;
25   MPI_Comm_size(comm,&numtid);
26   if (OptionsHasName(0,0,"-dense_mat")) {
27     return MatCreateSequentialDense(comm,m,n,V);
28   }
29   if (OptionsHasName(0,0,"-row_mat")) {
30     return MatCreateSequentialRow(comm,m,n,10,0,V);
31   }
32   if (numtid > 1 || OptionsHasName(0,0,"-mpi_objects")) {
33     if (OptionsHasName(0,0,"-row_mat")) {
34       return MatCreateMPIRow(comm,PETSC_DECIDE,PETSC_DECIDE, m,n,5,0,0,0,V);
35     }
36 #if defined(HAVE_BLOCKSOLVE) && !defined(PETSC_COMPLEX)
37     if (OptionsHasName(0,0,"-rowbs_mat")) {
38       return MatCreateMPIRowbs(comm,PETSC_DECIDE,m,5,0,0,V);
39     }
40 #endif
41     return MatCreateMPIAIJ(comm,PETSC_DECIDE,PETSC_DECIDE, m,n,5,0,0,0,V);
42   }
43   return MatCreateSequentialAIJ(comm,m,n,10,0,V);
44 }
45 
46