21#include <psb_c_base.h>
24#ifdef DEAL_II_WITH_PSBLAS
29namespace PSCToolkitWrappers
37 Assert(communicator != MPI_COMM_NULL,
38 ExcMessage(
"MPI_COMM_NULL passed to SparseMatrix::reinit()."));
40 psblas_descriptor.reset(psb_c_new_descriptor(),
41 PSCToolkitWrappers::internal::DescriptorDeleter());
44 const std::vector<types::global_dof_index> &indexes =
47 psb_i_t number_of_local_indexes = indexes.size();
49 std::vector<psb_l_t> vl(number_of_local_indexes);
50 for (psb_i_t i = 0; i < number_of_local_indexes; ++i)
52 const auto psblas_index =
static_cast<psb_l_t
>(indexes[i]);
58 psb_c_cdall_vl(number_of_local_indexes,
60 *InitFinalize::get_psblas_context(),
61 psblas_descriptor.get());
68 const PSCToolkitWrappers::SparsityPattern::size_type j)
70 add_entries(i, &j, &j + 1);
75 template <
typename ForwardIterator>
78 const PSCToolkitWrappers::SparsityPattern::size_type row,
79 ForwardIterator
begin,
81 const bool indices_are_sorted)
83 Assert(psblas_descriptor.get() !=
nullptr,
88 (void)indices_are_sorted;
89 psb_i_t nz =
static_cast<int>(
end -
begin);
90 std::vector<psb_l_t> ia(nz);
91 std::vector<psb_l_t> ja(nz);
93 for (
int k = 0; k < nz; ++k)
98 int err = psb_c_cdins(nz, ia.data(), ja.data(), psblas_descriptor.get());
99 Assert(err == 0, ExcInsertionInPSBLASMatrix(err));
107 const bool indices_are_sorted)
109 add_entries(row, columns.
begin(), columns.
end(), indices_are_sorted);
117 Assert(psblas_descriptor.get() !=
nullptr,
120 if (!psb_c_cd_is_asb(psblas_descriptor.get()))
122 err = psb_c_cdasb(psblas_descriptor.get());
125 ExcCallingPSBLASFunction(
127 "Error while finalizing SparsityPattern through psb_c_cdasb."));
std::vector< size_type > get_index_vector() const
virtual void resize(const size_type rows, const size_type cols)
void add_entries(const size_type row, ForwardIterator begin, ForwardIterator end, const bool indices_are_sorted=false)
virtual void add_row_entries(const size_type &row, const ArrayView< const size_type > &columns, const bool indices_are_sorted=false) override
void add(const size_type i, const size_type j)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define AssertIntegerConversion(index1, index2)
#define Assert(cond, exc)
static ::ExceptionBase & ExcMessage(std::string arg1)