10 #include <Tpetra_Core.hpp>
11 #include <Tpetra_MultiVector.hpp>
12 #include <Xpetra_Vector.hpp>
13 #include <Xpetra_CrsMatrix.hpp>
14 #include <Xpetra_CrsGraph.hpp>
16 #include <Galeri_XpetraProblemFactory.hpp>
17 #include <Galeri_XpetraParameters.hpp>
19 #include <Tpetra_KokkosCompat_DefaultNode.hpp>
24 using Teuchos::rcp_const_cast;
26 template <
typename lno_t,
typename gno_t,
typename scalar_t>
29 if (comm->getRank() == 0) {
30 cout <<
"Create matrix with " << problemType;
31 cout <<
" (and " << xdim;
33 cout <<
" x " << ydim <<
" x " << zdim <<
" ";
35 cout <<
" x" << ydim <<
" x 1 ";
38 cout <<
" mesh)" << endl;
40 cout <<
"Template Type Sizes: " << endl
41 <<
" sizeof(lno_t) = " <<
sizeof(lno_t) <<
" " << endl
42 <<
" sizeof(gno_t) = " <<
sizeof(gno_t) <<
" " << endl
43 <<
" sizeof(scalar_t) = " <<
sizeof(scalar_t) << endl;
47 Galeri::Xpetra::Parameters<gno_t> params(tclp, xdim, ydim, zdim, problemType);
49 if (comm->getRank() == 0) cout <<
"BUILD MAP" << endl;
51 rcp(
new Tpetra::Map<lno_t, gno_t>(
52 params.GetNumGlobalElements(), 0, comm));
54 if (comm->getRank() == 0) cout <<
"BUILD MATRIX" << endl;
59 Tpetra::CrsMatrix<scalar_t, lno_t, gno_t>,
60 Tpetra::MultiVector<scalar_t, lno_t, gno_t> > >
62 Galeri::Xpetra::BuildProblem<scalar_t, lno_t, gno_t,
63 Tpetra::Map<lno_t, gno_t>,
64 Tpetra::CrsMatrix<scalar_t, lno_t, gno_t>,
65 Tpetra::MultiVector<scalar_t, lno_t, gno_t> >(params.GetMatrixType(), map, params.GetParameterList());
66 if (comm->getRank() == 0)
67 cout <<
"AFTER GALERI BuildProblem M_=" << M_ << endl;
69 M_ = Pr->BuildMatrix();
70 if (comm->getRank() == 0)
71 cout <<
"AFTER GALERI BuildMatrix M_=" << M_ << endl;
72 }
catch (std::exception &e) {
73 cout <<
"Error returned from Galeri " << e.what() << endl;
82 int main(
int narg,
char **arg) {
85 Tpetra::ScopeGuard mpiSession(&narg, &arg);
88 if (comm->getRank() == 0) cout <<
"TESTING WITH scalar_t == DOUBLE" << endl;
89 ierr = buildCrsMatrix<int, long, double>(10, 10, 10, std::string(
"Laplace3D"), comm);
90 if (comm->getRank() == 0 && !ierr)
91 cout <<
"SUCCESS for scalar_t == DOUBLE" << endl
95 if (comm->getRank() == 0) cout <<
"TESTING WITH scalar_t == FLOAT" << endl;
96 jerr = buildCrsMatrix<int, long, float>(10, 10, 10, std::string(
"Laplace3D"), comm);
97 if (comm->getRank() == 0 && !jerr)
98 cout <<
"SUCCESS for scalar_t == FLOAT" << endl
103 cout <<
"FAIL: M_ was NULL for scalar_t == DOUBLE " << endl;
105 cout <<
"FAIL: M_ was NULL for scalar_t == FLOAT " << endl;
107 cout <<
"PASS" << endl;
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
bool is_null(const RCP< T > &p)
int buildCrsMatrix(int xdim, int ydim, int zdim, std::string problemType, RCP< const Teuchos::Comm< int > > &comm)
int main(int argc, char *argv[])