55 typedef Thyra::ModelEvaluatorBase MEB;
65 RCP<Simple2DTpetraModelEvaluator<Scalar> > model = simple2DTpetraModelEvaluator<Scalar>();
76 MEB::InArgs<Scalar> inArgs = model->createInArgs();
81 #if !defined(HAVE_TPETRA_EXPLICIT_INSTANTIATION) || defined(HAVE_TPETRA_INST_DOUBLE)
86 #if !defined(HAVE_TPETRA_EXPLICIT_INSTANTIATION) || defined(HAVE_TPETRA_INST_FLOAT)
94 using Thyra::LinearOpBase;
95 using Thyra::VectorBase;
99 using Teuchos::rcp_dynamic_cast;
100 using Teuchos::tuple;
102 typedef Tpetra::Map<>::local_ordinal_type LO;
104 typedef typename ST::magnitudeType ScalarMag;
107 RCP<Simple2DTpetraModelEvaluator<Scalar> > model = simple2DTpetraModelEvaluator<Scalar>();
109 const Scalar d = 7.0;
112 const Scalar p_0 = 2.0, p_1 = 6.0;
113 model->set_p(tuple<Scalar>(p_0, p_1));
115 const Scalar x_0 = 3.0, x_1 = 4.0;
116 model->set_x0(tuple<Scalar>(x_0, x_1));
118 MEB::InArgs<Scalar> inArgs = model->getNominalValues();
119 MEB::OutArgs<Scalar> outArgs = model->createOutArgs();
120 const RCP<VectorBase<Scalar> >
f = createMember(model->get_f_space());
121 const RCP<LinearOpBase<Scalar> > W_op = model->create_W_op();
123 outArgs.set_W_op(W_op);
124 model->evalModel(inArgs, outArgs);
126 const ScalarMag tol = 100.0 * SMT::eps();
128 const RCP<const Tpetra::Vector<Scalar> > f_tpetra =
129 ConverterT::getConstTpetraVector(f);
131 const ArrayRCP<const Scalar> f_tpetra_vals = f_tpetra->get1dView();
135 const RCP<const Tpetra::CrsMatrix<Scalar> > W_tpetra =
136 rcp_dynamic_cast<Tpetra::CrsMatrix<Scalar> >(
137 ConverterT::getTpetraOperator(W_op));
139 ArrayView<const LO> row_indices;
140 ArrayView<const Scalar> row_values;
142 W_tpetra->getLocalRowView(0, row_indices, row_values);
151 W_tpetra->getLocalRowView(1, row_indices, row_values);
159 #if !defined(HAVE_TPETRA_EXPLICIT_INSTANTIATION) || defined(HAVE_TPETRA_INST_DOUBLE)
164 #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)