Loading [MathJax]/extensions/TeX/AMSsymbols.js
 deal.II version GIT relicensing-2848-g5241f990fb 2025-03-16 19:30:00+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
trilinos_solver.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2008 - 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_trilinos_solver_h
16#define dealii_trilinos_solver_h
17
18
19#include <deal.II/base/config.h>
20
21#ifdef DEAL_II_WITH_TRILINOS
22
24
28# include <deal.II/lac/vector.h>
29
30// for AztecOO solvers
31# include <Amesos.h>
32# include <AztecOO.h>
33# include <Epetra_LinearProblem.h>
34# include <Epetra_Operator.h>
35
36// for Belos solvers
37# ifdef DEAL_II_TRILINOS_WITH_BELOS
38# include <BelosBlockCGSolMgr.hpp>
39# include <BelosBlockGmresSolMgr.hpp>
40# include <BelosEpetraAdapter.hpp>
41# include <BelosIteration.hpp>
42# include <BelosMultiVec.hpp>
43# include <BelosOperator.hpp>
44# include <BelosSolverManager.hpp>
45# endif
46
47# include <memory>
48
49
51
52namespace TrilinosWrappers
53{
54 // forward declarations
55# ifndef DOXYGEN
56 class SparseMatrix;
57 class PreconditionBase;
58# endif
59
60
80 {
81 public:
112
118 {
127 explicit AdditionalData(const bool output_solver_details = false,
128 const unsigned int gmres_restart_parameter = 30);
129
135
139 const unsigned int gmres_restart_parameter;
140 };
141
147
153 SolverControl &cn,
155
159 virtual ~SolverBase() = default;
160
166 void
167 solve(const SparseMatrix &A,
168 MPI::Vector &x,
169 const MPI::Vector &b,
170 const PreconditionBase &preconditioner);
171
179 void
180 solve(const Epetra_Operator &A,
181 MPI::Vector &x,
182 const MPI::Vector &b,
183 const PreconditionBase &preconditioner);
184
194 void
195 solve(const Epetra_Operator &A,
196 MPI::Vector &x,
197 const MPI::Vector &b,
198 const Epetra_Operator &preconditioner);
199
209 void
210 solve(const Epetra_Operator &A,
211 Epetra_MultiVector &x,
212 const Epetra_MultiVector &b,
213 const PreconditionBase &preconditioner);
214
225 void
226 solve(const Epetra_Operator &A,
227 Epetra_MultiVector &x,
228 const Epetra_MultiVector &b,
229 const Epetra_Operator &preconditioner);
230
231
232
243 void
244 solve(const SparseMatrix &A,
246 const ::Vector<double> &b,
247 const PreconditionBase &preconditioner);
248
260 void
263 const ::Vector<double> &b,
264 const PreconditionBase &preconditioner);
265
272 void
275 const ::LinearAlgebra::distributed::Vector<double> &b,
276 const PreconditionBase &preconditioner);
277
285 void
288 const ::LinearAlgebra::distributed::Vector<double> &b,
289 const PreconditionBase &preconditioner);
290
291
296 control() const;
297
302 int,
303 << "An error with error number " << arg1
304 << " occurred while calling a Trilinos function");
305
306 protected:
314
315 private:
320 template <typename Preconditioner>
321 void
322 do_solve(const Preconditioner &preconditioner);
323
327 template <typename Preconditioner>
328 void
329 set_preconditioner(AztecOO &solver, const Preconditioner &preconditioner);
330
336 std::unique_ptr<Epetra_LinearProblem> linear_problem;
337
342 std::unique_ptr<AztecOO_StatusTest> status_test;
343
348 AztecOO solver;
349
354 };
355
356
357 // provide a declaration for two explicit specializations
358 template <>
359 void
361 const PreconditionBase &preconditioner);
362
363 template <>
364 void
366 const Epetra_Operator &preconditioner);
367
368
374 class SolverCG : public SolverBase
375 {
376 public:
385 };
386
387
388
394 class SolverCGS : public SolverBase
395 {
396 public:
405 };
406
407
408
413 class SolverGMRES : public SolverBase
414 {
415 public:
425 };
426
427
428
436 {
437 public:
447 };
448
449
450
457 class SolverTFQMR : public SolverBase
458 {
459 public:
469 };
470
471
472
486 {
487 public:
493 {
497 explicit AdditionalData(const bool output_solver_details = false,
498 const std::string &solver_type = "Amesos_Klu");
499
505
524 std::string solver_type;
525 };
526
530 explicit SolverDirect(const AdditionalData &data = AdditionalData());
531
537
541 virtual ~SolverDirect() = default;
542
549 void
550 initialize(const SparseMatrix &A);
551
559 void
560 initialize(const SparseMatrix &A, const AdditionalData &data);
561
567 void
568 solve(MPI::Vector &x, const MPI::Vector &b);
569
575 void
577 const ::LinearAlgebra::distributed::Vector<double> &b);
578
584 void
585 vmult(MPI::Vector &x, const MPI::Vector &b) const;
586
592 void
594 const ::LinearAlgebra::distributed::Vector<double> &b) const;
595
602 void
603 solve(const SparseMatrix &A, MPI::Vector &x, const MPI::Vector &b);
604
612 void
613 solve(const SparseMatrix &A,
615 const ::Vector<double> &b);
616
623 void
626 const ::LinearAlgebra::distributed::Vector<double> &b);
627
634 void
635 solve(const Epetra_Operator &A,
636 Epetra_MultiVector &x,
637 const Epetra_MultiVector &b);
638
645 void
646 solve(const SparseMatrix &sparse_matrix,
647 FullMatrix<double> &solution,
648 const FullMatrix<double> &rhs);
649
654 control() const;
655
660 int,
661 << "An error with error number " << arg1
662 << " occurred while calling a Trilinos function");
663
664 private:
669 void
670 do_solve();
671
676
684
690 std::unique_ptr<Epetra_LinearProblem> linear_problem;
691
696 std::unique_ptr<Amesos_BaseSolver> solver;
697
702 };
703
704
705
706# ifdef DEAL_II_TRILINOS_WITH_BELOS
713 template <typename VectorType>
715 class SolverBelos
716 {
717 public:
722 enum SolverName
723 {
727 cg,
731 gmres,
732 } solver_name;
733
739 struct AdditionalData
740 {
744 AdditionalData(const SolverName solver_name = SolverName::cg,
745 const bool right_preconditioning = false)
746 : solver_name(solver_name)
747 , right_preconditioning(right_preconditioning)
748 {}
749
753 SolverName solver_name;
754
758 bool right_preconditioning;
759 };
760
764 SolverBelos(SolverControl &solver_control,
765 const AdditionalData &additional_data,
766 const Teuchos::RCP<Teuchos::ParameterList> &belos_parameters);
767
771 template <typename OperatorType, typename PreconditionerType>
772 void
773 solve(const OperatorType &a,
774 VectorType &x,
775 const VectorType &b,
776 const PreconditionerType &p);
777
778 private:
779 SolverControl &solver_control;
780 const AdditionalData additional_data;
781 const Teuchos::RCP<Teuchos::ParameterList> &belos_parameters;
782 };
783# endif
784
785} // namespace TrilinosWrappers
786
787
788
789# ifndef DOXYGEN
790
791# ifdef DEAL_II_TRILINOS_WITH_BELOS
792namespace TrilinosWrappers
793{
794 namespace internal
795 {
802 template <typename VectorType>
804 class MultiVecWrapper
805 : public Belos::MultiVec<typename VectorType::value_type>
806 {
807 public:
811 using value_type = typename VectorType::value_type;
812
816 static bool
817 this_type_is_missing_a_specialization()
818 {
819 return false;
820 }
821
825 MultiVecWrapper(VectorType &vector)
826 {
827 this->vectors.resize(1);
828 this->vectors[0].reset(
829 &vector,
830 [](auto *) { /*Nothing to do, since vector is owned outside.*/ });
831 }
832
836 MultiVecWrapper(const VectorType &vector)
837 {
838 this->vectors.resize(1);
839 this->vectors[0].reset(
840 &const_cast<VectorType &>(vector),
841 [](auto *) { /*Nothing to do, since vector is owned outside.*/ });
842 }
843
847 virtual ~MultiVecWrapper() = default;
848
852 virtual Belos::MultiVec<value_type> *
853 Clone(const int numvecs) const
854 {
855 auto new_multi_vec = new MultiVecWrapper<VectorType>;
856
857 new_multi_vec->vectors.resize(numvecs);
858
859 for (auto &vec : new_multi_vec->vectors)
860 {
861 vec = std::make_shared<VectorType>();
862
863 AssertThrow(this->vectors.size() > 0, ExcInternalError());
864 vec->reinit(*this->vectors[0]);
865 }
866
867 return new_multi_vec;
868 }
869
873 virtual Belos::MultiVec<value_type> *
874 CloneCopy() const
875 {
877 }
878
884 virtual Belos::MultiVec<value_type> *
885 CloneCopy(const std::vector<int> &index) const
886 {
887 auto new_multi_vec = new MultiVecWrapper<VectorType>;
888
889 new_multi_vec->vectors.resize(index.size());
890
891 for (unsigned int i = 0; i < index.size(); ++i)
892 {
893 AssertThrow(static_cast<unsigned int>(index[i]) <
894 this->vectors.size(),
896
897 new_multi_vec->vectors[i] = std::make_shared<VectorType>();
898
899 AssertIndexRange(index[i], this->vectors.size());
900 *new_multi_vec->vectors[i] = *this->vectors[index[i]];
901 }
902
903 return new_multi_vec;
904 }
905
911 virtual Belos::MultiVec<value_type> *
912 CloneViewNonConst(const std::vector<int> &index)
913 {
914 auto new_multi_vec = new MultiVecWrapper<VectorType>;
915
916 new_multi_vec->vectors.resize(index.size());
917
918 for (unsigned int i = 0; i < index.size(); ++i)
919 {
920 AssertThrow(static_cast<unsigned int>(index[i]) <
921 this->vectors.size(),
923
924 new_multi_vec->vectors[i].reset(
925 this->vectors[index[i]].get(),
926 [](
927 auto
928 *) { /*Nothing to do, since we are creating only a view.*/ });
929 }
930
931 return new_multi_vec;
932 }
933
939 virtual const Belos::MultiVec<value_type> *
940 CloneView(const std::vector<int> &index) const
941 {
942 auto new_multi_vec = new MultiVecWrapper<VectorType>;
943
944 new_multi_vec->vectors.resize(index.size());
945
946 for (unsigned int i = 0; i < index.size(); ++i)
947 {
948 AssertThrow(static_cast<unsigned int>(index[i]) <
949 this->vectors.size(),
951
952 new_multi_vec->vectors[i].reset(
953 this->vectors[index[i]].get(),
954 [](
955 auto
956 *) { /*Nothing to do, since we are creating only a view.*/ });
957 }
958
959 return new_multi_vec;
960 }
961
965 virtual ptrdiff_t
966 GetGlobalLength() const
967 {
968 AssertThrow(this->vectors.size() > 0, ExcInternalError());
969
970 for (unsigned int i = 1; i < this->vectors.size(); ++i)
971 AssertDimension(this->vectors[0]->size(), this->vectors[i]->size());
972
973 return this->vectors[0]->size();
974 }
975
979 virtual int
980 GetNumberVecs() const
981 {
982 return vectors.size();
983 }
984
988 virtual void
989 MvTimesMatAddMv(const value_type alpha,
990 const Belos::MultiVec<value_type> &A_,
991 const Teuchos::SerialDenseMatrix<int, value_type> &B,
992 const value_type beta)
993 {
994 const auto &A = try_to_get_underlying_vector(A_);
995
996 const unsigned int n_rows = B.numRows();
997 const unsigned int n_cols = B.numCols();
998
999 AssertThrow(n_rows == static_cast<unsigned int>(A.GetNumberVecs()),
1001 AssertThrow(n_cols == static_cast<unsigned int>(this->GetNumberVecs()),
1003
1004 for (unsigned int i = 0; i < n_cols; ++i)
1005 (*this->vectors[i]) *= beta;
1006
1007 for (unsigned int i = 0; i < n_cols; ++i)
1008 for (unsigned int j = 0; j < n_rows; ++j)
1009 this->vectors[i]->add(alpha * B(j, i), *A.vectors[j]);
1010 }
1011
1015 virtual void
1016 MvAddMv(const value_type alpha,
1017 const Belos::MultiVec<value_type> &A_,
1018 const value_type beta,
1019 const Belos::MultiVec<value_type> &B_)
1020 {
1021 const auto &A = try_to_get_underlying_vector(A_);
1022 const auto &B = try_to_get_underlying_vector(B_);
1023
1024 AssertThrow(this->vectors.size() == A.vectors.size(),
1026 AssertThrow(this->vectors.size() == B.vectors.size(),
1028
1029 for (unsigned int i = 0; i < this->vectors.size(); ++i)
1030 {
1031 this->vectors[i]->equ(alpha, *A.vectors[i]);
1032 this->vectors[i]->add(beta, *B.vectors[i]);
1033 }
1034 }
1035
1039 virtual void
1040 MvScale(const value_type alpha)
1041 {
1042 for (unsigned int i = 0; i < this->vectors.size(); ++i)
1043 (*this->vectors[i]) *= alpha;
1044 }
1045
1049 virtual void
1050 MvScale(const std::vector<value_type> &alpha)
1051 {
1053 (void)alpha;
1054 }
1055
1060 virtual void
1061 MvTransMv(const value_type alpha,
1062 const Belos::MultiVec<value_type> &A_,
1063 Teuchos::SerialDenseMatrix<int, value_type> &B) const
1064 {
1065 const auto &A = try_to_get_underlying_vector(A_);
1066
1067 const unsigned int n_rows = B.numRows();
1068 const unsigned int n_cols = B.numCols();
1069
1070 AssertThrow(n_rows == static_cast<unsigned int>(A.GetNumberVecs()),
1072 AssertThrow(n_cols == static_cast<unsigned int>(this->GetNumberVecs()),
1074
1075 for (unsigned int i = 0; i < n_rows; ++i)
1076 for (unsigned int j = 0; j < n_cols; ++j)
1077 B(i, j) = alpha * ((*A.vectors[i]) * (*this->vectors[j]));
1078 }
1079
1084 virtual void
1085 MvDot(const Belos::MultiVec<value_type> &A_,
1086 std::vector<value_type> &b) const
1087 {
1088 const auto &A = try_to_get_underlying_vector(A_);
1089
1090 AssertThrow(this->vectors.size() == A.vectors.size(),
1092 AssertThrow(this->vectors.size() == b.size(), ExcInternalError());
1093
1094 for (unsigned int i = 0; i < this->vectors.size(); ++i)
1095 b[i] = (*this->vectors[i]) * (*A.vectors[i]);
1096 }
1097
1101 virtual void
1102 MvNorm(
1103 std::vector<typename Teuchos::ScalarTraits<value_type>::magnitudeType>
1104 &normvec,
1105 Belos::NormType type = Belos::TwoNorm) const
1106 {
1107 AssertThrow(type == Belos::TwoNorm, ExcNotImplemented());
1108 AssertThrow(this->vectors.size() == normvec.size(), ExcInternalError());
1109
1110 for (unsigned int i = 0; i < this->vectors.size(); ++i)
1111 normvec[i] = this->vectors[i]->l2_norm();
1112 }
1113
1117 virtual void
1118 SetBlock(const Belos::MultiVec<value_type> &A,
1119 const std::vector<int> &index)
1120 {
1122 (void)A;
1123 (void)index;
1124 }
1125
1129 virtual void
1130 MvRandom()
1131 {
1133 }
1134
1138 virtual void
1139 MvInit(const value_type alpha)
1140 {
1142 (void)alpha;
1143 }
1144
1148 virtual void
1149 MvPrint(std::ostream &os) const
1150 {
1152 (void)os;
1153 }
1154
1158 VectorType &
1159 genericVector()
1160 {
1161 AssertThrow(GetNumberVecs() == 1, ExcNotImplemented());
1162
1163 return *vectors[0];
1164 }
1165
1169 const VectorType &
1170 genericVector() const
1171 {
1172 AssertThrow(GetNumberVecs() == 1, ExcNotImplemented());
1173
1174 return *vectors[0];
1175 }
1176
1180 static MultiVecWrapper<VectorType> &
1181 try_to_get_underlying_vector(Belos::MultiVec<value_type> &vec_in)
1182 {
1183 auto vec = dynamic_cast<MultiVecWrapper<VectorType> *>(&vec_in);
1184
1186
1187 return *vec;
1188 }
1189
1193 const static MultiVecWrapper<VectorType> &
1194 try_to_get_underlying_vector(const Belos::MultiVec<value_type> &vec_in)
1195 {
1196 auto vec = dynamic_cast<const MultiVecWrapper<VectorType> *>(&vec_in);
1197
1199
1200 return *vec;
1201 }
1202
1203
1204# ifdef HAVE_BELOS_TSQR
1205 virtual void
1206 factorExplicit(Belos::MultiVec<value_type> &,
1207 Teuchos::SerialDenseMatrix<int, value_type> &,
1208 const bool = false)
1209 {
1211 }
1212
1213 virtual int
1214 revealRank(
1215 Teuchos::SerialDenseMatrix<int, value_type> &,
1216 const typename Teuchos::ScalarTraits<value_type>::magnitudeType &)
1217 {
1219 }
1220
1221# endif
1222
1223 private:
1227 std::vector<std::shared_ptr<VectorType>> vectors;
1228
1233 MultiVecWrapper() = default;
1234 };
1235
1242 template <typename OperatorType, typename VectorType>
1244 class OperatorWrapper
1245 : public Belos::Operator<typename VectorType::value_type>
1246 {
1247 public:
1251 using value_type = typename VectorType::value_type;
1252
1256 static bool
1257 this_type_is_missing_a_specialization()
1258 {
1259 return false;
1260 }
1261
1265 OperatorWrapper(const OperatorType &op)
1266 : op(op)
1267 {}
1268
1272 virtual ~OperatorWrapper() = default;
1273
1277 virtual void
1278 Apply(const Belos::MultiVec<value_type> &x,
1279 Belos::MultiVec<value_type> &y,
1280 Belos::ETrans trans = Belos::NOTRANS) const
1281 {
1282 // TODO: check for Tvmult
1283 AssertThrow(trans == Belos::NOTRANS, ExcNotImplemented());
1284
1285 op.vmult(MultiVecWrapper<VectorType>::try_to_get_underlying_vector(y)
1286 .genericVector(),
1287 MultiVecWrapper<VectorType>::try_to_get_underlying_vector(x)
1288 .genericVector());
1289 }
1290
1294 virtual bool
1295 HasApplyTranspose() const
1296 {
1297 // TODO: check for Tvmult
1298 return false;
1299 }
1300
1301 private:
1305 const OperatorType &op;
1306 };
1307
1308 } // namespace internal
1309
1310
1311
1312 template <typename VectorType>
1314 SolverBelos<VectorType>::SolverBelos(
1315 SolverControl &solver_control,
1316 const AdditionalData &additional_data,
1317 const Teuchos::RCP<Teuchos::ParameterList> &belos_parameters)
1318 : solver_control(solver_control)
1319 , additional_data(additional_data)
1320 , belos_parameters(belos_parameters)
1321 {}
1322
1323
1324
1325 template <typename VectorType>
1327 template <typename OperatorType, typename PreconditionerType>
1328 void SolverBelos<VectorType>::solve(const OperatorType &A_dealii,
1329 VectorType &x_dealii,
1330 const VectorType &b_dealii,
1331 const PreconditionerType &P_dealii)
1332 {
1333 using value_type = typename VectorType::value_type;
1334
1335 using MV = Belos::MultiVec<value_type>;
1336 using OP = Belos::Operator<value_type>;
1337
1338 Teuchos::RCP<OP> A = Teuchos::rcp(
1339 new internal::OperatorWrapper<OperatorType, VectorType>(A_dealii));
1340 Teuchos::RCP<OP> P = Teuchos::rcp(
1341 new internal::OperatorWrapper<PreconditionerType, VectorType>(P_dealii));
1342 Teuchos::RCP<MV> X =
1343 Teuchos::rcp(new internal::MultiVecWrapper<VectorType>(x_dealii));
1344 Teuchos::RCP<MV> B =
1345 Teuchos::rcp(new internal::MultiVecWrapper<VectorType>(b_dealii));
1346
1347 Teuchos::RCP<Belos::LinearProblem<value_type, MV, OP>> problem =
1348 Teuchos::rcp(new Belos::LinearProblem<value_type, MV, OP>(A, X, B));
1349
1350 if (additional_data.right_preconditioning == false)
1351 problem->setLeftPrec(P);
1352 else
1353 problem->setRightPrec(P);
1354
1355 const bool problem_set = problem->setProblem();
1356 AssertThrow(problem_set, ExcInternalError());
1357
1358 // compute initial residal
1359 VectorType r;
1360 r.reinit(x_dealii, true);
1361 A_dealii.vmult(r, x_dealii);
1362 r.sadd(-1., 1., b_dealii);
1363 const auto norm_0 = r.l2_norm();
1364
1365 if (solver_control.check(0, norm_0) != SolverControl::iterate)
1366 return;
1367
1368 double relative_tolerance_to_be_achieved =
1369 solver_control.tolerance() / norm_0;
1370 const unsigned int max_steps = solver_control.max_steps();
1371
1372 if (const auto *reduction_control =
1373 dynamic_cast<ReductionControl *>(&solver_control))
1374 relative_tolerance_to_be_achieved =
1375 std::max(relative_tolerance_to_be_achieved,
1376 reduction_control->reduction());
1377
1378 Teuchos::RCP<Teuchos::ParameterList> belos_parameters_copy(
1379 Teuchos::rcp(new Teuchos::ParameterList(*belos_parameters)));
1380
1381 belos_parameters_copy->set("Convergence Tolerance",
1382 relative_tolerance_to_be_achieved);
1383 belos_parameters_copy->set("Maximum Iterations",
1384 static_cast<int>(max_steps));
1385
1386 Teuchos::RCP<Belos::SolverManager<value_type, MV, OP>> solver;
1387
1388 if (additional_data.solver_name == SolverName::cg)
1389 solver = Teuchos::rcp(
1390 new Belos::BlockCGSolMgr<value_type, MV, OP>(problem,
1391 belos_parameters_copy));
1392 else if (additional_data.solver_name == SolverName::gmres)
1393 solver = Teuchos::rcp(
1394 new Belos::BlockGmresSolMgr<value_type, MV, OP>(problem,
1395 belos_parameters_copy));
1396 else
1398
1399 const auto flag = solver->solve();
1400
1401 solver_control.check(solver->getNumIters(), solver->achievedTol() * norm_0);
1402
1403 AssertThrow(flag == Belos::ReturnType::Converged ||
1404 ((dynamic_cast<IterationNumberControl *>(&solver_control) !=
1405 nullptr) &&
1406 (solver_control.last_step() == max_steps)),
1407 SolverControl::NoConvergence(solver_control.last_step(),
1408 solver_control.last_value()));
1409 }
1410
1411} // namespace TrilinosWrappers
1412# endif
1413
1414# endif
1415
1417
1418#endif // DEAL_II_WITH_TRILINOS
1419
1420#endif
@ iterate
Continue iteration.
virtual ~SolverBase()=default
SolverControl & control() const
void solve(const SparseMatrix &A, MPI::Vector &x, const MPI::Vector &b, const PreconditionBase &preconditioner)
const AdditionalData additional_data
std::unique_ptr< AztecOO_StatusTest > status_test
void set_preconditioner(AztecOO &solver, const Preconditioner &preconditioner)
void do_solve(const Preconditioner &preconditioner)
void solve(Epetra_Operator &A, ::LinearAlgebra::distributed::Vector< double > &x, const ::LinearAlgebra::distributed::Vector< double > &b, const PreconditionBase &preconditioner)
std::unique_ptr< Epetra_LinearProblem > linear_problem
enum TrilinosWrappers::SolverBase::SolverName solver_name
void solve(const SparseMatrix &A, ::LinearAlgebra::distributed::Vector< double > &x, const ::LinearAlgebra::distributed::Vector< double > &b, const PreconditionBase &preconditioner)
void solve(const SparseMatrix &A, ::LinearAlgebra::distributed::Vector< double > &x, const ::LinearAlgebra::distributed::Vector< double > &b)
virtual ~SolverDirect()=default
void initialize(const SparseMatrix &A)
void vmult(MPI::Vector &x, const MPI::Vector &b) const
std::unique_ptr< Amesos_BaseSolver > solver
void solve(MPI::Vector &x, const MPI::Vector &b)
std::unique_ptr< Epetra_LinearProblem > linear_problem
SolverControl & control() const
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:40
#define DEAL_II_CXX20_REQUIRES(condition)
Definition config.h:245
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:41
#define DEAL_II_NOT_IMPLEMENTED()
static ::ExceptionBase & ExcTrilinosError(int arg1)
static ::ExceptionBase & ExcTrilinosError(int arg1)
static ::ExceptionBase & ExcNotImplemented()
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
#define DeclException1(Exception1, type1, outsequence)
#define AssertThrow(cond, exc)
std::vector< index_type > data
Definition mpi.cc:746
std::size_t size
Definition mpi.cc:745
std::vector< value_type > l2_norm(const typename ::Triangulation< dim, spacedim >::cell_iterator &parent, const value_type parent_value)
constexpr char A
Tpetra::Vector< Number, LO, GO, NodeType< MemorySpace > > VectorType
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)