42 #include "Galeri_XpetraMaps.hpp"
43 #include "Galeri_MatrixTraits.hpp"
44 #include "Galeri_XpetraMatrixTypes.hpp"
45 #include "Galeri_XpetraProblemFactory.hpp"
50 #ifndef GALERI_TEST_USE_LONGLONG_GO
57 #define Node Tpetra::KokkosClassic::DefaultNode::DefaultNodeType
59 using namespace Galeri;
61 int main(
int argc,
char* argv[])
66 typedef Tpetra::Map<LO, GO, Node> Tpetra_Map;
67 typedef Tpetra::CrsMatrix<Scalar, LO, GO, Node> Tpetra_CrsMatrix;
68 typedef Tpetra::MultiVector<Scalar, LO, GO, Node> Tpetra_MultiVector;
72 MPI_Init(&argc, &argv);
84 std::string mapType =
"Cartesian2D";
87 mapParameters.set(
"nx", 10 * comm->getSize());
88 mapParameters.set(
"ny", 10);
90 mapParameters.set(
"mx", comm->getSize());
91 mapParameters.set(
"my", 1);
93 auto out = Teuchos::getFancyOStream(Teuchos::rcpFromRef(std::cout));
98 auto map = RCP{Galeri::Xpetra::CreateMap<Scalar, GO, Tpetra_Map>(mapType, comm, mapParameters)};
101 auto problem = Galeri::Xpetra::BuildProblem<Scalar, LO, GO, Tpetra_Map, Tpetra_CrsMatrix, Tpetra_MultiVector>(
"Laplace2D", map, mapParameters);
104 auto matrix = problem->BuildMatrix();
105 auto LHS =
rcp(
new Tpetra_MultiVector(matrix->getDomainMap(), 1));
106 auto RHS =
rcp(
new Tpetra_MultiVector(matrix->getRangeMap(), 1));
107 auto ExactSolution =
rcp(
new Tpetra_MultiVector(matrix->getDomainMap(), 1));
109 ExactSolution->randomize(0, 100);
110 LHS->putScalar(ScalarTraits::zero());
112 matrix->apply(*ExactSolution, *RHS);
114 matrix->describe(*out, Teuchos::EVerbosityLevel::VERB_EXTREME);
115 LHS->describe(*out, Teuchos::EVerbosityLevel::VERB_EXTREME);
116 RHS->describe(*out, Teuchos::EVerbosityLevel::VERB_EXTREME);
117 ExactSolution->describe(*out, Teuchos::EVerbosityLevel::VERB_EXTREME);
121 catch (Galeri::Exception &rhs)
123 if (comm->getRank() == 0)
125 cerr <<
"Caught exception: ";
131 return (EXIT_FAILURE);
139 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[])