20 nrows_ = PETSC_DECIDE;
21 ncols_ = PETSC_DECIDE;
36 nrows_ = PETSC_DECIDE;
37 ncols_ = PETSC_DECIDE;
53 MatConvert(A.
A_, MATSAME, MAT_INITIAL_MATRIX, &
A_);
68 MatCopy(A.
A_,
A_, DIFFERENT_NONZERO_PATTERN);
73 MatConvert(A.
A_, MATSAME, MAT_INITIAL_MATRIX, &
A_);
83 const PetscScalar one = 1.0;
84 const PetscInt nrows =
static_cast<PetscInt
>(row_pos.size());
90 MatSetOption(
A_, MAT_NO_OFF_PROC_ZERO_ROWS, PETSC_TRUE);
93 MatSetOption(
A_, MAT_KEEP_NONZERO_PATTERN, PETSC_TRUE);
97 MatZeroRows(
A_, nrows, &row_pos[0], one, PETSC_NULLPTR, PETSC_NULLPTR);
101 MatZeroRows(
A_, 0, PETSC_NULLPTR, one, PETSC_NULLPTR, PETSC_NULLPTR);
106 const PetscViewerFormat vw_format)
109 PetscViewerASCIIOpen(PETSC_COMM_WORLD, file_name.c_str(), &
viewer);
110 PetscViewerPushFormat(
viewer, vw_format);
114 PetscObjectSetName((PetscObject)
A_,
"Stiffness_matrix");
129 MatCreate(PETSC_COMM_WORLD, &
A_);
132 MatSetType(
A_, MATAIJ);
133 MatSetFromOptions(
A_);
135 MatSeqAIJSetPreallocation(
A_, d_nz, PETSC_NULLPTR);
136 MatMPIAIJSetPreallocation(
A_, d_nz, PETSC_NULLPTR, o_nz, PETSC_NULLPTR);
PetscInt n_loc_cols_
Number of the local columns.
PETScMatrix & operator=(PETScMatrix const &A)
void create(const PetscInt d_nz, const PetscInt o_nz)
Create the matrix, configure memory allocation and set the related member data.
PetscInt end_rank_
Ending index in a rank.
void finalizeAssembly(const MatAssemblyType asm_type=MAT_FINAL_ASSEMBLY)
Perform MPI collection of assembled entries in buffer.
PetscInt n_loc_rows_
Number of the local rows.
PetscInt nrows_
Number of the global rows.
void setRowsColumnsZero(std::vector< PetscInt > const &row_pos)
Set the specified rows to zero except diagonal entries, i.e. , where This function must be called...
PetscInt ncols_
Number of the global columns.
void viewer(const std::string &file_name, const PetscViewerFormat vw_format=PETSC_VIEWER_ASCII_MATLAB)
PetscInt start_rank_
Starting index in a rank.
bool finalizeMatrixAssembly(MAT_T &)
This a struct data containing the configuration information to create a PETSc type matrix.
PetscInt o_nz
Number of nonzeros per row in the off-diagonal portion of local submatrix (same value is used for all...
bool is_global_size
Flag for the type of size, which is one of arguments of the constructor of class PETScMatrix true: th...
PetscInt d_nz
Number of nonzeros per row in the diagonal portion of local submatrix (same value is used for all loc...