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;
27 template <
typename lno_t,
typename gno_t,
typename scalar_t>
31 if (comm->getRank() == 0){
32 cout <<
"Create matrix with " << problemType;
33 cout <<
" (and " << xdim;
35 cout <<
" x " << ydim <<
" x " << zdim <<
" ";
37 cout <<
" x" << ydim <<
" x 1 ";
40 cout <<
" mesh)" << endl;
42 cout <<
"Template Type Sizes: " << endl
43 <<
" sizeof(lno_t) = " <<
sizeof(lno_t) <<
" " << endl
44 <<
" sizeof(gno_t) = " <<
sizeof(gno_t) <<
" " << endl
45 <<
" sizeof(scalar_t) = " <<
sizeof(scalar_t) << endl;
49 Galeri::Xpetra::Parameters<gno_t> params(tclp, xdim, ydim, zdim, problemType);
51 if (comm->getRank() == 0) cout <<
"BUILD MAP" << endl;
53 rcp(
new Tpetra::Map<lno_t, gno_t>(
54 params.GetNumGlobalElements(), 0, comm));
56 if (comm->getRank() == 0) cout <<
"BUILD MATRIX" << endl;
61 Tpetra::CrsMatrix<scalar_t, lno_t, gno_t>,
62 Tpetra::MultiVector<scalar_t, lno_t, gno_t> > > Pr=
63 Galeri::Xpetra::BuildProblem<scalar_t, lno_t, gno_t,
64 Tpetra::Map<lno_t, gno_t>,
65 Tpetra::CrsMatrix<scalar_t, lno_t, gno_t>,
66 Tpetra::MultiVector<scalar_t, lno_t, gno_t> >
67 (params.GetMatrixType(), map, params.GetParameterList());
68 if (comm->getRank() == 0)
69 cout <<
"AFTER GALERI BuildProblem M_=" << M_ << endl;
71 M_ = Pr->BuildMatrix();
72 if (comm->getRank() == 0)
73 cout <<
"AFTER GALERI BuildMatrix M_=" << M_ << endl;
75 catch (std::exception &e) {
76 cout <<
"Error returned from Galeri " << e.what() << endl;
85 int main(
int narg,
char **arg)
89 Tpetra::ScopeGuard mpiSession(&narg, &arg);
92 if (comm->getRank() == 0) cout <<
"TESTING WITH scalar_t == DOUBLE" << endl;
93 ierr = buildCrsMatrix<int, long, double>(10, 10, 10, std::string(
"Laplace3D"), comm);
94 if (comm->getRank() == 0 && !ierr)
95 cout <<
"SUCCESS for scalar_t == DOUBLE" << endl << endl << endl;
97 if (comm->getRank() == 0) cout <<
"TESTING WITH scalar_t == FLOAT" << endl;
98 jerr = buildCrsMatrix<int, long, float>(10, 10, 10, std::string(
"Laplace3D"), comm);
99 if (comm->getRank() == 0 && !jerr)
100 cout <<
"SUCCESS for scalar_t == FLOAT" << endl << endl << 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[])