16 return std::make_unique<PETScMatrix>();
22 return std::make_unique<PETScMatrix>(A);
28 auto const nrows = spec.nrows;
29 auto const ncols = spec.ncols;
31 if (spec.sparsity_pattern)
34 assert(spec.sparsity_pattern->size() == 1);
36 auto const max_nonzeroes = spec.sparsity_pattern->front();
39 mat_opt.
d_nz = max_nonzeroes;
40 mat_opt.o_nz = max_nonzeroes;
41 mat_opt.is_global_size =
false;
42 return std::make_unique<PETScMatrix>(nrows, ncols, mat_opt);
45 return std::make_unique<PETScMatrix>(nrows, ncols);
50 return std::make_unique<PETScVector>();
56 return std::make_unique<PETScVector>(x);
62 auto const is_global_size =
false;
64 if (spec.ghost_indices !=
nullptr)
66 return std::make_unique<PETScVector>(spec.nrows, *spec.ghost_indices,
71 return std::make_unique<PETScVector>(spec.nrows, is_global_size);
78 auto const is_global_size =
false;
80 return std::make_unique<PETScVector>(length, is_global_size);
90 return std::make_unique<EigenMatrix>(0, 0);
96 return std::make_unique<EigenMatrix>(A);
102 auto A = std::make_unique<EigenMatrix>(spec.nrows);
104 if (spec.sparsity_pattern)
114 return std::make_unique<EigenVector>();
120 return std::make_unique<EigenVector>(x);
126 return std::make_unique<EigenVector>(spec.nrows);
130 Eigen::SparseMatrix<double>::Index
const length)
132 return std::make_unique<EigenVector>(length);
Global vector based on Eigen vector.
Wrapper class for PETSc matrix routines for matrix.
Wrapper class for PETSc vector.
void setMatrixSparsity(MATRIX &matrix, SPARSITY_PATTERN const &sparsity_pattern)
This a struct data containing the configuration information to create a PETSc type matrix.
PetscInt d_nz
Number of nonzeros per row in the diagonal portion of local submatrix (same value is used for all loc...