/usr/include/trilinos/MueLu_CreateEpetraPreconditioner.hpp is in libtrilinos-muelu-dev 12.10.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | #ifndef MUELU_CREATE_EPETRA_PRECONDITIONER_HPP
#define MUELU_CREATE_EPETRA_PRECONDITIONER_HPP
#include <Teuchos_XMLParameterListHelpers.hpp>
#include <Xpetra_CrsMatrix.hpp>
#include <Xpetra_MultiVector.hpp>
#include <Xpetra_MultiVectorFactory.hpp>
#include <MueLu.hpp>
#include <MueLu_EpetraOperator.hpp>
#include <MueLu_Exceptions.hpp>
#include <MueLu_Hierarchy.hpp>
#include <MueLu_CreateXpetraPreconditioner.hpp>
#include <MueLu_MasterList.hpp>
#include <MueLu_MLParameterListInterpreter.hpp>
#include <MueLu_ParameterListInterpreter.hpp>
#include <MueLu_Utilities.hpp>
#include <MueLu_HierarchyUtils.hpp>
//! @file
//! @brief Various adapters that will create a MueLu preconditioner that is an Epetra_Operator.
#if defined(HAVE_MUELU_EPETRA)
namespace MueLu {
/*!
@brief Helper function to create a MueLu preconditioner that can be used by Epetra.
@ingroup MueLuAdapters
Given a EpetraCrs_Matrix, this function returns a constructed MueLu preconditioner.
@param[in] inA Matrix
@param[in] paramListIn Parameter list
@param[in] inCoords (optional) Coordinates. The first vector is x, the second (if necessary) y, the third (if necessary) z.
@param[in] inNullspace (optional) Near nullspace of the matrix.
*/
Teuchos::RCP<MueLu::EpetraOperator>
CreateEpetraPreconditioner(const Teuchos::RCP<Epetra_CrsMatrix>& inA,
// FIXME: why is it non-const
Teuchos::ParameterList& paramListIn,
const Teuchos::RCP<Epetra_MultiVector>& inCoords = Teuchos::null,
const Teuchos::RCP<Epetra_MultiVector>& inNullspace = Teuchos::null)
{
typedef double SC;
typedef int LO;
typedef int GO;
typedef Xpetra::EpetraNode NO;
using Teuchos::ParameterList;
typedef Xpetra::MultiVector<SC, LO, GO, NO> MultiVector;
typedef Xpetra::Matrix<SC, LO, GO, NO> Matrix;
typedef Hierarchy<SC,LO,GO,NO> Hierarchy;
typedef HierarchyManager<SC,LO,GO,NO> HierarchyManager;
RCP<Matrix> A = EpetraCrs_To_XpetraMatrix<SC, LO, GO, NO>(inA);
RCP<MultiVector> coordinates = Teuchos::null;
if (inCoords != Teuchos::null) {
coordinates = EpetraMultiVector_To_XpetraMultiVector<SC,LO,GO,NO>(inCoords);
}
RCP<MultiVector> nullspace = Teuchos::null;
if (inNullspace != Teuchos::null) {
nullspace = EpetraMultiVector_To_XpetraMultiVector<SC, LO, GO, NO>(inNullspace);
}
RCP<Hierarchy> H = MueLu::CreateXpetraPreconditioner<SC,LO,GO,NO>(A,paramListIn,coordinates,nullspace);
return rcp(new EpetraOperator(H));
}
/*!
@brief Helper function to create a MueLu preconditioner that can be used by Epetra.
@ingroup MueLuAdapters
Given a Epetra_CrsMatrix, this function returns a constructed MueLu preconditioner.
@param[in] inA Matrix
@param[in] inCoords (optional) Coordinates. The first vector is x, the second (if necessary) y, the third (if necessary) z.
@param[in] inNullspace (optional) Near nullspace of the matrix.
*/
Teuchos::RCP<MueLu::EpetraOperator>
CreateEpetraPreconditioner(const Teuchos::RCP<Epetra_CrsMatrix> & inA,
const Teuchos::RCP<Epetra_MultiVector>& inCoords = Teuchos::null,
const Teuchos::RCP<Epetra_MultiVector>& inNullspace = Teuchos::null) {
Teuchos::ParameterList paramList;
return CreateEpetraPreconditioner(inA, paramList, inCoords, inNullspace);
}
/*!
@brief Helper function to create a MueLu preconditioner that can be used by Epetra.
@ingroup MueLuAdapters
Given a Epetra_CrsMatrix, this function returns a constructed MueLu preconditioner.
@param[in] inA Matrix
@param[in] xmlFileName XML file containing MueLu options
@param[in] inCoords (optional) Coordinates. The first vector is x, the second (if necessary) y, the third (if necessary) z.
@param[in] inNullspace (optional) Near nullspace of the matrix.
*/
Teuchos::RCP<MueLu::EpetraOperator>
CreateEpetraPreconditioner(const Teuchos::RCP<Epetra_CrsMatrix> & A,
const std::string& xmlFileName,
const Teuchos::RCP<Epetra_MultiVector>& inCoords = Teuchos::null,
const Teuchos::RCP<Epetra_MultiVector>& inNullspace = Teuchos::null)
{
Teuchos::ParameterList paramList;
Teuchos::updateParametersFromXmlFileAndBroadcast(xmlFileName, Teuchos::Ptr<Teuchos::ParameterList>(¶mList), *Xpetra::toXpetra(A->Comm()));
return CreateEpetraPreconditioner(A, paramList, inCoords, inNullspace);
}
void ReuseEpetraPreconditioner(const Teuchos::RCP<Epetra_CrsMatrix>& inA, MueLu::EpetraOperator& Op) {
typedef double SC;
typedef int LO;
typedef int GO;
typedef Xpetra::EpetraNode NO;
typedef Xpetra::Matrix<SC,LO,GO,NO> Matrix;
typedef MueLu ::Hierarchy<SC,LO,GO,NO> Hierarchy;
RCP<Hierarchy> H = Op.GetHierarchy();
RCP<Matrix> A = EpetraCrs_To_XpetraMatrix<SC,LO,GO,NO>(inA);
MueLu::ReuseXpetraPreconditioner<SC,LO,GO,NO>(A, H);
}
} //namespace
#endif // HAVE_MUELU_SERIAL and HAVE_MUELU_EPETRA
#endif //ifndef MUELU_CREATE_EPETRA_PRECONDITIONER_HPP
|