24 n_loc_rows_(PETSC_DECIDE),
25 n_loc_cols_(mat_opt.n_local_cols)
42 n_loc_rows_(PETSC_DECIDE),
43 n_loc_cols_(mat_opt.n_local_cols)
59 n_loc_rows_(A.n_loc_rows_),
60 n_loc_cols_(A.n_loc_cols_),
61 start_rank_(A.start_rank_),
62 end_rank_(A.end_rank_)
64 MatConvert(A.
A_, MATSAME, MAT_INITIAL_MATRIX, &
A_);
79 MatCopy(A.
A_,
A_, DIFFERENT_NONZERO_PATTERN);
84 MatConvert(A.
A_, MATSAME, MAT_INITIAL_MATRIX, &
A_);
94 const PetscScalar one = 1.0;
95 const PetscInt nrows =
static_cast<PetscInt
>(row_pos.size());
101 MatSetOption(
A_, MAT_NO_OFF_PROC_ZERO_ROWS, PETSC_TRUE);
104 MatSetOption(
A_, MAT_KEEP_NONZERO_PATTERN, PETSC_TRUE);
107 MatZeroRows(
A_, nrows, &row_pos[0], one, PETSC_NULL, PETSC_NULL);
109 MatZeroRows(
A_, 0, PETSC_NULL, one, PETSC_NULL, PETSC_NULL);
113 const PetscViewerFormat vw_format)
116 PetscViewerASCIIOpen(PETSC_COMM_WORLD, file_name.c_str(), &
viewer);
117 PetscViewerPushFormat(
viewer, vw_format);
121 PetscObjectSetName((PetscObject)
A_,
"Stiffness_matrix");
136 MatCreate(PETSC_COMM_WORLD, &
A_);
139 MatSetType(
A_, MATAIJ);
140 MatSetFromOptions(
A_);
142 MatSeqAIJSetPreallocation(
A_, d_nz, PETSC_NULL);
143 MatMPIAIJSetPreallocation(
A_, d_nz, PETSC_NULL, o_nz, PETSC_NULL);
Declaration of class PETScMatrix, which provides an interface to PETSc matrix routines.
Wrapper class for PETSc matrix routines for matrix.
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 by...
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...