20 typedef Thyra::ModelEvaluatorBase MEB;
30 RCP<Simple2DTpetraModelEvaluator<Scalar> > model = simple2DTpetraModelEvaluator<Scalar>();
41 MEB::InArgs<Scalar> inArgs = model->createInArgs();
46 #if !defined(HAVE_TPETRA_EXPLICIT_INSTANTIATION) || defined(HAVE_TPETRA_INST_DOUBLE)
51 #if !defined(HAVE_TPETRA_EXPLICIT_INSTANTIATION) || defined(HAVE_TPETRA_INST_FLOAT)
59 using Thyra::LinearOpBase;
60 using Thyra::VectorBase;
64 using Teuchos::rcp_dynamic_cast;
67 typedef Tpetra::Map<>::local_ordinal_type LO;
69 typedef typename ST::magnitudeType ScalarMag;
72 RCP<Simple2DTpetraModelEvaluator<Scalar> > model = simple2DTpetraModelEvaluator<Scalar>();
77 const Scalar p_0 = 2.0, p_1 = 6.0;
78 model->set_p(tuple<Scalar>(p_0, p_1));
80 const Scalar x_0 = 3.0, x_1 = 4.0;
81 model->set_x0(tuple<Scalar>(x_0, x_1));
83 MEB::InArgs<Scalar> inArgs = model->getNominalValues();
84 MEB::OutArgs<Scalar> outArgs = model->createOutArgs();
85 const RCP<VectorBase<Scalar> >
f = createMember(model->get_f_space());
86 const RCP<LinearOpBase<Scalar> > W_op = model->create_W_op();
88 outArgs.set_W_op(W_op);
89 model->evalModel(inArgs, outArgs);
91 const ScalarMag tol = 100.0 * SMT::eps();
93 const RCP<const Tpetra::Vector<Scalar> > f_tpetra =
94 ConverterT::getConstTpetraVector(f);
96 const ArrayRCP<const Scalar> f_tpetra_vals = f_tpetra->get1dView();
100 const RCP<const Tpetra::CrsMatrix<Scalar> > W_tpetra =
101 rcp_dynamic_cast<Tpetra::CrsMatrix<Scalar> >(
102 ConverterT::getTpetraOperator(W_op));
103 using crs_t = Tpetra::CrsMatrix<Scalar>;
104 typename crs_t::local_inds_host_view_type row_indices;
105 typename crs_t::values_host_view_type row_values;
107 W_tpetra->getLocalRowView(0, row_indices, row_values);
116 W_tpetra->getLocalRowView(1, row_indices, row_values);
124 #if !defined(HAVE_TPETRA_EXPLICIT_INSTANTIATION) || defined(HAVE_TPETRA_INST_DOUBLE)
129 #if !defined(HAVE_TPETRA_EXPLICIT_INSTANTIATION) || defined(HAVE_TPETRA_INST_FLOAT)
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_FLOAT(TEST_GROUP, TEST_NAME)
TypeTo as(const TypeFrom &t)
#define TEST_FLOATING_EQUALITY(v1, v2, tol)
bool nonnull(const boost::shared_ptr< T > &p)
Simple 2d simulation only ModelEvaluator for f(x) = 0 using Tpetra objects.
TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL(TpetraThyraWrappers, convertTpetraToThyraComm, Scalar)
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_DOUBLE(TEST_GROUP, TEST_NAME)
#define TEST_EQUALITY(v1, v2)