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[]) {
33 typedef Tpetra::Map<LO, GO, Node> Tpetra_Map;
34 typedef Tpetra::CrsMatrix<Scalar, LO, GO, Node> Tpetra_CrsMatrix;
35 typedef Tpetra::MultiVector<Scalar, LO, GO, Node> Tpetra_MultiVector;
39 MPI_Init(&argc, &argv);
51 std::string mapType =
"Cartesian2D";
54 mapParameters.set(
"nx", 10 * comm->getSize());
55 mapParameters.set(
"ny", 10);
57 mapParameters.set(
"mx", comm->getSize());
58 mapParameters.set(
"my", 1);
60 auto out = Teuchos::getFancyOStream(Teuchos::rcpFromRef(std::cout));
64 auto map = RCP{Galeri::Xpetra::CreateMap<Scalar, GO, Tpetra_Map>(mapType, comm, mapParameters)};
67 auto problem = Galeri::Xpetra::BuildProblem<Scalar, LO, GO, Tpetra_Map, Tpetra_CrsMatrix, Tpetra_MultiVector>(
"Laplace2D", map, mapParameters);
70 auto matrix = problem->BuildMatrix();
71 auto LHS =
rcp(
new Tpetra_MultiVector(matrix->getDomainMap(), 1));
72 auto RHS =
rcp(
new Tpetra_MultiVector(matrix->getRangeMap(), 1));
73 auto ExactSolution =
rcp(
new Tpetra_MultiVector(matrix->getDomainMap(), 1));
75 ExactSolution->randomize(0, 100);
76 LHS->putScalar(ScalarTraits::zero());
78 matrix->apply(*ExactSolution, *RHS);
80 matrix->describe(*out, Teuchos::EVerbosityLevel::VERB_EXTREME);
81 LHS->describe(*out, Teuchos::EVerbosityLevel::VERB_EXTREME);
82 RHS->describe(*out, Teuchos::EVerbosityLevel::VERB_EXTREME);
83 ExactSolution->describe(*out, Teuchos::EVerbosityLevel::VERB_EXTREME);
86 }
catch (Galeri::Exception& rhs) {
87 if (comm->getRank() == 0) {
88 cerr <<
"Caught exception: ";
94 return (EXIT_FAILURE);
102 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[])