Reference documentation for deal.II version GIT relicensing-426-g7976cfd195 2024-04-18 21:10: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: 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
26# include <deal.II/lac/vector.h>
27
28// for AztecOO solvers
29# include <Amesos.h>
30# include <AztecOO.h>
31# include <Epetra_LinearProblem.h>
32# include <Epetra_Operator.h>
33
34// for Belos solvers
35# ifdef DEAL_II_TRILINOS_WITH_BELOS
36# include <BelosBlockCGSolMgr.hpp>
37# include <BelosBlockGmresSolMgr.hpp>
38# include <BelosEpetraAdapter.hpp>
39# include <BelosIteration.hpp>
40# include <BelosMultiVec.hpp>
41# include <BelosOperator.hpp>
42# include <BelosSolverManager.hpp>
43# endif
44
45# include <memory>
46
47
49
50namespace TrilinosWrappers
51{
52 // forward declarations
53# ifndef DOXYGEN
54 class SparseMatrix;
55 class PreconditionBase;
56# endif
57
58
78 {
79 public:
110
116 {
125 explicit AdditionalData(const bool output_solver_details = false,
126 const unsigned int gmres_restart_parameter = 30);
127
133
137 const unsigned int gmres_restart_parameter;
138 };
139
144 const AdditionalData &data = AdditionalData());
145
151 SolverControl &cn,
152 const AdditionalData &data = AdditionalData());
153
157 virtual ~SolverBase() = default;
158
164 void
165 solve(const SparseMatrix &A,
166 MPI::Vector &x,
167 const MPI::Vector &b,
168 const PreconditionBase &preconditioner);
169
177 void
178 solve(const Epetra_Operator &A,
179 MPI::Vector &x,
180 const MPI::Vector &b,
181 const PreconditionBase &preconditioner);
182
192 void
193 solve(const Epetra_Operator &A,
194 MPI::Vector &x,
195 const MPI::Vector &b,
196 const Epetra_Operator &preconditioner);
197
207 void
208 solve(const Epetra_Operator &A,
209 Epetra_MultiVector &x,
210 const Epetra_MultiVector &b,
211 const PreconditionBase &preconditioner);
212
223 void
224 solve(const Epetra_Operator &A,
225 Epetra_MultiVector &x,
226 const Epetra_MultiVector &b,
227 const Epetra_Operator &preconditioner);
228
229
230
241 void
242 solve(const SparseMatrix &A,
244 const ::Vector<double> &b,
245 const PreconditionBase &preconditioner);
246
258 void
261 const ::Vector<double> &b,
262 const PreconditionBase &preconditioner);
263
270 void
273 const ::LinearAlgebra::distributed::Vector<double> &b,
274 const PreconditionBase &preconditioner);
275
283 void
286 const ::LinearAlgebra::distributed::Vector<double> &b,
287 const PreconditionBase &preconditioner);
288
289
294 control() const;
295
300 int,
301 << "An error with error number " << arg1
302 << " occurred while calling a Trilinos function");
303
304 protected:
312
313 private:
318 template <typename Preconditioner>
319 void
320 do_solve(const Preconditioner &preconditioner);
321
325 template <typename Preconditioner>
326 void
327 set_preconditioner(AztecOO &solver, const Preconditioner &preconditioner);
328
334 std::unique_ptr<Epetra_LinearProblem> linear_problem;
335
340 std::unique_ptr<AztecOO_StatusTest> status_test;
341
346 AztecOO solver;
347
352 };
353
354
355 // provide a declaration for two explicit specializations
356 template <>
357 void
359 const PreconditionBase &preconditioner);
360
361 template <>
362 void
364 const Epetra_Operator &preconditioner);
365
366
372 class SolverCG : public SolverBase
373 {
374 public:
383 };
384
385
386
392 class SolverCGS : public SolverBase
393 {
394 public:
403 };
404
405
406
411 class SolverGMRES : public SolverBase
412 {
413 public:
422 const AdditionalData &data = AdditionalData());
423 };
424
425
426
434 {
435 public:
444 const AdditionalData &data = AdditionalData());
445 };
446
447
448
455 class SolverTFQMR : public SolverBase
456 {
457 public:
466 const AdditionalData &data = AdditionalData());
467 };
468
469
470
484 {
485 public:
491 {
495 explicit AdditionalData(const bool output_solver_details = false,
496 const std::string &solver_type = "Amesos_Klu");
497
503
522 std::string solver_type;
523 };
524
528 explicit SolverDirect(const AdditionalData &data = AdditionalData());
529
534 const AdditionalData &data = AdditionalData());
535
539 virtual ~SolverDirect() = default;
540
547 void
548 initialize(const SparseMatrix &A);
549
557 void
558 initialize(const SparseMatrix &A, const AdditionalData &data);
559
565 void
566 solve(MPI::Vector &x, const MPI::Vector &b);
567
573 void
575 const ::LinearAlgebra::distributed::Vector<double> &b);
576
582 void
583 vmult(MPI::Vector &x, const MPI::Vector &b) const;
584
590 void
592 const ::LinearAlgebra::distributed::Vector<double> &b) const;
593
600 void
601 solve(const SparseMatrix &A, MPI::Vector &x, const MPI::Vector &b);
602
610 void
611 solve(const SparseMatrix &A,
613 const ::Vector<double> &b);
614
621 void
624 const ::LinearAlgebra::distributed::Vector<double> &b);
625
630 control() const;
631
636 int,
637 << "An error with error number " << arg1
638 << " occurred while calling a Trilinos function");
639
640 private:
645 void
646 do_solve();
647
652
660
666 std::unique_ptr<Epetra_LinearProblem> linear_problem;
667
672 std::unique_ptr<Amesos_BaseSolver> solver;
673
678 };
679
680
681
682# ifdef DEAL_II_TRILINOS_WITH_BELOS
689 template <typename VectorType>
690 class SolverBelos
691 {
692 public:
697 enum SolverName
698 {
702 cg,
706 gmres,
707 } solver_name;
708
714 struct AdditionalData
715 {
719 AdditionalData(const SolverName solver_name = SolverName::cg,
720 const bool right_preconditioning = false)
721 : solver_name(solver_name)
722 , right_preconditioning(right_preconditioning)
723 {}
724
728 SolverName solver_name;
729
733 bool right_preconditioning;
734 };
735
739 SolverBelos(SolverControl &solver_control,
740 const AdditionalData &additional_data,
741 const Teuchos::RCP<Teuchos::ParameterList> &belos_parameters);
742
746 template <typename OperatorType, typename PreconditionerType>
747 void
748 solve(const OperatorType &a,
749 VectorType &x,
750 const VectorType &b,
751 const PreconditionerType &p);
752
753 private:
754 SolverControl &solver_control;
755 const AdditionalData additional_data;
756 const Teuchos::RCP<Teuchos::ParameterList> &belos_parameters;
757 };
758# endif
759
760} // namespace TrilinosWrappers
761
762
763
764# ifndef DOXYGEN
765
766# ifdef DEAL_II_TRILINOS_WITH_BELOS
767namespace TrilinosWrappers
768{
769 namespace internal
770 {
777 template <typename VectorType>
778 class MultiVecWrapper
779 : public Belos::MultiVec<typename VectorType::value_type>
780 {
781 public:
785 using value_type = typename VectorType::value_type;
786
790 static bool
791 this_type_is_missing_a_specialization()
792 {
793 return false;
794 }
795
799 MultiVecWrapper(VectorType &vector)
800 {
801 this->vectors.resize(1);
802 this->vectors[0].reset(
803 &vector,
804 [](auto *) { /*Nothing to do, since vector is owned outside.*/ });
805 }
806
810 MultiVecWrapper(const VectorType &vector)
811 {
812 this->vectors.resize(1);
813 this->vectors[0].reset(
814 &const_cast<VectorType &>(vector),
815 [](auto *) { /*Nothing to do, since vector is owned outside.*/ });
816 }
817
821 virtual ~MultiVecWrapper() = default;
822
826 virtual Belos::MultiVec<value_type> *
827 Clone(const int numvecs) const
828 {
829 auto new_multi_vec = new MultiVecWrapper<VectorType>;
830
831 new_multi_vec->vectors.resize(numvecs);
832
833 for (auto &vec : new_multi_vec->vectors)
834 {
835 vec = std::make_shared<VectorType>();
836
837 AssertThrow(this->vectors.size() > 0, ExcInternalError());
838 vec->reinit(*this->vectors[0]);
839 }
840
841 return new_multi_vec;
842 }
843
847 virtual Belos::MultiVec<value_type> *
848 CloneCopy() const
849 {
851 }
852
858 virtual Belos::MultiVec<value_type> *
859 CloneCopy(const std::vector<int> &index) const
860 {
861 auto new_multi_vec = new MultiVecWrapper<VectorType>;
862
863 new_multi_vec->vectors.resize(index.size());
864
865 for (unsigned int i = 0; i < index.size(); ++i)
866 {
867 AssertThrow(static_cast<unsigned int>(index[i]) <
868 this->vectors.size(),
870
871 new_multi_vec->vectors[i] = std::make_shared<VectorType>();
872
873 AssertIndexRange(index[i], this->vectors.size());
874 *new_multi_vec->vectors[i] = *this->vectors[index[i]];
875 }
876
877 return new_multi_vec;
878 }
879
885 virtual Belos::MultiVec<value_type> *
886 CloneViewNonConst(const std::vector<int> &index)
887 {
888 auto new_multi_vec = new MultiVecWrapper<VectorType>;
889
890 new_multi_vec->vectors.resize(index.size());
891
892 for (unsigned int i = 0; i < index.size(); ++i)
893 {
894 AssertThrow(static_cast<unsigned int>(index[i]) <
895 this->vectors.size(),
897
898 new_multi_vec->vectors[i].reset(
899 this->vectors[index[i]].get(),
900 [](
901 auto
902 *) { /*Nothing to do, since we are creating only a view.*/ });
903 }
904
905 return new_multi_vec;
906 }
907
913 virtual const Belos::MultiVec<value_type> *
914 CloneView(const std::vector<int> &index) const
915 {
916 auto new_multi_vec = new MultiVecWrapper<VectorType>;
917
918 new_multi_vec->vectors.resize(index.size());
919
920 for (unsigned int i = 0; i < index.size(); ++i)
921 {
922 AssertThrow(static_cast<unsigned int>(index[i]) <
923 this->vectors.size(),
925
926 new_multi_vec->vectors[i].reset(
927 this->vectors[index[i]].get(),
928 [](
929 auto
930 *) { /*Nothing to do, since we are creating only a view.*/ });
931 }
932
933 return new_multi_vec;
934 }
935
939 virtual ptrdiff_t
940 GetGlobalLength() const
941 {
942 AssertThrow(this->vectors.size() > 0, ExcInternalError());
943
944 for (unsigned int i = 1; i < this->vectors.size(); ++i)
945 AssertDimension(this->vectors[0]->size(), this->vectors[i]->size());
946
947 return this->vectors[0]->size();
948 }
949
953 virtual int
954 GetNumberVecs() const
955 {
956 return vectors.size();
957 }
958
962 virtual void
963 MvTimesMatAddMv(const value_type alpha,
964 const Belos::MultiVec<value_type> &A_,
965 const Teuchos::SerialDenseMatrix<int, value_type> &B,
966 const value_type beta)
967 {
968 const auto &A = try_to_get_underlying_vector(A_);
969
970 const unsigned int n_rows = B.numRows();
971 const unsigned int n_cols = B.numCols();
972
973 AssertThrow(n_rows == static_cast<unsigned int>(A.GetNumberVecs()),
975 AssertThrow(n_cols == static_cast<unsigned int>(this->GetNumberVecs()),
977
978 for (unsigned int i = 0; i < n_cols; ++i)
979 (*this->vectors[i]) *= beta;
980
981 for (unsigned int i = 0; i < n_cols; ++i)
982 for (unsigned int j = 0; j < n_rows; ++j)
983 this->vectors[i]->add(alpha * B(j, i), *A.vectors[j]);
984 }
985
989 virtual void
990 MvAddMv(const value_type alpha,
991 const Belos::MultiVec<value_type> &A_,
992 const value_type beta,
993 const Belos::MultiVec<value_type> &B_)
994 {
995 const auto &A = try_to_get_underlying_vector(A_);
996 const auto &B = try_to_get_underlying_vector(B_);
997
998 AssertThrow(this->vectors.size() == A.vectors.size(),
1000 AssertThrow(this->vectors.size() == B.vectors.size(),
1002
1003 for (unsigned int i = 0; i < this->vectors.size(); ++i)
1004 {
1005 this->vectors[i]->equ(alpha, *A.vectors[i]);
1006 this->vectors[i]->add(beta, *B.vectors[i]);
1007 }
1008 }
1009
1013 virtual void
1014 MvScale(const value_type alpha)
1015 {
1016 for (unsigned int i = 0; i < this->vectors.size(); ++i)
1017 (*this->vectors[i]) *= alpha;
1018 }
1019
1023 virtual void
1024 MvScale(const std::vector<value_type> &alpha)
1025 {
1027 (void)alpha;
1028 }
1029
1034 virtual void
1035 MvTransMv(const value_type alpha,
1036 const Belos::MultiVec<value_type> &A_,
1037 Teuchos::SerialDenseMatrix<int, value_type> &B) const
1038 {
1039 const auto &A = try_to_get_underlying_vector(A_);
1040
1041 const unsigned int n_rows = B.numRows();
1042 const unsigned int n_cols = B.numCols();
1043
1044 AssertThrow(n_rows == static_cast<unsigned int>(A.GetNumberVecs()),
1046 AssertThrow(n_cols == static_cast<unsigned int>(this->GetNumberVecs()),
1048
1049 for (unsigned int i = 0; i < n_rows; ++i)
1050 for (unsigned int j = 0; j < n_cols; ++j)
1051 B(i, j) = alpha * ((*A.vectors[i]) * (*this->vectors[j]));
1052 }
1053
1058 virtual void
1059 MvDot(const Belos::MultiVec<value_type> &A_,
1060 std::vector<value_type> &b) const
1061 {
1062 const auto &A = try_to_get_underlying_vector(A_);
1063
1064 AssertThrow(this->vectors.size() == A.vectors.size(),
1066 AssertThrow(this->vectors.size() == b.size(), ExcInternalError());
1067
1068 for (unsigned int i = 0; i < this->vectors.size(); ++i)
1069 b[i] = (*this->vectors[i]) * (*A.vectors[i]);
1070 }
1071
1075 virtual void
1076 MvNorm(
1077 std::vector<typename Teuchos::ScalarTraits<value_type>::magnitudeType>
1078 &normvec,
1079 Belos::NormType type = Belos::TwoNorm) const
1080 {
1081 AssertThrow(type == Belos::TwoNorm, ExcNotImplemented());
1082 AssertThrow(this->vectors.size() == normvec.size(), ExcInternalError());
1083
1084 for (unsigned int i = 0; i < this->vectors.size(); ++i)
1085 normvec[i] = this->vectors[i]->l2_norm();
1086 }
1087
1091 virtual void
1092 SetBlock(const Belos::MultiVec<value_type> &A,
1093 const std::vector<int> &index)
1094 {
1096 (void)A;
1097 (void)index;
1098 }
1099
1103 virtual void
1104 MvRandom()
1105 {
1107 }
1108
1112 virtual void
1113 MvInit(const value_type alpha)
1114 {
1116 (void)alpha;
1117 }
1118
1122 virtual void
1123 MvPrint(std::ostream &os) const
1124 {
1126 (void)os;
1127 }
1128
1132 VectorType &
1133 genericVector()
1134 {
1135 AssertThrow(GetNumberVecs() == 1, ExcNotImplemented());
1136
1137 return *vectors[0];
1138 }
1139
1143 const VectorType &
1144 genericVector() const
1145 {
1146 AssertThrow(GetNumberVecs() == 1, ExcNotImplemented());
1147
1148 return *vectors[0];
1149 }
1150
1154 static MultiVecWrapper<VectorType> &
1155 try_to_get_underlying_vector(Belos::MultiVec<value_type> &vec_in)
1156 {
1157 auto vec = dynamic_cast<MultiVecWrapper<VectorType> *>(&vec_in);
1158
1160
1161 return *vec;
1162 }
1163
1167 const static MultiVecWrapper<VectorType> &
1168 try_to_get_underlying_vector(const Belos::MultiVec<value_type> &vec_in)
1169 {
1170 auto vec = dynamic_cast<const MultiVecWrapper<VectorType> *>(&vec_in);
1171
1173
1174 return *vec;
1175 }
1176
1177
1178# ifdef HAVE_BELOS_TSQR
1179 virtual void
1180 factorExplicit(Belos::MultiVec<value_type> &,
1181 Teuchos::SerialDenseMatrix<int, value_type> &,
1182 const bool = false)
1183 {
1185 }
1186
1187 virtual int
1188 revealRank(
1189 Teuchos::SerialDenseMatrix<int, value_type> &,
1190 const typename Teuchos::ScalarTraits<value_type>::magnitudeType &)
1191 {
1193 }
1194
1195# endif
1196
1197 private:
1201 std::vector<std::shared_ptr<VectorType>> vectors;
1202
1207 MultiVecWrapper() = default;
1208 };
1209
1216 template <typename OperatorType, typename VectorType>
1217 class OperatorWrapper
1218 : public Belos::Operator<typename VectorType::value_type>
1219 {
1220 public:
1224 using value_type = typename VectorType::value_type;
1225
1229 static bool
1230 this_type_is_missing_a_specialization()
1231 {
1232 return false;
1233 }
1234
1238 OperatorWrapper(const OperatorType &op)
1239 : op(op)
1240 {}
1241
1245 virtual ~OperatorWrapper() = default;
1246
1250 virtual void
1251 Apply(const Belos::MultiVec<value_type> &x,
1252 Belos::MultiVec<value_type> &y,
1253 Belos::ETrans trans = Belos::NOTRANS) const
1254 {
1255 // TODO: check for Tvmult
1256 AssertThrow(trans == Belos::NOTRANS, ExcNotImplemented());
1257
1258 op.vmult(MultiVecWrapper<VectorType>::try_to_get_underlying_vector(y)
1259 .genericVector(),
1260 MultiVecWrapper<VectorType>::try_to_get_underlying_vector(x)
1261 .genericVector());
1262 }
1263
1267 virtual bool
1268 HasApplyTranspose() const
1269 {
1270 // TODO: check for Tvmult
1271 return false;
1272 }
1273
1274 private:
1278 const OperatorType &op;
1279 };
1280
1281 } // namespace internal
1282
1283
1284
1285 template <typename VectorType>
1286 SolverBelos<VectorType>::SolverBelos(
1287 SolverControl &solver_control,
1288 const AdditionalData &additional_data,
1289 const Teuchos::RCP<Teuchos::ParameterList> &belos_parameters)
1290 : solver_control(solver_control)
1291 , additional_data(additional_data)
1292 , belos_parameters(belos_parameters)
1293 {}
1294
1295
1296
1297 template <typename VectorType>
1298 template <typename OperatorType, typename PreconditionerType>
1299 void
1300 SolverBelos<VectorType>::solve(const OperatorType &A_dealii,
1301 VectorType &x_dealii,
1302 const VectorType &b_dealii,
1303 const PreconditionerType &P_dealii)
1304 {
1305 using value_type = typename VectorType::value_type;
1306
1307 using MV = Belos::MultiVec<value_type>;
1308 using OP = Belos::Operator<value_type>;
1309
1310 Teuchos::RCP<OP> A = Teuchos::rcp(
1311 new internal::OperatorWrapper<OperatorType, VectorType>(A_dealii));
1312 Teuchos::RCP<OP> P = Teuchos::rcp(
1313 new internal::OperatorWrapper<PreconditionerType, VectorType>(P_dealii));
1314 Teuchos::RCP<MV> X =
1315 Teuchos::rcp(new internal::MultiVecWrapper<VectorType>(x_dealii));
1316 Teuchos::RCP<MV> B =
1317 Teuchos::rcp(new internal::MultiVecWrapper<VectorType>(b_dealii));
1318
1319 Teuchos::RCP<Belos::LinearProblem<value_type, MV, OP>> problem =
1320 Teuchos::rcp(new Belos::LinearProblem<value_type, MV, OP>(A, X, B));
1321
1322 if (additional_data.right_preconditioning == false)
1323 problem->setLeftPrec(P);
1324 else
1325 problem->setRightPrec(P);
1326
1327 const bool problem_set = problem->setProblem();
1328 AssertThrow(problem_set, ExcInternalError());
1329
1330 // compute initial residal
1331 VectorType r;
1332 r.reinit(x_dealii, true);
1333 A_dealii.vmult(r, x_dealii);
1334 r.sadd(-1., 1., b_dealii);
1335 const auto norm_0 = r.l2_norm();
1336
1337 if (solver_control.check(0, norm_0) != SolverControl::iterate)
1338 return;
1339
1340 double relative_tolerance_to_be_achieved =
1341 solver_control.tolerance() / norm_0;
1342 const unsigned int max_steps = solver_control.max_steps();
1343
1344 if (const auto *reduction_control =
1345 dynamic_cast<ReductionControl *>(&solver_control))
1346 relative_tolerance_to_be_achieved =
1347 std::max(relative_tolerance_to_be_achieved,
1348 reduction_control->reduction());
1349
1350 Teuchos::RCP<Teuchos::ParameterList> belos_parameters_copy(
1351 Teuchos::rcp(new Teuchos::ParameterList(*belos_parameters)));
1352
1353 belos_parameters_copy->set("Convergence Tolerance",
1354 relative_tolerance_to_be_achieved);
1355 belos_parameters_copy->set("Maximum Iterations",
1356 static_cast<int>(max_steps));
1357
1358 Teuchos::RCP<Belos::SolverManager<value_type, MV, OP>> solver;
1359
1360 if (additional_data.solver_name == SolverName::cg)
1361 solver = Teuchos::rcp(
1362 new Belos::BlockCGSolMgr<value_type, MV, OP>(problem,
1363 belos_parameters_copy));
1364 else if (additional_data.solver_name == SolverName::gmres)
1365 solver = Teuchos::rcp(
1366 new Belos::BlockGmresSolMgr<value_type, MV, OP>(problem,
1367 belos_parameters_copy));
1368 else
1370
1371 const auto flag = solver->solve();
1372
1373 solver_control.check(solver->getNumIters(), solver->achievedTol() * norm_0);
1374
1375 AssertThrow(flag == Belos::ReturnType::Converged ||
1376 ((dynamic_cast<IterationNumberControl *>(&solver_control) !=
1377 nullptr) &&
1378 (solver_control.last_step() == max_steps)),
1379 SolverControl::NoConvergence(solver_control.last_step(),
1380 solver_control.last_value()));
1381 }
1382
1383} // namespace TrilinosWrappers
1384# endif
1385
1386# endif
1387
1389
1390#endif // DEAL_II_WITH_TRILINOS
1391
1392#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:502
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:503
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)
Definition exceptions.h:516
#define AssertThrow(cond, exc)
#define DEAL_II_NOT_IMPLEMENTED()
std::vector< value_type > l2_norm(const typename ::Triangulation< dim, spacedim >::cell_iterator &parent, const value_type parent_value)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)