1 #ifndef lint 2 static char vcid[] = "$Id: gcreate.c,v 1.13 1995/04/23 00:14:12 curfman 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 - Creates a matrix, reading from the command 12 line to determine the matrix type. Generates a parallel MPI matrix 13 if the communicator has more than one processor. 14 15 Input Parameters: 16 . m - number of global rows 17 . n - number of global columns 18 . comm - MPI communicator 19 20 Output Parameter: 21 . V - location to stash resulting matrix 22 23 Options Database Keywords: 24 $ -dense_mat : dense type, uses MatCreateSequentialDense() 25 $ -row_mat : row type, uses MatCreateSequentialRow() 26 $ and MatCreateMPIRow() 27 $ -rowbs_mat : rowbs type (for parallel symmetric matrices), 28 $ uses MatCreateMPIRowbs() 29 $ -bdiag_mat : block diagonal type, uses 30 $ MatCreateSequentialBDiag() and 31 $ MatCreateMPIBDiag() 32 $ 33 $ -mpi_objects : uses MPI matrices, even for uniprocessor case 34 35 Notes: 36 The default matrix type is AIJ, using MatCreateSequentialAIJ() and 37 MatCreateMPIAIJ(). 38 39 .keywords: matrix, create, initial 40 41 .seealso: MatCreateSequentialAIJ((), MatCreateMPIAIJ(), 42 MatCreateSequentialRow(), MatCreateMPIRow(), 43 MatCreateSequentialDense(), MatCreateSequentialBDiag(), 44 MatCreateMPIRowbs() 45 @*/ 46 int MatCreateInitialMatrix(MPI_Comm comm,int m,int n,Mat *V) 47 { 48 int numtid; 49 MPI_Comm_size(comm,&numtid); 50 if (OptionsHasName(0,0,"-dense_mat")) { 51 return MatCreateSequentialDense(comm,m,n,V); 52 } 53 if (numtid > 1 || OptionsHasName(0,0,"-mpi_objects")) { 54 if (OptionsHasName(0,0,"-row_mat")) { 55 return MatCreateMPIRow(comm,PETSC_DECIDE,PETSC_DECIDE, m,n,5,0,0,0,V); 56 } 57 #if defined(HAVE_BLOCKSOLVE) && !defined(PETSC_COMPLEX) 58 if (OptionsHasName(0,0,"-rowbs_mat")) { 59 return MatCreateMPIRowbs(comm,PETSC_DECIDE,m,5,0,0,V); 60 } 61 #endif 62 return MatCreateMPIAIJ(comm,PETSC_DECIDE,PETSC_DECIDE, m,n,5,0,0,0,V); 63 } 64 if (OptionsHasName(0,0,"-row_mat")) { 65 return MatCreateSequentialRow(comm,m,n,10,0,V); 66 } 67 return MatCreateSequentialAIJ(comm,m,n,10,0,V); 68 } 69 70