@@ -70,7 +70,7 @@ template <typename T>
7070std::unique_ptr<SuperLUDistStructs::SuperMatrix, SuperMatrixDeleter>
7171create_supermatrix (const auto & A, auto & rowptr, auto & cols)
7272{
73- spdlog::info (" Start set_operator " );
73+ spdlog::info (" Start create_supermatrix " );
7474
7575 auto map0 = A.index_map (0 );
7676 auto map1 = A.index_map (1 );
@@ -113,7 +113,7 @@ create_supermatrix(const auto& A, auto& rowptr, auto& cols)
113113 else
114114 static_assert (dependent_false_v<T>, " Invalid scalar type" );
115115
116- spdlog::info (" Finished set_operator " );
116+ spdlog::info (" Finished create_supermatrix " );
117117 return p;
118118}
119119} // namespace
@@ -122,10 +122,12 @@ create_supermatrix(const auto& A, auto& rowptr, auto& cols)
122122template <typename T>
123123SuperLUDistMatrix<T>::SuperLUDistMatrix(std::shared_ptr<const MatrixCSR<T>> A,
124124 bool verbose)
125- : _matA(A),
126- _cols (std::make_unique<SuperLUDistStructs::vec_int_t >(col_indices(*A))),
127- _rowptr(std::make_unique<SuperLUDistStructs::vec_int_t >(row_indices(*A))),
128- _supermatrix(create_supermatrix<T>(*A, *_rowptr, *_cols)),
125+ : _matA(std::move(A)),
126+ _cols (
127+ std::make_unique<SuperLUDistStructs::vec_int_t >(col_indices(*_matA))),
128+ _rowptr(
129+ std::make_unique<SuperLUDistStructs::vec_int_t >(row_indices(*_matA))),
130+ _supermatrix(create_supermatrix<T>(*_matA, *_rowptr, *_cols)),
129131 _verbose(verbose)
130132{
131133}
@@ -137,6 +139,19 @@ SuperLUDistStructs::SuperMatrix* SuperLUDistMatrix<T>::supermatrix() const
137139 return _supermatrix.get ();
138140}
139141
142+ // ----------------------------------------------------------------------------
143+ template <typename T>
144+ const MatrixCSR<T>& SuperLUDistMatrix<T>::matA() const
145+ {
146+ return *_matA;
147+ }
148+
149+ // ----------------------------------------------------------------------------
150+ template class la ::SuperLUDistMatrix<double >;
151+ template class la ::SuperLUDistMatrix<float >;
152+ template class la ::SuperLUDistMatrix<std::complex <double >>;
153+ // ----------------------------------------------------------------------------
154+
140155// ----------------------------------------------------------------------------
141156// Trick for declaring anonymous typedef structs from SuperLU_DIST
142157struct dolfinx ::la::SuperLUDistStructs::gridinfo_t : public ::gridinfo_t
@@ -153,11 +168,11 @@ void GridInfoDeleter::operator()(
153168
154169// ----------------------------------------------------------------------------
155170template <typename T>
156- SuperLUDistSolver<T>::SuperLUDistSolver(std::shared_ptr< const MatrixCSR<T>> A,
157- bool verbose)
158- : _superlu_matA(SuperLUDistMatrix<T>(A, verbose )),
171+ SuperLUDistSolver<T>::SuperLUDistSolver(
172+ std::shared_ptr< const SuperLUDistMatrix<T>> A, bool verbose)
173+ : _superlu_matA(std::move(A )),
159174 _gridinfo (
160- [comm = A-> comm ()]
175+ [comm = _superlu_matA-> matA (). comm()]
161176 {
162177 int nprow = dolfinx::MPI::size (comm);
163178 int npcol = 1 ;
@@ -174,8 +189,8 @@ SuperLUDistSolver<T>::SuperLUDistSolver(std::shared_ptr<const MatrixCSR<T>> A,
174189template <typename T>
175190int SuperLUDistSolver<T>::solve(const la::Vector<T>& b, la::Vector<T>& u) const
176191{
177- int_t m = _superlu_matA. supermatrix ()->nrow ;
178- int_t m_loc = ((NRformat_loc*)(_superlu_matA. supermatrix ()->Store ))->m_loc ;
192+ int_t m = _superlu_matA-> supermatrix ()->nrow ;
193+ int_t m_loc = ((NRformat_loc*)(_superlu_matA-> supermatrix ()->Store ))->m_loc ;
179194
180195 // RHS
181196 int_t ldb = m_loc;
@@ -207,7 +222,7 @@ int SuperLUDistSolver<T>::solve(const la::Vector<T>& b, la::Vector<T>& u) const
207222 dSOLVEstruct_t SOLVEstruct;
208223
209224 spdlog::info (" Call SuperLU_DIST pdgssvx()" );
210- pdgssvx (&options, _superlu_matA. supermatrix (), &ScalePermstruct,
225+ pdgssvx (&options, _superlu_matA-> supermatrix (), &ScalePermstruct,
211226 u.array ().data (), ldb, nrhs, _gridinfo.get (), &LUstruct,
212227 &SOLVEstruct, berr.data (), &stat, &info);
213228
@@ -226,7 +241,7 @@ int SuperLUDistSolver<T>::solve(const la::Vector<T>& b, la::Vector<T>& u) const
226241 sSOLVEstruct_t SOLVEstruct;
227242
228243 spdlog::info (" Call SuperLU_DIST psgssvx()" );
229- psgssvx (&options, _superlu_matA. supermatrix (), &ScalePermstruct,
244+ psgssvx (&options, _superlu_matA-> supermatrix (), &ScalePermstruct,
230245 u.array ().data (), ldb, nrhs, _gridinfo.get (), &LUstruct,
231246 &SOLVEstruct, berr.data (), &stat, &info);
232247
@@ -245,7 +260,7 @@ int SuperLUDistSolver<T>::solve(const la::Vector<T>& b, la::Vector<T>& u) const
245260 zSOLVEstruct_t SOLVEstruct;
246261
247262 spdlog::info (" Call SuperLU_DIST pzgssvx()" );
248- pzgssvx (&options, _superlu_matA. supermatrix (), &ScalePermstruct,
263+ pzgssvx (&options, _superlu_matA-> supermatrix (), &ScalePermstruct,
249264 reinterpret_cast <doublecomplex*>(u.array ().data ()), ldb, nrhs,
250265 _gridinfo.get (), &LUstruct, &SOLVEstruct, berr.data (), &stat,
251266 &info);
0 commit comments