Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit fd6f86ee authored by frey_m's avatar frey_m
Browse files

AMR-Test: Fix compiler errors with MueLuBottomSolver

parent 4b6c181a
No related branches found
No related tags found
No related merge requests found
#include "MueLuBottomSolver.h"
MueLuBottomSolver::MueLuBottomSolver()
: conv_m(1.0e-4)
: A_mp(Teuchos::null),
tolerance_m(1.0e-4)
{
hierarchy_mp = rcp(new hierarchy_t());
......@@ -24,19 +24,32 @@ MueLuBottomSolver::MueLuBottomSolver()
void MueLuBottomSolver::solve(const Teuchos::RCP<mv_t>& x,
const Teuchos::RCP<mv_t>& b)
{
// MueLu requires Xpetra multivectors (wrap them)
Teuchos::RCP<xmv_t> xx = MueLu::TpetraMultiVector_To_XpetraMultiVector(x);
Teuchos::RCP<xmv_t> xb = MueLu::TpetraMultiVector_To_XpetraMultiVector(b);
// InitialGuessIsZero = false
// startLevel = 0
hierarchy_mp->Iterate(*b, *x, conv_m, false, 0);
MueLu::ReturnType rtype = hierarchy_mp->Iterate(*xb, *xx, tolerance_m, false, 0);
if ( rtype != MueLu::ReturnType::Converged )
std::cout << "not converged" << std::endl;
// put multivector back
x->assign(*util_t::MV2NonConstTpetraMV2(*xx));
}
void MueLuBottomSolver::setOperator(const Teuchos::RCP<matrix_t>& A) {
finest_mp->Set("A", A);
Teuchos::RCP<mv_t> nullspace = MultiVectorFactory::Build(map, 1);
nullspace->putScalar(one);
finest_mp->Set("Nullspace", nullspace);
// finest_mp->Set("Coordinates", coordinates)
A_mp = MueLu::TpetraCrs_To_XpetraMatrix<scalar_t, lo_t, go_t, node_t>(A);
A_mp->SetFixedBlockSize(1); // only 1 DOF per node (pure Laplace problem)
finest_mp->Set("A", A_mp);
Teuchos::RCP<mv_t> nullspace = Teuchos::rcp(new mv_t(A->getRowMap(), 1));
Teuchos::RCP<xmv_t> xnullspace = MueLu::TpetraMultiVector_To_XpetraMultiVector(nullspace);
nullspace->putScalar(1.0);
finest_mp->Set("Nullspace", xnullspace);
//finest_mp->Set("Coordinates", coordinates)
}
......
......@@ -5,6 +5,7 @@
#include <MueLu.hpp>
#include <MueLu_Level.hpp>
#include <MueLu_Utilities.hpp>
class MueLuBottomSolver : public BottomSolver<Teuchos::RCP<amr::matrix_t>,
Teuchos::RCP<amr::multivector_t> >
......@@ -21,6 +22,9 @@ public:
typedef MueLu::Hierarchy<scalar_t, lo_t, go_t, node_t> hierarchy_t;
typedef MueLu::Level level_t;
typedef Xpetra::Matrix<scalar_t, lo_t, go_t, node_t> xmatrix_t;
typedef Xpetra::MultiVector<scalar_t, lo_t, go_t, node_t> xmv_t;
typedef MueLu::Utilities<scalar_t, lo_t, go_t, node_t> util_t;
public:
......@@ -34,12 +38,14 @@ public:
std::size_t getNumIters();
private::
private:
Teuchos::RCP<hierarchy_t> hierarchy_mp; ///< manages the multigrid hierarchy
Teuchos:RCP<level_t> finest_mp; ///< finest level of hierarchy
hierarchy_t::ConvData conv_m; ///< stopping criteria of multigrid iteration
Teuchos::RCP<level_t> finest_mp; ///< finest level of hierarchy
Teuchos::RCP<xmatrix_t> A_mp; ///< MueLu requires Xpetra
scalar_t tolerance_m; ///< stopping criteria of multigrid iteration
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment