xref: /petsc/src/mat/utils/gcreate.c (revision d6dfbf8f6aa26f18ad3ebf3c96fa582aa9714225)
17807a1faSBarry Smith 
27807a1faSBarry Smith #include "sys.h"
37807a1faSBarry Smith #include "options.h"
47807a1faSBarry Smith #include "sysio.h"
57807a1faSBarry Smith #include "mat.h"
67807a1faSBarry Smith 
77807a1faSBarry Smith /*@C
87807a1faSBarry Smith       MatCreateInitialMatrix - Reads from command line to determine
9*d6dfbf8fSBarry Smith            what type of matrix to create. Also uses MPI matrices if
10*d6dfbf8fSBarry Smith            number processors in MPI_COMM_WORLD greater then one.
117807a1faSBarry Smith 
127807a1faSBarry Smith   Input Parameters:
137807a1faSBarry Smith .   m,n - matrix dimensions
147807a1faSBarry Smith 
157807a1faSBarry Smith   Output Parameter:
167807a1faSBarry Smith .   V - location to stash resulting matrix.
177807a1faSBarry Smith @*/
187807a1faSBarry Smith int MatCreateInitialMatrix(int m,int n,Mat *V)
197807a1faSBarry Smith {
20*d6dfbf8fSBarry Smith   int numtid;
21*d6dfbf8fSBarry Smith   MPI_Comm_size(MPI_COMM_WORLD,&numtid);
22*d6dfbf8fSBarry Smith   if (OptionsHasName(0,0,"-dense_mat")) {
237807a1faSBarry Smith     return MatCreateSequentialDense(m,n,V);
247807a1faSBarry Smith   }
25*d6dfbf8fSBarry Smith   if (OptionsHasName(0,0,"-mpi_mats") || numtid >1) {
26*d6dfbf8fSBarry Smith     return MatCreateMPIAIJ(MPI_COMM_WORLD,-1,-1,m,n,5,0,0,0,V);
27*d6dfbf8fSBarry Smith   }
2811d228e4SBarry Smith   return MatCreateSequentialAIJ(m,n,10,0,V);
297807a1faSBarry Smith }
307807a1faSBarry Smith 
31