8 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
17 #include "../../../shared/shared.h"
18 #include "../../mpi/issmmpi.h"
27 double sparsity=0.001;
35 nnz=(int)((
double)M*(double)N*sparsity);
36 d_nz=(int)((
double)nnz/(double)M/2.0);
37 o_nz=(int)((
double)nnz/(double)M/2.0);
39 #if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ > 2
40 MatCreateAIJ(comm,m,n,M,N,d_nz,NULL,o_nz,NULL,&outmatrix);
42 MatCreateMPIAIJ(comm,m,n,M,N,d_nz,NULL,o_nz,NULL,&outmatrix);
63 nnz=(int)((
double)M*(double)N*sparsity);
64 d_nz=(int)((
double)nnz/(double)M/2.0);
65 o_nz=(int)((
double)nnz/(double)M/2.0);
67 #if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ > 2
69 MatCreateDense(comm,m,n,M,N,NULL,&outmatrix);
72 MatCreateAIJ(comm,m,n,M,N,d_nz,NULL,o_nz,NULL,&outmatrix);
75 MatCreateMPIAIJ(comm,m,n,M,N,d_nz,NULL,o_nz,NULL,&outmatrix);
91 #if _PETSC_MAJOR_ >= 3
92 #if defined(_HAVE_PETSCDEV_) || _PETSC_MINOR_ >=4
106 d_nz=(int)connectivity*numberofdofspernode/2;
107 o_nz=(int)connectivity*numberofdofspernode/2;
109 MatCreate(comm,&outmatrix);
110 MatSetSizes(outmatrix,m,n,M,N);
111 MatSetFromOptions(outmatrix);
114 MatGetType(outmatrix,&type);
116 if((strcmp(type,
"mpiaij")==0) || (strcmp(type,
"mpidense")==0)){
117 MatMPIAIJSetPreallocation(outmatrix,d_nz,NULL,o_nz,NULL);