deal.II version 9.8.0
\(\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\}}\)
Loading...
Searching...
No Matches
trilinos_solver.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2008 - 2026 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_trilinos_solver_h
14#define dealii_trilinos_solver_h
15
16
17#include <deal.II/base/config.h>
18
19#ifndef DEAL_II_TRILINOS_WITH_EPETRA
22#endif
23
24#ifdef DEAL_II_TRILINOS_WITH_EPETRA
26
30# include <deal.II/lac/vector.h>
31
33
34// for AztecOO solvers
35# include <Amesos.h>
36# include <AztecOO.h>
37# include <Epetra_LinearProblem.h>
38# include <Epetra_Operator.h>
39
40// for Belos solvers
41# ifdef DEAL_II_TRILINOS_WITH_BELOS
42# include <BelosBlockCGSolMgr.hpp>
43# include <BelosBlockGmresSolMgr.hpp>
44# include <BelosEpetraAdapter.hpp>
45# include <BelosIteration.hpp>
46# include <BelosMultiVec.hpp>
47# include <BelosOperator.hpp>
48# include <BelosSolverManager.hpp>
49# endif
50
52
53
54# include <memory>
55
56#endif // DEAL_II_WITH_TRILINOS
57
59
60#ifdef DEAL_II_TRILINOS_WITH_EPETRA
61namespace TrilinosWrappers
62{
63
64
84 {
85 public:
116
120
122 {
131 explicit AdditionalData(const bool output_solver_details = false,
132 const unsigned int gmres_restart_parameter = 30);
133
139
143 const unsigned int gmres_restart_parameter;
144 };
145
150 const AdditionalData &data = AdditionalData());
151
157 SolverControl &cn,
158 const AdditionalData &data = AdditionalData());
159
163 virtual ~SolverBase() = default;
164
170 void
171 solve(const SparseMatrix &A,
172 MPI::Vector &x,
173 const MPI::Vector &b,
174 const PreconditionBase &preconditioner);
175
183 void
184 solve(const Epetra_Operator &A,
185 MPI::Vector &x,
186 const MPI::Vector &b,
187 const PreconditionBase &preconditioner);
188
198 void
199 solve(const Epetra_Operator &A,
200 MPI::Vector &x,
201 const MPI::Vector &b,
202 const Epetra_Operator &preconditioner);
203
213 void
214 solve(const Epetra_Operator &A,
215 Epetra_MultiVector &x,
216 const Epetra_MultiVector &b,
217 const PreconditionBase &preconditioner);
218
229 void
230 solve(const Epetra_Operator &A,
231 Epetra_MultiVector &x,
232 const Epetra_MultiVector &b,
233 const Epetra_Operator &preconditioner);
234
235
236
247 void
248 solve(const SparseMatrix &A,
250 const ::Vector<double> &b,
251 const PreconditionBase &preconditioner);
252
264 void
267 const ::Vector<double> &b,
268 const PreconditionBase &preconditioner);
269
276 void
277 solve(const SparseMatrix &A,
279 const ::LinearAlgebra::distributed::Vector<double> &b,
280 const PreconditionBase &preconditioner);
281
289 void
292 const ::LinearAlgebra::distributed::Vector<double> &b,
293 const PreconditionBase &preconditioner);
294
295
300 control() const;
301
306 int,
307 << "An error with error number " << arg1
308 << " occurred while calling a Trilinos function");
309
310 protected:
318
319 private:
324 template <typename Preconditioner>
325 void
326 do_solve(const Preconditioner &preconditioner);
327
331 template <typename Preconditioner>
332 void
333 set_preconditioner(AztecOO &solver, const Preconditioner &preconditioner);
334
340 std::unique_ptr<Epetra_LinearProblem> linear_problem;
341
346 std::unique_ptr<AztecOO_StatusTest> status_test;
347
352 AztecOO solver;
353
358 };
359
360
361 // provide a declaration for two explicit specializations
362 template <>
363 void
365 const PreconditionBase &preconditioner);
366
367 template <>
368 void
370 const Epetra_Operator &preconditioner);
371
372
378 class SolverCG : public SolverBase
379 {
380 public:
389 };
390
391
392
398 class SolverCGS : public SolverBase
399 {
400 public:
409 };
410
411
412
417 class SolverGMRES : public SolverBase
418 {
419 public:
428 const AdditionalData &data = AdditionalData());
429 };
430
431
432
440 {
441 public:
450 const AdditionalData &data = AdditionalData());
451 };
452
453
454
461 class SolverTFQMR : public SolverBase
462 {
463 public:
472 const AdditionalData &data = AdditionalData());
473 };
474
475
476
490 {
491 public:
495
497 {
501 explicit AdditionalData(const bool output_solver_details = false,
502 const std::string &solver_type = "Amesos_Klu");
503
509
528 std::string solver_type;
529 };
530
534 explicit SolverDirect(const AdditionalData &data = AdditionalData());
535
540 const AdditionalData &data = AdditionalData());
541
545 virtual ~SolverDirect() = default;
546
553 void
554 initialize(const SparseMatrix &A);
555
563 void
564 initialize(const SparseMatrix &A, const AdditionalData &data);
565
571 void
572 solve(MPI::Vector &x, const MPI::Vector &b);
573
579 void
581 const ::LinearAlgebra::distributed::Vector<double> &b);
582
588 void
589 vmult(MPI::Vector &x, const MPI::Vector &b) const;
590
596 void
598 const ::LinearAlgebra::distributed::Vector<double> &b) const;
599
606 void
607 solve(const SparseMatrix &A, MPI::Vector &x, const MPI::Vector &b);
608
616 void
617 solve(const SparseMatrix &A,
619 const ::Vector<double> &b);
620
627 void
628 solve(const SparseMatrix &A,
630 const ::LinearAlgebra::distributed::Vector<double> &b);
631
638 void
639 solve(const Epetra_Operator &A,
640 Epetra_MultiVector &x,
641 const Epetra_MultiVector &b);
642
649 void
650 solve(const SparseMatrix &sparse_matrix,
651 FullMatrix<double> &solution,
652 const FullMatrix<double> &rhs);
653
658 control() const;
659
664 int,
665 << "An error with error number " << arg1
666 << " occurred while calling a Trilinos function");
667
668 private:
673 void
674 do_solve();
675
680
688
694 std::unique_ptr<Epetra_LinearProblem> linear_problem;
695
700 std::unique_ptr<Amesos_BaseSolver> solver;
701
706 };
707
708
709
710# ifdef DEAL_II_TRILINOS_WITH_BELOS
717 template <typename VectorType>
720 {
721 public:
727 {
736 } solver_name;
737
764
770 const Teuchos::RCP<Teuchos::ParameterList> &belos_parameters);
771
775 template <typename OperatorType, typename PreconditionerType>
776 void
777 solve(const OperatorType &a,
778 VectorType &x,
779 const VectorType &b,
780 const PreconditionerType &p);
781
782 private:
785 const Teuchos::RCP<Teuchos::ParameterList> &belos_parameters;
786 };
787# endif
788
789} // namespace TrilinosWrappers
790
791
792
793# ifndef DOXYGEN
794
795# ifdef DEAL_II_TRILINOS_WITH_BELOS
796namespace TrilinosWrappers
797{
798 namespace internal
799 {
806 template <typename VectorType>
808 class MultiVecWrapper
809 : public Belos::MultiVec<typename VectorType::value_type>
810 {
811 public:
815 using value_type = typename VectorType::value_type;
816
820 static bool
821 this_type_is_missing_a_specialization()
822 {
823 return false;
824 }
825
829 MultiVecWrapper(VectorType &vector)
830 {
831 this->vectors.resize(1);
832 this->vectors[0].reset(
833 &vector,
834 [](auto *) { /*Nothing to do, since vector is owned outside.*/ });
835 }
836
840 MultiVecWrapper(const VectorType &vector)
841 {
842 this->vectors.resize(1);
843 this->vectors[0].reset(
844 &const_cast<VectorType &>(vector),
845 [](auto *) { /*Nothing to do, since vector is owned outside.*/ });
846 }
847
851 virtual ~MultiVecWrapper() = default;
852
856 virtual Belos::MultiVec<value_type> *
857 Clone(const int numvecs) const
858 {
859 auto new_multi_vec = new MultiVecWrapper<VectorType>;
860
861 new_multi_vec->vectors.resize(numvecs);
862
863 for (auto &vec : new_multi_vec->vectors)
864 {
865 vec = std::make_shared<VectorType>();
866
867 AssertThrow(this->vectors.size() > 0, ExcInternalError());
868 vec->reinit(*this->vectors[0]);
869 }
870
871 return new_multi_vec;
872 }
873
877 virtual Belos::MultiVec<value_type> *
878 CloneCopy() const
879 {
881 }
882
888 virtual Belos::MultiVec<value_type> *
889 CloneCopy(const std::vector<int> &index) const
890 {
891 auto new_multi_vec = new MultiVecWrapper<VectorType>;
892
893 new_multi_vec->vectors.resize(index.size());
894
895 for (unsigned int i = 0; i < index.size(); ++i)
896 {
897 AssertThrow(static_cast<unsigned int>(index[i]) <
898 this->vectors.size(),
900
901 new_multi_vec->vectors[i] = std::make_shared<VectorType>();
902
903 AssertIndexRange(index[i], this->vectors.size());
904 *new_multi_vec->vectors[i] = *this->vectors[index[i]];
905 }
906
907 return new_multi_vec;
908 }
909
915 virtual Belos::MultiVec<value_type> *
916 CloneViewNonConst(const std::vector<int> &index)
917 {
918 auto new_multi_vec = new MultiVecWrapper<VectorType>;
919
920 new_multi_vec->vectors.resize(index.size());
921
922 for (unsigned int i = 0; i < index.size(); ++i)
923 {
924 AssertThrow(static_cast<unsigned int>(index[i]) <
925 this->vectors.size(),
927
928 new_multi_vec->vectors[i].reset(
929 this->vectors[index[i]].get(),
930 [](
931 auto
932 *) { /*Nothing to do, since we are creating only a view.*/ });
933 }
934
935 return new_multi_vec;
936 }
937
943 virtual const Belos::MultiVec<value_type> *
944 CloneView(const std::vector<int> &index) const
945 {
946 auto new_multi_vec = new MultiVecWrapper<VectorType>;
947
948 new_multi_vec->vectors.resize(index.size());
949
950 for (unsigned int i = 0; i < index.size(); ++i)
951 {
952 AssertThrow(static_cast<unsigned int>(index[i]) <
953 this->vectors.size(),
955
956 new_multi_vec->vectors[i].reset(
957 this->vectors[index[i]].get(),
958 [](
959 auto
960 *) { /*Nothing to do, since we are creating only a view.*/ });
961 }
962
963 return new_multi_vec;
964 }
965
969 virtual std::ptrdiff_t
970 GetGlobalLength() const
971 {
972 AssertThrow(this->vectors.size() > 0, ExcInternalError());
973
974 for (unsigned int i = 1; i < this->vectors.size(); ++i)
975 AssertDimension(this->vectors[0]->size(), this->vectors[i]->size());
976
977 return this->vectors[0]->size();
978 }
979
983 virtual int
984 GetNumberVecs() const
985 {
986 return vectors.size();
987 }
988
992 virtual void
993 MvTimesMatAddMv(const value_type alpha,
994 const Belos::MultiVec<value_type> &A_,
995 const Teuchos::SerialDenseMatrix<int, value_type> &B,
996 const value_type beta)
997 {
998 const auto &A = try_to_get_underlying_vector(A_);
999
1000 const unsigned int n_rows = B.numRows();
1001 const unsigned int n_cols = B.numCols();
1002
1003 AssertThrow(n_rows == static_cast<unsigned int>(A.GetNumberVecs()),
1005 AssertThrow(n_cols == static_cast<unsigned int>(this->GetNumberVecs()),
1007
1008 for (unsigned int i = 0; i < n_cols; ++i)
1009 (*this->vectors[i]) *= beta;
1010
1011 for (unsigned int i = 0; i < n_cols; ++i)
1012 for (unsigned int j = 0; j < n_rows; ++j)
1013 this->vectors[i]->add(alpha * B(j, i), *A.vectors[j]);
1014 }
1015
1019 virtual void
1020 MvAddMv(const value_type alpha,
1021 const Belos::MultiVec<value_type> &A_,
1022 const value_type beta,
1023 const Belos::MultiVec<value_type> &B_)
1024 {
1025 const auto &A = try_to_get_underlying_vector(A_);
1026 const auto &B = try_to_get_underlying_vector(B_);
1027
1028 AssertThrow(this->vectors.size() == A.vectors.size(),
1030 AssertThrow(this->vectors.size() == B.vectors.size(),
1032
1033 for (unsigned int i = 0; i < this->vectors.size(); ++i)
1034 {
1035 this->vectors[i]->equ(alpha, *A.vectors[i]);
1036 this->vectors[i]->add(beta, *B.vectors[i]);
1037 }
1038 }
1039
1043 virtual void
1044 MvScale(const value_type alpha)
1045 {
1046 for (unsigned int i = 0; i < this->vectors.size(); ++i)
1047 (*this->vectors[i]) *= alpha;
1048 }
1049
1053 virtual void
1054 MvScale(const std::vector<value_type> & /*alpha*/)
1055 {
1057 }
1058
1063 virtual void
1064 MvTransMv(const value_type alpha,
1065 const Belos::MultiVec<value_type> &A_,
1066 Teuchos::SerialDenseMatrix<int, value_type> &B) const
1067 {
1068 const auto &A = try_to_get_underlying_vector(A_);
1069
1070 const unsigned int n_rows = B.numRows();
1071 const unsigned int n_cols = B.numCols();
1072
1073 AssertThrow(n_rows == static_cast<unsigned int>(A.GetNumberVecs()),
1075 AssertThrow(n_cols == static_cast<unsigned int>(this->GetNumberVecs()),
1077
1078 for (unsigned int i = 0; i < n_rows; ++i)
1079 for (unsigned int j = 0; j < n_cols; ++j)
1080 B(i, j) = alpha * ((*A.vectors[i]) * (*this->vectors[j]));
1081 }
1082
1087 virtual void
1088 MvDot(const Belos::MultiVec<value_type> &A_,
1089 std::vector<value_type> &b) const
1090 {
1091 const auto &A = try_to_get_underlying_vector(A_);
1092
1093 AssertThrow(this->vectors.size() == A.vectors.size(),
1095 AssertThrow(this->vectors.size() == b.size(), ExcInternalError());
1096
1097 for (unsigned int i = 0; i < this->vectors.size(); ++i)
1098 b[i] = (*this->vectors[i]) * (*A.vectors[i]);
1099 }
1100
1104 virtual void
1105 MvNorm(
1106 std::vector<typename Teuchos::ScalarTraits<value_type>::magnitudeType>
1107 &normvec,
1108 Belos::NormType type = Belos::TwoNorm) const
1109 {
1110 AssertThrow(type == Belos::TwoNorm, ExcNotImplemented());
1111 AssertThrow(this->vectors.size() == normvec.size(), ExcInternalError());
1112
1113 for (unsigned int i = 0; i < this->vectors.size(); ++i)
1114 normvec[i] = this->vectors[i]->l2_norm();
1115 }
1116
1120 virtual void
1121 SetBlock(const Belos::MultiVec<value_type> & /*A*/,
1122 const std::vector<int> & /*index*/)
1123 {
1125 }
1126
1130 virtual void
1131 MvRandom()
1132 {
1134 }
1135
1139 virtual void
1140 MvInit(const value_type /*alpha*/)
1141 {
1143 }
1144
1148 virtual void
1149 MvPrint(std::ostream & /*os*/) const
1150 {
1152 }
1153
1157 VectorType &
1158 genericVector()
1159 {
1160 AssertThrow(GetNumberVecs() == 1, ExcNotImplemented());
1161
1162 return *vectors[0];
1163 }
1164
1168 const VectorType &
1169 genericVector() const
1170 {
1171 AssertThrow(GetNumberVecs() == 1, ExcNotImplemented());
1172
1173 return *vectors[0];
1174 }
1175
1179 static MultiVecWrapper<VectorType> &
1180 try_to_get_underlying_vector(Belos::MultiVec<value_type> &vec_in)
1181 {
1182 auto vec = dynamic_cast<MultiVecWrapper<VectorType> *>(&vec_in);
1183
1185
1186 return *vec;
1187 }
1188
1192 const static MultiVecWrapper<VectorType> &
1193 try_to_get_underlying_vector(const Belos::MultiVec<value_type> &vec_in)
1194 {
1195 auto vec = dynamic_cast<const MultiVecWrapper<VectorType> *>(&vec_in);
1196
1198
1199 return *vec;
1200 }
1201
1202
1203# ifdef HAVE_BELOS_TSQR
1204 virtual void
1205 factorExplicit(Belos::MultiVec<value_type> &,
1206 Teuchos::SerialDenseMatrix<int, value_type> &,
1207 const bool = false)
1208 {
1210 }
1211
1212 virtual int
1213 revealRank(
1214 Teuchos::SerialDenseMatrix<int, value_type> &,
1215 const typename Teuchos::ScalarTraits<value_type>::magnitudeType &)
1216 {
1218 }
1219
1220# endif
1221
1222 private:
1226 std::vector<std::shared_ptr<VectorType>> vectors;
1227
1232 MultiVecWrapper() = default;
1233 };
1234
1241 template <typename OperatorType, typename VectorType>
1242 DEAL_II_CXX20_REQUIRES(concepts::is_vector_space_vector<VectorType>)
1243 class OperatorWrapper
1244 : public Belos::Operator<typename VectorType::value_type>
1245 {
1246 public:
1250 using value_type = typename VectorType::value_type;
1251
1255 static bool
1256 this_type_is_missing_a_specialization()
1257 {
1258 return false;
1259 }
1260
1264 OperatorWrapper(const OperatorType &op)
1265 : op(op)
1266 {}
1267
1271 virtual ~OperatorWrapper() = default;
1272
1276 virtual void
1277 Apply(const Belos::MultiVec<value_type> &x,
1278 Belos::MultiVec<value_type> &y,
1279 Belos::ETrans trans = Belos::NOTRANS) const
1280 {
1281 // TODO: check for Tvmult
1282 AssertThrow(trans == Belos::NOTRANS, ExcNotImplemented());
1283
1284 op.vmult(MultiVecWrapper<VectorType>::try_to_get_underlying_vector(y)
1285 .genericVector(),
1286 MultiVecWrapper<VectorType>::try_to_get_underlying_vector(x)
1287 .genericVector());
1288 }
1289
1293 virtual bool
1294 HasApplyTranspose() const
1295 {
1296 // TODO: check for Tvmult
1297 return false;
1298 }
1299
1300 private:
1304 const OperatorType &op;
1305 };
1306
1307 } // namespace internal
1308
1309
1310
1311 template <typename VectorType>
1312 DEAL_II_CXX20_REQUIRES(concepts::is_vector_space_vector<VectorType>)
1314 SolverControl &solver_control,
1315 const AdditionalData &additional_data,
1316 const Teuchos::RCP<Teuchos::ParameterList> &belos_parameters)
1317 : solver_control(solver_control)
1318 , additional_data(additional_data)
1319 , belos_parameters(belos_parameters)
1320 {}
1321
1322
1323
1324 template <typename VectorType>
1325 DEAL_II_CXX20_REQUIRES(concepts::is_vector_space_vector<VectorType>)
1326 template <typename OperatorType, typename PreconditionerType>
1327 void SolverBelos<VectorType>::solve(const OperatorType &A_dealii,
1328 VectorType &x_dealii,
1329 const VectorType &b_dealii,
1330 const PreconditionerType &P_dealii)
1331 {
1332 using value_type = typename VectorType::value_type;
1333
1334 using MV = Belos::MultiVec<value_type>;
1335 using OP = Belos::Operator<value_type>;
1336
1337 Teuchos::RCP<OP> A = Teuchos::rcp(
1338 new internal::OperatorWrapper<OperatorType, VectorType>(A_dealii));
1339 Teuchos::RCP<OP> P = Teuchos::rcp(
1340 new internal::OperatorWrapper<PreconditionerType, VectorType>(P_dealii));
1341 Teuchos::RCP<MV> X =
1342 Teuchos::rcp(new internal::MultiVecWrapper<VectorType>(x_dealii));
1343 Teuchos::RCP<MV> B =
1344 Teuchos::rcp(new internal::MultiVecWrapper<VectorType>(b_dealii));
1345
1346 Teuchos::RCP<Belos::LinearProblem<value_type, MV, OP>> problem =
1347 Teuchos::rcp(new Belos::LinearProblem<value_type, MV, OP>(A, X, B));
1348
1349 if (additional_data.right_preconditioning == false)
1350 problem->setLeftPrec(P);
1351 else
1352 problem->setRightPrec(P);
1353
1354 const bool problem_set = problem->setProblem();
1355 AssertThrow(problem_set, ExcInternalError());
1356
1357 // compute initial residal
1358 VectorType r;
1359 r.reinit(x_dealii, true);
1360 A_dealii.vmult(r, x_dealii);
1361 r.sadd(-1., 1., b_dealii);
1362 const auto norm_0 = r.l2_norm();
1363
1364 if (solver_control.check(0, norm_0) != SolverControl::iterate)
1365 return;
1366
1367 double relative_tolerance_to_be_achieved =
1368 solver_control.tolerance() / norm_0;
1369 const unsigned int max_steps = solver_control.max_steps();
1370
1371 if (const auto *reduction_control =
1372 dynamic_cast<ReductionControl *>(&solver_control))
1373 relative_tolerance_to_be_achieved =
1374 std::max(relative_tolerance_to_be_achieved,
1375 reduction_control->reduction());
1376
1377 Teuchos::RCP<Teuchos::ParameterList> belos_parameters_copy(
1378 Teuchos::rcp(new Teuchos::ParameterList(*belos_parameters)));
1379
1380 belos_parameters_copy->set("Convergence Tolerance",
1381 relative_tolerance_to_be_achieved);
1382 belos_parameters_copy->set("Maximum Iterations",
1383 static_cast<int>(max_steps));
1384
1385 Teuchos::RCP<Belos::SolverManager<value_type, MV, OP>> solver;
1386
1387 if (additional_data.solver_name == SolverName::cg)
1388 solver = Teuchos::rcp(
1389 new Belos::BlockCGSolMgr<value_type, MV, OP>(problem,
1390 belos_parameters_copy));
1391 else if (additional_data.solver_name == SolverName::gmres)
1392 solver = Teuchos::rcp(
1393 new Belos::BlockGmresSolMgr<value_type, MV, OP>(problem,
1394 belos_parameters_copy));
1395 else
1397
1398 const auto flag = solver->solve();
1399
1400 solver_control.check(solver->getNumIters(), solver->achievedTol() * norm_0);
1401
1402 AssertThrow(flag == Belos::ReturnType::Converged ||
1403 ((dynamic_cast<IterationNumberControl *>(&solver_control) !=
1404 nullptr) &&
1405 (solver_control.last_step() == max_steps)),
1406 SolverControl::NoConvergence(solver_control.last_step(),
1407 solver_control.last_value()));
1408 }
1409
1410} // namespace TrilinosWrappers
1411# endif
1412
1413# endif
1414
1415#endif // DEAL_II_WITH_TRILINOS
1416
1418
1419#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)
std::unique_ptr< Epetra_LinearProblem > linear_problem
SolverBase(SolverControl &cn, const AdditionalData &data=AdditionalData())
enum TrilinosWrappers::SolverBase::SolverName solver_name
SolverBelos(SolverControl &solver_control, const AdditionalData &additional_data, const Teuchos::RCP< Teuchos::ParameterList > &belos_parameters)
const AdditionalData additional_data
void solve(const OperatorType &a, VectorType &x, const VectorType &b, const PreconditionerType &p)
const Teuchos::RCP< Teuchos::ParameterList > & belos_parameters
SolverBicgstab(SolverControl &cn, const AdditionalData &data=AdditionalData())
SolverCGS(SolverControl &cn, const AdditionalData &data=AdditionalData())
SolverCG(SolverControl &cn, const AdditionalData &data=AdditionalData())
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
SolverDirect(const AdditionalData &data=AdditionalData())
SolverGMRES(SolverControl &cn, const AdditionalData &data=AdditionalData())
SolverTFQMR(SolverControl &cn, const AdditionalData &data=AdditionalData())
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
Definition config.h:628
#define DEAL_II_CXX20_REQUIRES(condition)
Definition config.h:246
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
#define DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
Definition config.h:672
#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)
constexpr char A
Tpetra::Vector< Number, LO, GO, NodeType< MemorySpace > > VectorType
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
AdditionalData(const bool output_solver_details=false, const unsigned int gmres_restart_parameter=30)
AdditionalData(const SolverName solver_name=SolverName::cg, const bool right_preconditioning=false)
AdditionalData(const bool output_solver_details=false, const std::string &solver_type="Amesos_Klu")