28 MatCreate(PETSC_COMM_WORLD,&A);
29 MatSetType(A,MATMPIAIJ);
30 MatSetSizes(A,local_size, local_size,
31 global_size, global_size);
33 MatMPIAIJSetPreallocation(A,1,
nullptr,
35 MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE);
36 MatSetOption(A, MAT_IGNORE_ZERO_ENTRIES, PETSC_TRUE);
61 MatCreate(PETSC_COMM_WORLD,&A);
62 MatSetType(A,MATMPIAIJ);
63 MatSetSizes(A,local_size, local_size,
64 global_size, global_size);
66 MatMPIAIJSetPreallocation(A,1,
nullptr,
68 MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE);
69 MatSetOption(A, MAT_IGNORE_ZERO_ENTRIES, PETSC_TRUE);
86 const std::vector<int64_t>& nodal_nnz_in_diag,
87 const std::vector<int64_t>& nodal_nnz_off_diag)
89 MatMPIAIJSetPreallocation(A,0,nodal_nnz_in_diag.data(),
90 0,nodal_nnz_off_diag.data());
91 MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE);
92 MatSetOption(A, MAT_IGNORE_ZERO_ENTRIES, PETSC_TRUE);
110 int64_t nodal_nnz_in_diag,
111 int64_t nodal_nnz_off_diag)
113 MatMPIAIJSetPreallocation(A,nodal_nnz_in_diag,
nullptr,
114 nodal_nnz_off_diag,
nullptr);
115 MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE);
116 MatSetOption(A, MAT_IGNORE_ZERO_ENTRIES, PETSC_TRUE);
void InitMatrixSparsity(Mat &A, const std::vector< int64_t > &nodal_nnz_in_diag, const std::vector< int64_t > &nodal_nnz_off_diag)
Mat CreateSquareMatrix(int64_t local_size, int64_t global_size)