1cb512458SBarry Smith #ifndef lint 2*5f05bc04SLois Curfman McInnes static char vcid[] = "$Id: gcreate.c,v 1.11 1995/04/15 03:28:26 bsmith Exp curfman $"; 3cb512458SBarry 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 13df998da4SLois Curfman McInnes number processors in MPI_COMM_WORLD is greater then one. 147807a1faSBarry Smith 157807a1faSBarry Smith Input Parameters: 16df998da4SLois Curfman McInnes . m,n - global matrix dimensions 176b5873e3SBarry Smith . comm - MPI communicator 187807a1faSBarry Smith 197807a1faSBarry Smith Output Parameter: 20df998da4SLois Curfman McInnes . V - location to stash resulting matrix 217807a1faSBarry Smith @*/ 226b5873e3SBarry Smith int MatCreateInitialMatrix(MPI_Comm comm,int m,int n,Mat *V) 237807a1faSBarry Smith { 24d6dfbf8fSBarry Smith int numtid; 256b5873e3SBarry Smith MPI_Comm_size(comm,&numtid); 26d6dfbf8fSBarry Smith if (OptionsHasName(0,0,"-dense_mat")) { 276b5873e3SBarry Smith return MatCreateSequentialDense(comm,m,n,V); 287807a1faSBarry Smith } 29df998da4SLois Curfman McInnes if (OptionsHasName(0,0,"-row_mat")) { 306b5873e3SBarry Smith return MatCreateSequentialRow(comm,m,n,10,0,V); 31df998da4SLois Curfman McInnes } 32a5a9c739SBarry Smith if (numtid > 1 || OptionsHasName(0,0,"-mpi_objects")) { 33df998da4SLois Curfman McInnes if (OptionsHasName(0,0,"-row_mat")) { 346b5873e3SBarry Smith return MatCreateMPIRow(comm,PETSC_DECIDE,PETSC_DECIDE, m,n,5,0,0,0,V); 35df998da4SLois Curfman McInnes } 36*5f05bc04SLois Curfman McInnes #if defined(HAVE_BLOCKSOLVE) && !defined(PETSC_COMPLEX) 377c636fe7SLois Curfman McInnes if (OptionsHasName(0,0,"-rowbs_mat")) { 386b5873e3SBarry Smith return MatCreateMPIRowbs(comm,PETSC_DECIDE,m,5,0,0,V); 397c636fe7SLois Curfman McInnes } 40*5f05bc04SLois Curfman McInnes #endif 416b5873e3SBarry Smith return MatCreateMPIAIJ(comm,PETSC_DECIDE,PETSC_DECIDE, m,n,5,0,0,0,V); 42d6dfbf8fSBarry Smith } 436b5873e3SBarry Smith return MatCreateSequentialAIJ(comm,m,n,10,0,V); 447807a1faSBarry Smith } 457807a1faSBarry Smith 46