xref: /petsc/src/mat/utils/gcreate.c (revision cb51245867d6a442a15a98eb5f86fd750dfb6de4)
1*cb512458SBarry Smith #ifndef lint
2*cb512458SBarry Smith static char vcid[] = "$Id: $";
3*cb512458SBarry Smith #endif
47807a1faSBarry Smith 
57807a1faSBarry Smith #include "sys.h"
67807a1faSBarry Smith #include "options.h"
77807a1faSBarry Smith #include "sysio.h"
87807a1faSBarry Smith #include "mat.h"
97807a1faSBarry Smith 
107807a1faSBarry Smith /*@C
117807a1faSBarry Smith       MatCreateInitialMatrix - Reads from command line to determine
12d6dfbf8fSBarry Smith            what type of matrix to create. Also uses MPI matrices if
13d6dfbf8fSBarry Smith            number processors in MPI_COMM_WORLD greater then one.
147807a1faSBarry Smith 
157807a1faSBarry Smith   Input Parameters:
167807a1faSBarry Smith .   m,n - matrix dimensions
177807a1faSBarry Smith 
187807a1faSBarry Smith   Output Parameter:
197807a1faSBarry Smith .   V - location to stash resulting matrix.
207807a1faSBarry Smith @*/
217807a1faSBarry Smith int MatCreateInitialMatrix(int m,int n,Mat *V)
227807a1faSBarry Smith {
23d6dfbf8fSBarry Smith   int numtid;
24d6dfbf8fSBarry Smith   MPI_Comm_size(MPI_COMM_WORLD,&numtid);
25d6dfbf8fSBarry Smith   if (OptionsHasName(0,0,"-dense_mat")) {
267807a1faSBarry Smith     return MatCreateSequentialDense(m,n,V);
277807a1faSBarry Smith   }
28d6dfbf8fSBarry Smith   if (OptionsHasName(0,0,"-mpi_mats") || numtid >1) {
29d6dfbf8fSBarry Smith     return MatCreateMPIAIJ(MPI_COMM_WORLD,-1,-1,m,n,5,0,0,0,V);
30d6dfbf8fSBarry Smith   }
3111d228e4SBarry Smith   return MatCreateSequentialAIJ(m,n,10,0,V);
327807a1faSBarry Smith }
337807a1faSBarry Smith 
34