10 #include "Galeri_XpetraMaps.hpp"
11 #include "Galeri_MatrixTraits.hpp"
12 #include "Galeri_XpetraMatrixTypes.hpp"
13 #include "Galeri_XpetraProblemFactory.hpp"
18 #ifndef GALERI_TEST_USE_LONGLONG_GO
25 #define Node Tpetra::KokkosClassic::DefaultNode::DefaultNodeType
27 using namespace Galeri;
29 int main(
int argc,
char* argv[])
34 typedef Tpetra::Map<LO, GO, Node> Tpetra_Map;
35 typedef Tpetra::CrsMatrix<Scalar, LO, GO, Node> Tpetra_CrsMatrix;
36 typedef Tpetra::MultiVector<Scalar, LO, GO, Node> Tpetra_MultiVector;
40 MPI_Init(&argc, &argv);
52 std::string mapType =
"Cartesian2D";
55 mapParameters.set(
"nx", 10 * comm->getSize());
56 mapParameters.set(
"ny", 10);
58 mapParameters.set(
"mx", comm->getSize());
59 mapParameters.set(
"my", 1);
61 auto out = Teuchos::getFancyOStream(Teuchos::rcpFromRef(std::cout));
66 auto map = RCP{Galeri::Xpetra::CreateMap<Scalar, GO, Tpetra_Map>(mapType, comm, mapParameters)};
69 auto problem = Galeri::Xpetra::BuildProblem<Scalar, LO, GO, Tpetra_Map, Tpetra_CrsMatrix, Tpetra_MultiVector>(
"Laplace2D", map, mapParameters);
72 auto matrix = problem->BuildMatrix();
73 auto LHS =
rcp(
new Tpetra_MultiVector(matrix->getDomainMap(), 1));
74 auto RHS =
rcp(
new Tpetra_MultiVector(matrix->getRangeMap(), 1));
75 auto ExactSolution =
rcp(
new Tpetra_MultiVector(matrix->getDomainMap(), 1));
77 ExactSolution->randomize(0, 100);
78 LHS->putScalar(ScalarTraits::zero());
80 matrix->apply(*ExactSolution, *RHS);
82 matrix->describe(*out, Teuchos::EVerbosityLevel::VERB_EXTREME);
83 LHS->describe(*out, Teuchos::EVerbosityLevel::VERB_EXTREME);
84 RHS->describe(*out, Teuchos::EVerbosityLevel::VERB_EXTREME);
85 ExactSolution->describe(*out, Teuchos::EVerbosityLevel::VERB_EXTREME);
89 catch (Galeri::Exception &rhs)
91 if (comm->getRank() == 0)
93 cerr <<
"Caught exception: ";
99 return (EXIT_FAILURE);
107 return (EXIT_SUCCESS);
static Teuchos::RCP< const Comm< OrdinalType > > getComm()
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
int main(int argc, char *argv[])