deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20:01+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\}}\)
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
25#endif
26
27#ifdef DEAL_II_WITH_TRILINOS
29
33# include <deal.II/lac/vector.h>
34
36
37// for Epetra-based AztecOO and Amesos solvers
38# ifdef DEAL_II_TRILINOS_WITH_EPETRA
39# include <Amesos.h>
40# include <AztecOO.h>
41# include <Epetra_LinearProblem.h>
42# include <Epetra_Operator.h>
43# endif
44
45// for Belos solvers
46# ifdef DEAL_II_TRILINOS_WITH_BELOS
47# include <BelosBlockCGSolMgr.hpp>
48# include <BelosBlockGmresSolMgr.hpp>
49# ifdef DEAL_II_TRILINOS_WITH_EPETRA
50# include <BelosEpetraAdapter.hpp>
51# endif
52# include <BelosIteration.hpp>
53# include <BelosMultiVec.hpp>
54# include <BelosOperator.hpp>
55# include <BelosSolverManager.hpp>
56# endif
57
59
60
61# include <memory>
62
63#endif // DEAL_II_WITH_TRILINOS
64
66
67#ifdef DEAL_II_WITH_TRILINOS
68namespace TrilinosWrappers
69{
70# ifdef DEAL_II_TRILINOS_WITH_EPETRA
71
72
92 {
93 public:
124
130 {
139 explicit AdditionalData(const bool output_solver_details = false,
140 const unsigned int gmres_restart_parameter = 30);
141
147
151 const unsigned int gmres_restart_parameter;
152 };
153
159
165 SolverControl &cn,
167
171 virtual ~SolverBase() = default;
172
178 void
179 solve(const SparseMatrix &A,
180 MPI::Vector &x,
181 const MPI::Vector &b,
182 const PreconditionBase &preconditioner);
183
191 void
192 solve(const Epetra_Operator &A,
193 MPI::Vector &x,
194 const MPI::Vector &b,
195 const PreconditionBase &preconditioner);
196
206 void
207 solve(const Epetra_Operator &A,
208 MPI::Vector &x,
209 const MPI::Vector &b,
210 const Epetra_Operator &preconditioner);
211
221 void
222 solve(const Epetra_Operator &A,
223 Epetra_MultiVector &x,
224 const Epetra_MultiVector &b,
225 const PreconditionBase &preconditioner);
226
237 void
238 solve(const Epetra_Operator &A,
239 Epetra_MultiVector &x,
240 const Epetra_MultiVector &b,
241 const Epetra_Operator &preconditioner);
242
243
244
255 void
256 solve(const SparseMatrix &A,
258 const ::Vector<double> &b,
259 const PreconditionBase &preconditioner);
260
272 void
275 const ::Vector<double> &b,
276 const PreconditionBase &preconditioner);
277
284 void
287 const ::LinearAlgebra::distributed::Vector<double> &b,
288 const PreconditionBase &preconditioner);
289
297 void
300 const ::LinearAlgebra::distributed::Vector<double> &b,
301 const PreconditionBase &preconditioner);
302
303
308 control() const;
309
314 int,
315 << "An error with error number " << arg1
316 << " occurred while calling a Trilinos function");
317
318 protected:
326
327 private:
332 template <typename Preconditioner>
333 void
334 do_solve(const Preconditioner &preconditioner);
335
339 template <typename Preconditioner>
340 void
341 set_preconditioner(AztecOO &solver, const Preconditioner &preconditioner);
342
348 std::unique_ptr<Epetra_LinearProblem> linear_problem;
349
354 std::unique_ptr<AztecOO_StatusTest> status_test;
355
360 AztecOO solver;
361
366 };
367
368
369 // provide a declaration for two explicit specializations
370 template <>
371 void
373 const PreconditionBase &preconditioner);
374
375 template <>
376 void
378 const Epetra_Operator &preconditioner);
379
380
386 class SolverCG : public SolverBase
387 {
388 public:
397 };
398
399
400
406 class SolverCGS : public SolverBase
407 {
408 public:
417 };
418
419
420
425 class SolverGMRES : public SolverBase
426 {
427 public:
437 };
438
439
440
448 {
449 public:
459 };
460
461
462
469 class SolverTFQMR : public SolverBase
470 {
471 public:
481 };
482
483
484
498 {
499 public:
505 {
509 explicit AdditionalData(const bool output_solver_details = false,
510 const std::string &solver_type = "Amesos_Klu");
511
517
536 std::string solver_type;
537 };
538
542 explicit SolverDirect(const AdditionalData &data = AdditionalData());
543
549
553 virtual ~SolverDirect() = default;
554
561 void
562 initialize(const SparseMatrix &A);
563
571 void
572 initialize(const SparseMatrix &A, const AdditionalData &data);
573
579 void
580 solve(MPI::Vector &x, const MPI::Vector &b);
581
587 void
589 const ::LinearAlgebra::distributed::Vector<double> &b);
590
596 void
597 vmult(MPI::Vector &x, const MPI::Vector &b) const;
598
604 void
606 const ::LinearAlgebra::distributed::Vector<double> &b) const;
607
614 void
615 solve(const SparseMatrix &A, MPI::Vector &x, const MPI::Vector &b);
616
624 void
625 solve(const SparseMatrix &A,
627 const ::Vector<double> &b);
628
635 void
638 const ::LinearAlgebra::distributed::Vector<double> &b);
639
646 void
647 solve(const Epetra_Operator &A,
648 Epetra_MultiVector &x,
649 const Epetra_MultiVector &b);
650
657 void
658 solve(const SparseMatrix &sparse_matrix,
659 FullMatrix<double> &solution,
660 const FullMatrix<double> &rhs);
661
666 control() const;
667
672 int,
673 << "An error with error number " << arg1
674 << " occurred while calling a Trilinos function");
675
676 private:
681 void
682 do_solve();
683
688
696
702 std::unique_ptr<Epetra_LinearProblem> linear_problem;
703
708 std::unique_ptr<Amesos_BaseSolver> solver;
709
714 };
715# else
716
722 using SolverCG = ::SolverCG<
724
732
733
734
735# endif // DEAL_II_TRILINOS_WITH_EPETRA
736
737# ifdef DEAL_II_TRILINOS_WITH_BELOS
744 template <typename VectorType>
747 {
748 public:
754 {
763 } solver_name;
764
771 {
775 AdditionalData(const SolverName solver_name = SolverName::cg,
776 const bool right_preconditioning = false)
777 : solver_name(solver_name)
778 , right_preconditioning(right_preconditioning)
779 {}
780
785
790 };
791
795 SolverBelos(SolverControl &solver_control,
796 const AdditionalData &additional_data,
797 const Teuchos::RCP<Teuchos::ParameterList> &belos_parameters);
798
802 template <typename OperatorType, typename PreconditionerType>
803 void
804 solve(const OperatorType &a,
805 VectorType &x,
806 const VectorType &b,
807 const PreconditionerType &p);
808
809 private:
812 const Teuchos::RCP<Teuchos::ParameterList> &belos_parameters;
813 };
814# endif
815
816} // namespace TrilinosWrappers
817
818
819
820# ifndef DOXYGEN
821
822# ifdef DEAL_II_TRILINOS_WITH_BELOS
823namespace TrilinosWrappers
824{
825 namespace internal
826 {
833 template <typename VectorType>
835 class MultiVecWrapper
836 : public Belos::MultiVec<typename VectorType::value_type>
837 {
838 public:
842 using value_type = typename VectorType::value_type;
843
847 static bool
848 this_type_is_missing_a_specialization()
849 {
850 return false;
851 }
852
856 MultiVecWrapper(VectorType &vector)
857 {
858 this->vectors.resize(1);
859 this->vectors[0].reset(
860 &vector,
861 [](auto *) { /*Nothing to do, since vector is owned outside.*/ });
862 }
863
867 MultiVecWrapper(const VectorType &vector)
868 {
869 this->vectors.resize(1);
870 this->vectors[0].reset(
871 &const_cast<VectorType &>(vector),
872 [](auto *) { /*Nothing to do, since vector is owned outside.*/ });
873 }
874
878 virtual ~MultiVecWrapper() = default;
879
883 virtual Belos::MultiVec<value_type> *
884 Clone(const int numvecs) const
885 {
886 auto new_multi_vec = new MultiVecWrapper<VectorType>;
887
888 new_multi_vec->vectors.resize(numvecs);
889
890 for (auto &vec : new_multi_vec->vectors)
891 {
892 vec = std::make_shared<VectorType>();
893
894 AssertThrow(this->vectors.size() > 0, ExcInternalError());
895 vec->reinit(*this->vectors[0]);
896 }
897
898 return new_multi_vec;
899 }
900
904 virtual Belos::MultiVec<value_type> *
905 CloneCopy() const
906 {
908 }
909
915 virtual Belos::MultiVec<value_type> *
916 CloneCopy(const std::vector<int> &index) const
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] = std::make_shared<VectorType>();
929
930 AssertIndexRange(index[i], this->vectors.size());
931 *new_multi_vec->vectors[i] = *this->vectors[index[i]];
932 }
933
934 return new_multi_vec;
935 }
936
942 virtual Belos::MultiVec<value_type> *
943 CloneViewNonConst(const std::vector<int> &index)
944 {
945 auto new_multi_vec = new MultiVecWrapper<VectorType>;
946
947 new_multi_vec->vectors.resize(index.size());
948
949 for (unsigned int i = 0; i < index.size(); ++i)
950 {
951 AssertThrow(static_cast<unsigned int>(index[i]) <
952 this->vectors.size(),
954
955 new_multi_vec->vectors[i].reset(
956 this->vectors[index[i]].get(),
957 [](
958 auto
959 *) { /*Nothing to do, since we are creating only a view.*/ });
960 }
961
962 return new_multi_vec;
963 }
964
970 virtual const Belos::MultiVec<value_type> *
971 CloneView(const std::vector<int> &index) const
972 {
973 auto new_multi_vec = new MultiVecWrapper<VectorType>;
974
975 new_multi_vec->vectors.resize(index.size());
976
977 for (unsigned int i = 0; i < index.size(); ++i)
978 {
979 AssertThrow(static_cast<unsigned int>(index[i]) <
980 this->vectors.size(),
982
983 new_multi_vec->vectors[i].reset(
984 this->vectors[index[i]].get(),
985 [](
986 auto
987 *) { /*Nothing to do, since we are creating only a view.*/ });
988 }
989
990 return new_multi_vec;
991 }
992
996 virtual std::ptrdiff_t
997 GetGlobalLength() const
998 {
999 AssertThrow(this->vectors.size() > 0, ExcInternalError());
1000
1001 for (unsigned int i = 1; i < this->vectors.size(); ++i)
1002 AssertDimension(this->vectors[0]->size(), this->vectors[i]->size());
1003
1004 return this->vectors[0]->size();
1005 }
1006
1010 virtual int
1011 GetNumberVecs() const
1012 {
1013 return vectors.size();
1014 }
1015
1019 virtual void
1020 MvTimesMatAddMv(const value_type alpha,
1021 const Belos::MultiVec<value_type> &A_,
1022 const Teuchos::SerialDenseMatrix<int, value_type> &B,
1023 const value_type beta)
1024 {
1025 const auto &A = try_to_get_underlying_vector(A_);
1026
1027 const unsigned int n_rows = B.numRows();
1028 const unsigned int n_cols = B.numCols();
1029
1030 AssertThrow(n_rows == static_cast<unsigned int>(A.GetNumberVecs()),
1032 AssertThrow(n_cols == static_cast<unsigned int>(this->GetNumberVecs()),
1034
1035 for (unsigned int i = 0; i < n_cols; ++i)
1036 (*this->vectors[i]) *= beta;
1037
1038 for (unsigned int i = 0; i < n_cols; ++i)
1039 for (unsigned int j = 0; j < n_rows; ++j)
1040 this->vectors[i]->add(alpha * B(j, i), *A.vectors[j]);
1041 }
1042
1046 virtual void
1047 MvAddMv(const value_type alpha,
1048 const Belos::MultiVec<value_type> &A_,
1049 const value_type beta,
1050 const Belos::MultiVec<value_type> &B_)
1051 {
1052 const auto &A = try_to_get_underlying_vector(A_);
1053 const auto &B = try_to_get_underlying_vector(B_);
1054
1055 AssertThrow(this->vectors.size() == A.vectors.size(),
1057 AssertThrow(this->vectors.size() == B.vectors.size(),
1059
1060 for (unsigned int i = 0; i < this->vectors.size(); ++i)
1061 {
1062 this->vectors[i]->equ(alpha, *A.vectors[i]);
1063 this->vectors[i]->add(beta, *B.vectors[i]);
1064 }
1065 }
1066
1070 virtual void
1071 MvScale(const value_type alpha)
1072 {
1073 for (unsigned int i = 0; i < this->vectors.size(); ++i)
1074 (*this->vectors[i]) *= alpha;
1075 }
1076
1080 virtual void
1081 MvScale(const std::vector<value_type> & /*alpha*/)
1082 {
1084 }
1085
1090 virtual void
1091 MvTransMv(const value_type alpha,
1092 const Belos::MultiVec<value_type> &A_,
1093 Teuchos::SerialDenseMatrix<int, value_type> &B) const
1094 {
1095 const auto &A = try_to_get_underlying_vector(A_);
1096
1097 const unsigned int n_rows = B.numRows();
1098 const unsigned int n_cols = B.numCols();
1099
1100 AssertThrow(n_rows == static_cast<unsigned int>(A.GetNumberVecs()),
1102 AssertThrow(n_cols == static_cast<unsigned int>(this->GetNumberVecs()),
1104
1105 for (unsigned int i = 0; i < n_rows; ++i)
1106 for (unsigned int j = 0; j < n_cols; ++j)
1107 B(i, j) = alpha * ((*A.vectors[i]) * (*this->vectors[j]));
1108 }
1109
1114 virtual void
1115 MvDot(const Belos::MultiVec<value_type> &A_,
1116 std::vector<value_type> &b) const
1117 {
1118 const auto &A = try_to_get_underlying_vector(A_);
1119
1120 AssertThrow(this->vectors.size() == A.vectors.size(),
1122 AssertThrow(this->vectors.size() == b.size(), ExcInternalError());
1123
1124 for (unsigned int i = 0; i < this->vectors.size(); ++i)
1125 b[i] = (*this->vectors[i]) * (*A.vectors[i]);
1126 }
1127
1131 virtual void
1132 MvNorm(
1133 std::vector<typename Teuchos::ScalarTraits<value_type>::magnitudeType>
1134 &normvec,
1135 Belos::NormType type = Belos::TwoNorm) const
1136 {
1137 AssertThrow(type == Belos::TwoNorm, ExcNotImplemented());
1138 AssertThrow(this->vectors.size() == normvec.size(), ExcInternalError());
1139
1140 for (unsigned int i = 0; i < this->vectors.size(); ++i)
1141 normvec[i] = this->vectors[i]->l2_norm();
1142 }
1143
1147 virtual void
1148 SetBlock(const Belos::MultiVec<value_type> & /*A*/,
1149 const std::vector<int> & /*index*/)
1150 {
1152 }
1153
1157 virtual void
1158 MvRandom()
1159 {
1161 }
1162
1166 virtual void
1167 MvInit(const value_type /*alpha*/)
1168 {
1170 }
1171
1175 virtual void
1176 MvPrint(std::ostream & /*os*/) const
1177 {
1179 }
1180
1184 VectorType &
1185 genericVector()
1186 {
1187 AssertThrow(GetNumberVecs() == 1, ExcNotImplemented());
1188
1189 return *vectors[0];
1190 }
1191
1195 const VectorType &
1196 genericVector() const
1197 {
1198 AssertThrow(GetNumberVecs() == 1, ExcNotImplemented());
1199
1200 return *vectors[0];
1201 }
1202
1206 static MultiVecWrapper<VectorType> &
1207 try_to_get_underlying_vector(Belos::MultiVec<value_type> &vec_in)
1208 {
1209 auto vec = dynamic_cast<MultiVecWrapper<VectorType> *>(&vec_in);
1210
1212
1213 return *vec;
1214 }
1215
1219 const static MultiVecWrapper<VectorType> &
1220 try_to_get_underlying_vector(const Belos::MultiVec<value_type> &vec_in)
1221 {
1222 auto vec = dynamic_cast<const MultiVecWrapper<VectorType> *>(&vec_in);
1223
1225
1226 return *vec;
1227 }
1228
1229
1230# ifdef HAVE_BELOS_TSQR
1231 virtual void
1232 factorExplicit(Belos::MultiVec<value_type> &,
1233 Teuchos::SerialDenseMatrix<int, value_type> &,
1234 const bool = false)
1235 {
1237 }
1238
1239 virtual int
1240 revealRank(
1241 Teuchos::SerialDenseMatrix<int, value_type> &,
1242 const typename Teuchos::ScalarTraits<value_type>::magnitudeType &)
1243 {
1245 }
1246
1247# endif
1248
1249 private:
1253 std::vector<std::shared_ptr<VectorType>> vectors;
1254
1259 MultiVecWrapper() = default;
1260 };
1261
1268 template <typename OperatorType, typename VectorType>
1270 class OperatorWrapper
1271 : public Belos::Operator<typename VectorType::value_type>
1272 {
1273 public:
1277 using value_type = typename VectorType::value_type;
1278
1282 static bool
1283 this_type_is_missing_a_specialization()
1284 {
1285 return false;
1286 }
1287
1291 OperatorWrapper(const OperatorType &op)
1292 : op(op)
1293 {}
1294
1298 virtual ~OperatorWrapper() = default;
1299
1303 virtual void
1304 Apply(const Belos::MultiVec<value_type> &x,
1305 Belos::MultiVec<value_type> &y,
1306 Belos::ETrans trans = Belos::NOTRANS) const
1307 {
1308 // TODO: check for Tvmult
1309 AssertThrow(trans == Belos::NOTRANS, ExcNotImplemented());
1310
1311 op.vmult(MultiVecWrapper<VectorType>::try_to_get_underlying_vector(y)
1312 .genericVector(),
1313 MultiVecWrapper<VectorType>::try_to_get_underlying_vector(x)
1314 .genericVector());
1315 }
1316
1320 virtual bool
1321 HasApplyTranspose() const
1322 {
1323 // TODO: check for Tvmult
1324 return false;
1325 }
1326
1327 private:
1331 const OperatorType &op;
1332 };
1333
1334 } // namespace internal
1335
1336
1337
1338 template <typename VectorType>
1341 SolverControl &solver_control,
1342 const AdditionalData &additional_data,
1343 const Teuchos::RCP<Teuchos::ParameterList> &belos_parameters)
1344 : solver_control(solver_control)
1345 , additional_data(additional_data)
1346 , belos_parameters(belos_parameters)
1347 {}
1348
1349
1350
1351 template <typename VectorType>
1353 template <typename OperatorType, typename PreconditionerType>
1354 void SolverBelos<VectorType>::solve(const OperatorType &A_dealii,
1355 VectorType &x_dealii,
1356 const VectorType &b_dealii,
1357 const PreconditionerType &P_dealii)
1358 {
1359 using value_type = typename VectorType::value_type;
1360
1361 using MV = Belos::MultiVec<value_type>;
1362 using OP = Belos::Operator<value_type>;
1363
1364 Teuchos::RCP<OP> A = Teuchos::rcp(
1365 new internal::OperatorWrapper<OperatorType, VectorType>(A_dealii));
1366 Teuchos::RCP<OP> P = Teuchos::rcp(
1367 new internal::OperatorWrapper<PreconditionerType, VectorType>(P_dealii));
1368 Teuchos::RCP<MV> X =
1369 Teuchos::rcp(new internal::MultiVecWrapper<VectorType>(x_dealii));
1370 Teuchos::RCP<MV> B =
1371 Teuchos::rcp(new internal::MultiVecWrapper<VectorType>(b_dealii));
1372
1373 Teuchos::RCP<Belos::LinearProblem<value_type, MV, OP>> problem =
1374 Teuchos::rcp(new Belos::LinearProblem<value_type, MV, OP>(A, X, B));
1375
1376 if (additional_data.right_preconditioning == false)
1377 problem->setLeftPrec(P);
1378 else
1379 problem->setRightPrec(P);
1380
1381 const bool problem_set = problem->setProblem();
1382 AssertThrow(problem_set, ExcInternalError());
1383
1384 // compute initial residal
1385 VectorType r;
1386 r.reinit(x_dealii, true);
1387 A_dealii.vmult(r, x_dealii);
1388 r.sadd(-1., 1., b_dealii);
1389 const auto norm_0 = r.l2_norm();
1390
1391 if (solver_control.check(0, norm_0) != SolverControl::iterate)
1392 return;
1393
1394 double relative_tolerance_to_be_achieved =
1395 solver_control.tolerance() / norm_0;
1396 const unsigned int max_steps = solver_control.max_steps();
1397
1398 if (const auto *reduction_control =
1399 dynamic_cast<ReductionControl *>(&solver_control))
1400 relative_tolerance_to_be_achieved =
1401 std::max(relative_tolerance_to_be_achieved,
1402 reduction_control->reduction());
1403
1404 Teuchos::RCP<Teuchos::ParameterList> belos_parameters_copy(
1405 Teuchos::rcp(new Teuchos::ParameterList(*belos_parameters)));
1406
1407 belos_parameters_copy->set("Convergence Tolerance",
1408 relative_tolerance_to_be_achieved);
1409 belos_parameters_copy->set("Maximum Iterations",
1410 static_cast<int>(max_steps));
1411
1412 Teuchos::RCP<Belos::SolverManager<value_type, MV, OP>> solver;
1413
1414 if (additional_data.solver_name == SolverName::cg)
1415 solver = Teuchos::rcp(
1416 new Belos::BlockCGSolMgr<value_type, MV, OP>(problem,
1417 belos_parameters_copy));
1418 else if (additional_data.solver_name == SolverName::gmres)
1419 solver = Teuchos::rcp(
1420 new Belos::BlockGmresSolMgr<value_type, MV, OP>(problem,
1421 belos_parameters_copy));
1422 else
1424
1425 const auto flag = solver->solve();
1426
1427 solver_control.check(solver->getNumIters(), solver->achievedTol() * norm_0);
1428
1429 AssertThrow(flag == Belos::ReturnType::Converged ||
1430 ((dynamic_cast<IterationNumberControl *>(&solver_control) !=
1431 nullptr) &&
1432 (solver_control.last_step() == max_steps)),
1433 SolverControl::NoConvergence(solver_control.last_step(),
1434 solver_control.last_value()));
1435 }
1436
1437} // namespace TrilinosWrappers
1438# endif
1439
1440# endif
1441
1442#endif // DEAL_II_WITH_TRILINOS
1443
1445
1446#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)
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
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:38
#define DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
Definition config.h:636
#define DEAL_II_CXX20_REQUIRES(condition)
Definition config.h:249
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
#define DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
Definition config.h:680
#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:734
std::size_t size
Definition mpi.cc:733
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 SolverName solver_name=SolverName::cg, const bool right_preconditioning=false)