From 263b3c81717889d78ef7ce0c8a6b2a8a7e348ad6 Mon Sep 17 00:00:00 2001
From: bangerth
Date: Thu, 3 Sep 2009 19:16:08 +0000
Subject: [PATCH] Avoid a problem with Trilinos 10 not having a certain header
file.
git-svn-id: https://svn.dealii.org/branches/releases/Branch-6-2@19380 0785d39b-7218-0410-832d-ea1e28bc413d
---
deal.II/doc/news/6.2.1-vs-6.2.2.h | 9 +++
.../lac/source/trilinos_precondition_block.cc | 69 +++++++++---------
deal.II/lac/source/trilinos_solver_block.cc | 73 +++++++++----------
3 files changed, 79 insertions(+), 72 deletions(-)
diff --git a/deal.II/doc/news/6.2.1-vs-6.2.2.h b/deal.II/doc/news/6.2.1-vs-6.2.2.h
index b710347b07..c17acfb81d 100644
--- a/deal.II/doc/news/6.2.1-vs-6.2.2.h
+++ b/deal.II/doc/news/6.2.1-vs-6.2.2.h
@@ -40,6 +40,15 @@ deal.II version 6.2.0 and version 6.2.1:
the other processors did not also match exactly. This is now fixed.
+
+
+
+ Fixed: Two of the Trilinos interface files of deal.II included Trilinos header
+ files that have been removed between Trilinos 9.0 and Trilinos 10.0. The
+ result is that deal.II could not be compiled against Trilinos 10 any
+ more. This is now fixed.
+
+
diff --git a/deal.II/lac/source/trilinos_precondition_block.cc b/deal.II/lac/source/trilinos_precondition_block.cc
index c3700b545e..50013e80cb 100755
--- a/deal.II/lac/source/trilinos_precondition_block.cc
+++ b/deal.II/lac/source/trilinos_precondition_block.cc
@@ -2,7 +2,7 @@
// $Id$
// Version: $Name$
//
-// Copyright (C) 2008 by the deal.II authors
+// Copyright (C) 2008, 2009 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
@@ -23,7 +23,6 @@
#include
#include
-#include
#include
#include
#include
@@ -63,26 +62,26 @@ namespace TrilinosWrappers
// Epetra operator
// (Thyra wrapper around the
// matrix).
- Teuchos::RCP > tmpM =
+ Teuchos::RCP > tmpM =
Thyra::epetraLinearOp(Teuchos::rcp(&input_M.trilinos_matrix(), false));
- Teuchos::RCP > M
+ Teuchos::RCP > M
= Teuchos::rcp(new Thyra::DefaultLinearOpSource(tmpM), true);
//Thyra::ConstLinearOperator opM = tmpM;
// Create a Thyra version of
// the preconditioner.
- Teuchos::RCP > tmpP =
+ Teuchos::RCP > tmpP =
Thyra::epetraLinearOp(Teuchos::rcp(const_cast(input_P),
- false),
+ false),
Thyra::NOTRANS,
Thyra::EPETRA_OP_APPLY_APPLY_INVERSE,
Thyra::EPETRA_OP_ADJOINT_SUPPORTED);
-
+
//Thyra::ConstLinearOperator opPM = tmpP;
- Teuchos::RCP > PM =
+ Teuchos::RCP > PM =
Teuchos::rcp (new Thyra::DefaultPreconditioner(), true);
{
@@ -94,12 +93,12 @@ namespace TrilinosWrappers
}
// Set up the solver.
- Teuchos::RCP aztecParams
+ Teuchos::RCP aztecParams
= Teuchos::rcp(new Teuchos::ParameterList("aztecOOFSolverFactory"), true);
- aztecParams->sublist("Forward Solve").set("Max Iterations",
+ aztecParams->sublist("Forward Solve").set("Max Iterations",
(int)n_iterations);
- aztecParams->sublist("Forward Solve").set("Tolerance",
+ aztecParams->sublist("Forward Solve").set("Tolerance",
solve_tolerance);
// aztecOO solver settings
@@ -113,7 +112,7 @@ namespace TrilinosWrappers
aztecParams->sublist("Forward Solve")
.sublist("AztecOO Settings").set("Aztec Solver", "GMRES");
aztecParams->sublist("Forward Solve")
- .sublist("AztecOO Settings").set("Size of Krylov Subspace",
+ .sublist("AztecOO Settings").set("Size of Krylov Subspace",
(int)n_iterations);
}
@@ -141,7 +140,7 @@ namespace TrilinosWrappers
aztecLowsFactory->setParameterList(aztecParams);
- Teuchos::RCP > rcpAztec
+ Teuchos::RCP > rcpAztec
= aztecLowsFactory->createOp();
// Does not work like
@@ -152,20 +151,20 @@ namespace TrilinosWrappers
// side vector, which makes
// the results wrong. So try
// something else...
- //Meros::LinearSolveStrategy azM
+ //Meros::LinearSolveStrategy azM
// = new Meros::AztecSolveStrategy(*(aztecParams.get()));
- //Thyra::LinearOperator Minverse
+ //Thyra::LinearOperator Minverse
// = Thyra::inverse(*aztecLowsFactory, opM);
//return new Meros::InverseOperator(opM * opPM, azM);
// Attach the preconditioner
// to the solver.
- aztecLowsFactory->initializePreconditionedOp(M, PM, &*rcpAztec,
+ aztecLowsFactory->initializePreconditionedOp(M, PM, &*rcpAztec,
Thyra::SUPPORT_SOLVE_FORWARD_ONLY);
-
+
// Create an inverse matrix
// object and return.
- Teuchos::RCP > Minverse =
+ Teuchos::RCP > Minverse =
Teuchos::rcp(new Thyra::DefaultInverseLinearOp(rcpAztec));
return Minverse;
@@ -266,7 +265,7 @@ namespace TrilinosWrappers
}
- void
+ void
PreconditionStokes::initialize (const BlockSparseMatrix &system_matrix,
const SparseMatrix &Mp_matrix,
const AdditionalData &additional_data,
@@ -296,7 +295,7 @@ namespace TrilinosWrappers
{
Teuchos::RCP >
tmpAvp = Thyra::epetraLinearOp(Teuchos::rcp(&*Av_preconditioner.preconditioner,
- false),
+ false),
Thyra::NOTRANS,
Thyra::EPETRA_OP_APPLY_APPLY_INVERSE,
Thyra::EPETRA_OP_ADJOINT_SUPPORTED);
@@ -305,8 +304,8 @@ namespace TrilinosWrappers
// Create Mp inverse matrix.
- Thyra::ConstLinearOperator Mp_inverse
- = inverse_matrix(Mp_matrix, &*Mp_preconditioner.preconditioner, true,
+ Thyra::ConstLinearOperator Mp_inverse
+ = inverse_matrix(Mp_matrix, &*Mp_preconditioner.preconditioner, true,
Mp_matrix.m(),
additional_data.inner_solve_tolerance,
additional_data.output_details);
@@ -320,7 +319,7 @@ namespace TrilinosWrappers
{
// Create Lp inverse matrix.
Lp_inverse = inverse_matrix(Lp_matrix, &*Lp_preconditioner.preconditioner,
- true, Lp_matrix.m(),
+ true, Lp_matrix.m(),
additional_data.inner_solve_tolerance,
additional_data.output_details);
}
@@ -346,9 +345,9 @@ namespace TrilinosWrappers
// Build identity matrices on
// the velocity and pressure
// spaces
- Thyra::ConstLinearOperator Ivel
+ Thyra::ConstLinearOperator Ivel
= Thyra::identity(Av_inverse.range());
- Thyra::ConstLinearOperator Ipress
+ Thyra::ConstLinearOperator Ipress
= Thyra::identity(Mp_inverse.domain());
// Build zero operators. Need
@@ -356,7 +355,7 @@ namespace TrilinosWrappers
// velocity and one that is
// velocity x pressure
Thyra::ConstLinearOperator zero;
-
+
// Build the composed Schur
// complement approximation
// inverse
@@ -369,13 +368,13 @@ namespace TrilinosWrappers
// Create discrete pressure
// gradient and divergence
// operators in Thyra format.
- Teuchos::RCP > tmpS01 =
- Thyra::epetraLinearOp(Teuchos::rcp(&system_matrix.block(0,1).trilinos_matrix(),
+ Teuchos::RCP > tmpS01 =
+ Thyra::epetraLinearOp(Teuchos::rcp(&system_matrix.block(0,1).trilinos_matrix(),
false));
Thyra::ConstLinearOperator S01 = tmpS01;
- Teuchos::RCP > tmpS10 =
- Thyra::epetraLinearOp(Teuchos::rcp(&system_matrix.block(1,0).trilinos_matrix(),
+ Teuchos::RCP > tmpS10 =
+ Thyra::epetraLinearOp(Teuchos::rcp(&system_matrix.block(1,0).trilinos_matrix(),
false));
Thyra::ConstLinearOperator S10 = tmpS10;
@@ -386,7 +385,7 @@ namespace TrilinosWrappers
// matrices depending on
// whether we do right or left
// preconditioning.
- Thyra::ConstLinearOperator P1
+ Thyra::ConstLinearOperator P1
= block2x2( Av_inverse, zero, zero, Ipress );
Thyra::ConstLinearOperator P2;
@@ -395,14 +394,14 @@ namespace TrilinosWrappers
else
P2 = block2x2( Ivel, zero, (-1.0)*S10, Ipress );
- Thyra::ConstLinearOperator P3
+ Thyra::ConstLinearOperator P3
= block2x2( Ivel, zero, zero, (-1.0)*Xinv );
- if (additional_data.right_preconditioning == true)
- preconditioner = Teuchos::rcp (new
+ if (additional_data.right_preconditioning == true)
+ preconditioner = Teuchos::rcp (new
Thyra::ConstLinearOperator(P1 * P2 * P3));
else
- preconditioner = Teuchos::rcp (new
+ preconditioner = Teuchos::rcp (new
Thyra::ConstLinearOperator(P3 * P2 * P1));
}
diff --git a/deal.II/lac/source/trilinos_solver_block.cc b/deal.II/lac/source/trilinos_solver_block.cc
index a9f1ed8faa..45e3162139 100644
--- a/deal.II/lac/source/trilinos_solver_block.cc
+++ b/deal.II/lac/source/trilinos_solver_block.cc
@@ -2,7 +2,7 @@
// $Id$
// Version: $Name$
//
-// Copyright (C) 2008 by the deal.II authors
+// Copyright (C) 2008, 2009 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
@@ -34,7 +34,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -56,15 +55,15 @@ namespace TrilinosWrappers
output_details (output_details)
{}
-
-
+
+
SolverBlockBase::SolverBlockBase (SolverControl &cn)
:
solver_name (gmres),
solver_control (cn)
{}
-
+
SolverBlockBase::SolverBlockBase (SolverBlockBase::SolverBlockName solver_name,
SolverControl &cn)
@@ -73,12 +72,12 @@ namespace TrilinosWrappers
solver_control (cn)
{}
-
+
SolverBlockBase::~SolverBlockBase ()
{}
-
+
SolverControl &
SolverBlockBase::control() const
@@ -115,8 +114,8 @@ namespace TrilinosWrappers
solve (A, tmpx, tmpb, preconditioner);
x = tmpx;
}
-
-
+
+
void
SolverBlockBase::solve (const BlockSparseMatrix &input_A,
@@ -187,16 +186,16 @@ namespace TrilinosWrappers
// abstract Thyra/Stratimikos
// interfaces to the AztecOO
// solver.
- //
+ //
// As a first step, create a
// copy of the vector spaces.
- std::vector > >
+ std::vector > >
epetra_vector_spaces;
for (unsigned int i=0; i > tmp_space
= Thyra::create_VectorSpace(
- Teuchos::rcp(&input_A.block(i,i).domain_partitioner(),
+ Teuchos::rcp(&input_A.block(i,i).domain_partitioner(),
false));
epetra_vector_spaces.push_back(tmp_space);
@@ -211,8 +210,8 @@ namespace TrilinosWrappers
for (unsigned int i=0; i >
- A_ij = Thyra::epetraLinearOp(Teuchos::rcp(&input_A.block(i,j).trilinos_matrix(),
+ Teuchos::RCP >
+ A_ij = Thyra::epetraLinearOp(Teuchos::rcp(&input_A.block(i,j).trilinos_matrix(),
false));
tmpA->setBlock(i, j, A_ij);
}
@@ -232,31 +231,31 @@ namespace TrilinosWrappers
Epetra_Vector *block_ptr = const_cast
((input_b.block(i).trilinos_vector())(0));
Teuchos::RCP > tmp_rhs_i
- = Thyra::create_Vector(Teuchos::rcp(block_ptr, false),
+ = Thyra::create_Vector(Teuchos::rcp(block_ptr, false),
epetra_vector_spaces[i]);
const Thyra::Vector rhs_i = tmp_rhs_i;
rhs.setBlock(i, rhs_i);
block_ptr = (input_x.block(i).trilinos_vector())(0);
Teuchos::RCP > tmp_sol_i
- = Thyra::create_Vector(Teuchos::rcp(block_ptr, false),
+ = Thyra::create_Vector(Teuchos::rcp(block_ptr, false),
epetra_vector_spaces[i]);
Thyra::Vector sol_i = tmp_sol_i;
sol.setBlock(i, sol_i);
}
- // ------- Now build a solver factory for the block problem -------
+ // ------- Now build a solver factory for the block problem -------
// Set up a parameter list for
// the AztecOO solver.
- Teuchos::RCP aztecBlockParams
+ Teuchos::RCP aztecBlockParams
= rcp(new Teuchos::ParameterList("AztecOO block solver parameters"));
-
+
// Set the number of
// iterations and the solver
// tolerance from the solver
// control object.
- aztecBlockParams->sublist("Forward Solve").set("Max Iterations",
+ aztecBlockParams->sublist("Forward Solve").set("Max Iterations",
(int)solver_control.max_steps());
aztecBlockParams->sublist("Forward Solve").set("Tolerance",
solver_control.tolerance());
@@ -279,7 +278,7 @@ namespace TrilinosWrappers
aztecBlockParams->sublist("Forward Solve")
.sublist("AztecOO Settings").set("Aztec Solver", "GMRES");
aztecBlockParams->sublist("Forward Solve")
- .sublist("AztecOO Settings").set("Size of Krylov Subspace",
+ .sublist("AztecOO Settings").set("Size of Krylov Subspace",
(int)additional_data.gmres_restart_parameter);
break;
default:
@@ -296,7 +295,7 @@ namespace TrilinosWrappers
aztecBlockParams->sublist("Forward Solve")
.sublist("AztecOO Settings").set("Output Frequency", 1);
else
- aztecBlockParams->sublist("VerboseObject").set("Verbosity Level",
+ aztecBlockParams->sublist("VerboseObject").set("Verbosity Level",
"none");
// Create solve factory from
@@ -307,7 +306,7 @@ namespace TrilinosWrappers
aztecBlockLowsFactory->setParameterList(aztecBlockParams);
- Teuchos::RCP > rcpBlockAztec
+ Teuchos::RCP > rcpBlockAztec
= aztecBlockLowsFactory->createOp();
@@ -316,10 +315,10 @@ namespace TrilinosWrappers
// Extract base operators from
// block matrix A and block
// preconditioner P.
- Teuchos::RCP > A_ptr
- = Teuchos::rcp(new Thyra::DefaultLinearOpSource(A.constPtr()),
+ Teuchos::RCP > A_ptr
+ = Teuchos::rcp(new Thyra::DefaultLinearOpSource(A.constPtr()),
true);
- Teuchos::RCP > P_ptr =
+ Teuchos::RCP > P_ptr =
Teuchos::rcp (new Thyra::DefaultPreconditioner(), true);
{
Thyra::DefaultPreconditioner
@@ -334,13 +333,13 @@ namespace TrilinosWrappers
// Attach the matrix and the
// preconditioner to the
// solver object.
- aztecBlockLowsFactory->initializePreconditionedOp(A_ptr, P_ptr,
- &*rcpBlockAztec,
+ aztecBlockLowsFactory->initializePreconditionedOp(A_ptr, P_ptr,
+ &*rcpBlockAztec,
Thyra::SUPPORT_SOLVE_FORWARD_ONLY);
// Now do the solve.
Thyra::SolveStatus
- solveStatus = Thyra::solve( *rcpBlockAztec, Thyra::NOTRANS,
+ solveStatus = Thyra::solve( *rcpBlockAztec, Thyra::NOTRANS,
*rhs.constPtr().get(), &*sol.ptr().get() );
// Extract the number of
@@ -350,7 +349,7 @@ namespace TrilinosWrappers
{
std::string output_text = solveStatus.message;
unsigned int position = output_text.find ("using ");
- const std::pair tmp
+ const std::pair tmp
= Utilities::get_integer_at_position (output_text, position+6);
n_iterations = tmp.first;
}
@@ -367,11 +366,11 @@ namespace TrilinosWrappers
solver_control.check (n_iterations, 0);
}
-
-
-
+
+
+
/* ------------------------ SolverCG -------------------------- */
SolverBlockCG::AdditionalData::
@@ -382,8 +381,8 @@ namespace TrilinosWrappers
output_details (output_details)
{}
-
-
+
+
SolverBlockCG::SolverBlockCG (SolverControl &cn,
const AdditionalData &data)
:
@@ -394,7 +393,7 @@ namespace TrilinosWrappers
additional_data.right_preconditioning = data.right_preconditioning;
additional_data.output_details = data.output_details;
}
-
+
/* ---------------------- SolverGMRES ------------------------- */
@@ -408,7 +407,7 @@ namespace TrilinosWrappers
output_details (output_details)
{}
-
+
SolverBlockGMRES::SolverBlockGMRES (SolverControl &cn,
const AdditionalData &data)
--
2.39.5