deal.II version GIT relicensing-3713-g695aaf43dd 2025-07-09 15: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\}}\)
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 - 2025 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
31
32// for AztecOO solvers
33# include <Amesos.h>
34# include <AztecOO.h>
35# include <Epetra_LinearProblem.h>
36# include <Epetra_Operator.h>
37
38// for Belos solvers
39# ifdef DEAL_II_TRILINOS_WITH_BELOS
40# include <BelosBlockCGSolMgr.hpp>
41# include <BelosBlockGmresSolMgr.hpp>
42# include <BelosEpetraAdapter.hpp>
43# include <BelosIteration.hpp>
44# include <BelosMultiVec.hpp>
45# include <BelosOperator.hpp>
46# include <BelosSolverManager.hpp>
47# endif
48
50
51
52# include <memory>
53
54
56
57namespace TrilinosWrappers
58{
59 // forward declarations
60# ifndef DOXYGEN
61 class SparseMatrix;
62 class PreconditionBase;
63# endif
64
65
85 {
86 public:
117
123 {
132 explicit AdditionalData(const bool output_solver_details = false,
133 const unsigned int gmres_restart_parameter = 30);
134
140
144 const unsigned int gmres_restart_parameter;
145 };
146
152
158 SolverControl &cn,
160
164 virtual ~SolverBase() = default;
165
171 void
172 solve(const SparseMatrix &A,
173 MPI::Vector &x,
174 const MPI::Vector &b,
175 const PreconditionBase &preconditioner);
176
184 void
185 solve(const Epetra_Operator &A,
186 MPI::Vector &x,
187 const MPI::Vector &b,
188 const PreconditionBase &preconditioner);
189
199 void
200 solve(const Epetra_Operator &A,
201 MPI::Vector &x,
202 const MPI::Vector &b,
203 const Epetra_Operator &preconditioner);
204
214 void
215 solve(const Epetra_Operator &A,
216 Epetra_MultiVector &x,
217 const Epetra_MultiVector &b,
218 const PreconditionBase &preconditioner);
219
230 void
231 solve(const Epetra_Operator &A,
232 Epetra_MultiVector &x,
233 const Epetra_MultiVector &b,
234 const Epetra_Operator &preconditioner);
235
236
237
248 void
249 solve(const SparseMatrix &A,
251 const ::Vector<double> &b,
252 const PreconditionBase &preconditioner);
253
265 void
268 const ::Vector<double> &b,
269 const PreconditionBase &preconditioner);
270
277 void
280 const ::LinearAlgebra::distributed::Vector<double> &b,
281 const PreconditionBase &preconditioner);
282
290 void
293 const ::LinearAlgebra::distributed::Vector<double> &b,
294 const PreconditionBase &preconditioner);
295
296
301 control() const;
302
307 int,
308 << "An error with error number " << arg1
309 << " occurred while calling a Trilinos function");
310
311 protected:
319
320 private:
325 template <typename Preconditioner>
326 void
327 do_solve(const Preconditioner &preconditioner);
328
332 template <typename Preconditioner>
333 void
334 set_preconditioner(AztecOO &solver, const Preconditioner &preconditioner);
335
341 std::unique_ptr<Epetra_LinearProblem> linear_problem;
342
347 std::unique_ptr<AztecOO_StatusTest> status_test;
348
353 AztecOO solver;
354
359 };
360
361
362 // provide a declaration for two explicit specializations
363 template <>
364 void
366 const PreconditionBase &preconditioner);
367
368 template <>
369 void
371 const Epetra_Operator &preconditioner);
372
373
379 class SolverCG : public SolverBase
380 {
381 public:
390 };
391
392
393
399 class SolverCGS : public SolverBase
400 {
401 public:
410 };
411
412
413
418 class SolverGMRES : public SolverBase
419 {
420 public:
430 };
431
432
433
441 {
442 public:
452 };
453
454
455
462 class SolverTFQMR : public SolverBase
463 {
464 public:
474 };
475
476
477
491 {
492 public:
498 {
502 explicit AdditionalData(const bool output_solver_details = false,
503 const std::string &solver_type = "Amesos_Klu");
504
510
529 std::string solver_type;
530 };
531
535 explicit SolverDirect(const AdditionalData &data = AdditionalData());
536
542
546 virtual ~SolverDirect() = default;
547
554 void
555 initialize(const SparseMatrix &A);
556
564 void
565 initialize(const SparseMatrix &A, const AdditionalData &data);
566
572 void
573 solve(MPI::Vector &x, const MPI::Vector &b);
574
580 void
582 const ::LinearAlgebra::distributed::Vector<double> &b);
583
589 void
590 vmult(MPI::Vector &x, const MPI::Vector &b) const;
591
597 void
599 const ::LinearAlgebra::distributed::Vector<double> &b) const;
600
607 void
608 solve(const SparseMatrix &A, MPI::Vector &x, const MPI::Vector &b);
609
617 void
618 solve(const SparseMatrix &A,
620 const ::Vector<double> &b);
621
628 void
631 const ::LinearAlgebra::distributed::Vector<double> &b);
632
639 void
640 solve(const Epetra_Operator &A,
641 Epetra_MultiVector &x,
642 const Epetra_MultiVector &b);
643
650 void
651 solve(const SparseMatrix &sparse_matrix,
652 FullMatrix<double> &solution,
653 const FullMatrix<double> &rhs);
654
659 control() const;
660
665 int,
666 << "An error with error number " << arg1
667 << " occurred while calling a Trilinos function");
668
669 private:
674 void
675 do_solve();
676
681
689
695 std::unique_ptr<Epetra_LinearProblem> linear_problem;
696
701 std::unique_ptr<Amesos_BaseSolver> solver;
702
707 };
708
709
710
711# ifdef DEAL_II_TRILINOS_WITH_BELOS
718 template <typename VectorType>
720 class SolverBelos
721 {
722 public:
727 enum SolverName
728 {
732 cg,
736 gmres,
737 } solver_name;
738
744 struct AdditionalData
745 {
749 AdditionalData(const SolverName solver_name = SolverName::cg,
750 const bool right_preconditioning = false)
751 : solver_name(solver_name)
752 , right_preconditioning(right_preconditioning)
753 {}
754
758 SolverName solver_name;
759
763 bool right_preconditioning;
764 };
765
769 SolverBelos(SolverControl &solver_control,
770 const AdditionalData &additional_data,
771 const Teuchos::RCP<Teuchos::ParameterList> &belos_parameters);
772
776 template <typename OperatorType, typename PreconditionerType>
777 void
778 solve(const OperatorType &a,
779 VectorType &x,
780 const VectorType &b,
781 const PreconditionerType &p);
782
783 private:
784 SolverControl &solver_control;
785 const AdditionalData additional_data;
786 const Teuchos::RCP<Teuchos::ParameterList> &belos_parameters;
787 };
788# endif
789
790} // namespace TrilinosWrappers
791
792
793
794# ifndef DOXYGEN
795
796# ifdef DEAL_II_TRILINOS_WITH_BELOS
797namespace TrilinosWrappers
798{
799 namespace internal
800 {
807 template <typename VectorType>
809 class MultiVecWrapper
810 : public Belos::MultiVec<typename VectorType::value_type>
811 {
812 public:
816 using value_type = typename VectorType::value_type;
817
821 static bool
822 this_type_is_missing_a_specialization()
823 {
824 return false;
825 }
826
830 MultiVecWrapper(VectorType &vector)
831 {
832 this->vectors.resize(1);
833 this->vectors[0].reset(
834 &vector,
835 [](auto *) { /*Nothing to do, since vector is owned outside.*/ });
836 }
837
841 MultiVecWrapper(const VectorType &vector)
842 {
843 this->vectors.resize(1);
844 this->vectors[0].reset(
845 &const_cast<VectorType &>(vector),
846 [](auto *) { /*Nothing to do, since vector is owned outside.*/ });
847 }
848
852 virtual ~MultiVecWrapper() = default;
853
857 virtual Belos::MultiVec<value_type> *
858 Clone(const int numvecs) const
859 {
860 auto new_multi_vec = new MultiVecWrapper<VectorType>;
861
862 new_multi_vec->vectors.resize(numvecs);
863
864 for (auto &vec : new_multi_vec->vectors)
865 {
866 vec = std::make_shared<VectorType>();
867
868 AssertThrow(this->vectors.size() > 0, ExcInternalError());
869 vec->reinit(*this->vectors[0]);
870 }
871
872 return new_multi_vec;
873 }
874
878 virtual Belos::MultiVec<value_type> *
879 CloneCopy() const
880 {
882 }
883
889 virtual Belos::MultiVec<value_type> *
890 CloneCopy(const std::vector<int> &index) const
891 {
892 auto new_multi_vec = new MultiVecWrapper<VectorType>;
893
894 new_multi_vec->vectors.resize(index.size());
895
896 for (unsigned int i = 0; i < index.size(); ++i)
897 {
898 AssertThrow(static_cast<unsigned int>(index[i]) <
899 this->vectors.size(),
901
902 new_multi_vec->vectors[i] = std::make_shared<VectorType>();
903
904 AssertIndexRange(index[i], this->vectors.size());
905 *new_multi_vec->vectors[i] = *this->vectors[index[i]];
906 }
907
908 return new_multi_vec;
909 }
910
916 virtual Belos::MultiVec<value_type> *
917 CloneViewNonConst(const std::vector<int> &index)
918 {
919 auto new_multi_vec = new MultiVecWrapper<VectorType>;
920
921 new_multi_vec->vectors.resize(index.size());
922
923 for (unsigned int i = 0; i < index.size(); ++i)
924 {
925 AssertThrow(static_cast<unsigned int>(index[i]) <
926 this->vectors.size(),
928
929 new_multi_vec->vectors[i].reset(
930 this->vectors[index[i]].get(),
931 [](
932 auto
933 *) { /*Nothing to do, since we are creating only a view.*/ });
934 }
935
936 return new_multi_vec;
937 }
938
944 virtual const Belos::MultiVec<value_type> *
945 CloneView(const std::vector<int> &index) const
946 {
947 auto new_multi_vec = new MultiVecWrapper<VectorType>;
948
949 new_multi_vec->vectors.resize(index.size());
950
951 for (unsigned int i = 0; i < index.size(); ++i)
952 {
953 AssertThrow(static_cast<unsigned int>(index[i]) <
954 this->vectors.size(),
956
957 new_multi_vec->vectors[i].reset(
958 this->vectors[index[i]].get(),
959 [](
960 auto
961 *) { /*Nothing to do, since we are creating only a view.*/ });
962 }
963
964 return new_multi_vec;
965 }
966
970 virtual std::ptrdiff_t
971 GetGlobalLength() const
972 {
973 AssertThrow(this->vectors.size() > 0, ExcInternalError());
974
975 for (unsigned int i = 1; i < this->vectors.size(); ++i)
976 AssertDimension(this->vectors[0]->size(), this->vectors[i]->size());
977
978 return this->vectors[0]->size();
979 }
980
984 virtual int
985 GetNumberVecs() const
986 {
987 return vectors.size();
988 }
989
993 virtual void
994 MvTimesMatAddMv(const value_type alpha,
995 const Belos::MultiVec<value_type> &A_,
996 const Teuchos::SerialDenseMatrix<int, value_type> &B,
997 const value_type beta)
998 {
999 const auto &A = try_to_get_underlying_vector(A_);
1000
1001 const unsigned int n_rows = B.numRows();
1002 const unsigned int n_cols = B.numCols();
1003
1004 AssertThrow(n_rows == static_cast<unsigned int>(A.GetNumberVecs()),
1006 AssertThrow(n_cols == static_cast<unsigned int>(this->GetNumberVecs()),
1008
1009 for (unsigned int i = 0; i < n_cols; ++i)
1010 (*this->vectors[i]) *= beta;
1011
1012 for (unsigned int i = 0; i < n_cols; ++i)
1013 for (unsigned int j = 0; j < n_rows; ++j)
1014 this->vectors[i]->add(alpha * B(j, i), *A.vectors[j]);
1015 }
1016
1020 virtual void
1021 MvAddMv(const value_type alpha,
1022 const Belos::MultiVec<value_type> &A_,
1023 const value_type beta,
1024 const Belos::MultiVec<value_type> &B_)
1025 {
1026 const auto &A = try_to_get_underlying_vector(A_);
1027 const auto &B = try_to_get_underlying_vector(B_);
1028
1029 AssertThrow(this->vectors.size() == A.vectors.size(),
1031 AssertThrow(this->vectors.size() == B.vectors.size(),
1033
1034 for (unsigned int i = 0; i < this->vectors.size(); ++i)
1035 {
1036 this->vectors[i]->equ(alpha, *A.vectors[i]);
1037 this->vectors[i]->add(beta, *B.vectors[i]);
1038 }
1039 }
1040
1044 virtual void
1045 MvScale(const value_type alpha)
1046 {
1047 for (unsigned int i = 0; i < this->vectors.size(); ++i)
1048 (*this->vectors[i]) *= alpha;
1049 }
1050
1054 virtual void
1055 MvScale(const std::vector<value_type> & /*alpha*/)
1056 {
1058 }
1059
1064 virtual void
1065 MvTransMv(const value_type alpha,
1066 const Belos::MultiVec<value_type> &A_,
1067 Teuchos::SerialDenseMatrix<int, value_type> &B) const
1068 {
1069 const auto &A = try_to_get_underlying_vector(A_);
1070
1071 const unsigned int n_rows = B.numRows();
1072 const unsigned int n_cols = B.numCols();
1073
1074 AssertThrow(n_rows == static_cast<unsigned int>(A.GetNumberVecs()),
1076 AssertThrow(n_cols == static_cast<unsigned int>(this->GetNumberVecs()),
1078
1079 for (unsigned int i = 0; i < n_rows; ++i)
1080 for (unsigned int j = 0; j < n_cols; ++j)
1081 B(i, j) = alpha * ((*A.vectors[i]) * (*this->vectors[j]));
1082 }
1083
1088 virtual void
1089 MvDot(const Belos::MultiVec<value_type> &A_,
1090 std::vector<value_type> &b) const
1091 {
1092 const auto &A = try_to_get_underlying_vector(A_);
1093
1094 AssertThrow(this->vectors.size() == A.vectors.size(),
1096 AssertThrow(this->vectors.size() == b.size(), ExcInternalError());
1097
1098 for (unsigned int i = 0; i < this->vectors.size(); ++i)
1099 b[i] = (*this->vectors[i]) * (*A.vectors[i]);
1100 }
1101
1105 virtual void
1106 MvNorm(
1107 std::vector<typename Teuchos::ScalarTraits<value_type>::magnitudeType>
1108 &normvec,
1109 Belos::NormType type = Belos::TwoNorm) const
1110 {
1111 AssertThrow(type == Belos::TwoNorm, ExcNotImplemented());
1112 AssertThrow(this->vectors.size() == normvec.size(), ExcInternalError());
1113
1114 for (unsigned int i = 0; i < this->vectors.size(); ++i)
1115 normvec[i] = this->vectors[i]->l2_norm();
1116 }
1117
1121 virtual void
1122 SetBlock(const Belos::MultiVec<value_type> & /*A*/,
1123 const std::vector<int> & /*index*/)
1124 {
1126 }
1127
1131 virtual void
1132 MvRandom()
1133 {
1135 }
1136
1140 virtual void
1141 MvInit(const value_type /*alpha*/)
1142 {
1144 }
1145
1149 virtual void
1150 MvPrint(std::ostream & /*os*/) const
1151 {
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#else
1419
1420// Make sure the scripts that create the C++20 module input files have
1421// something to latch on if the preprocessor #ifdef above would
1422// otherwise lead to an empty content of the file.
1425
1426#endif // DEAL_II_WITH_TRILINOS
1427
1428#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:35
#define DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
Definition config.h:598
#define DEAL_II_CXX20_REQUIRES(condition)
Definition config.h:243
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:36
#define DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
Definition config.h:642
#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:750
std::size_t size
Definition mpi.cc:749
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 > &)