75 (*p_names)[0] =
"alpha";
80 indices[0] = 0; indices[1] = 1;
109 "Error! SimpleME::get_p_map(): " <<
110 "Invalid parameter index l = " << l << std::endl);
121 "Error! SimpleME::get_p_names(): " <<
122 "Invalid parameter index l = " << l << std::endl);
139 "Error! SimpleME::get_p_init(): " <<
140 "Invalid parameter index l = " << l << std::endl);
155 EpetraExt::ModelEvaluator::InArgs
159 inArgs.setModelEvalDescription(
"Simple Model Evaluator");
162 inArgs.setSupports(IN_ARG_x,
true);
166 inArgs.setSupports(IN_ARG_x_sg,
true);
167 inArgs.setSupports(IN_ARG_p_sg, 0,
true);
168 inArgs.setSupports(IN_ARG_sg_basis,
true);
169 inArgs.setSupports(IN_ARG_sg_quadrature,
true);
170 inArgs.setSupports(IN_ARG_sg_expansion,
true);
175 EpetraExt::ModelEvaluator::OutArgs
178 OutArgsSetup outArgs;
179 outArgs.setModelEvalDescription(
"Simple Model Evaluator");
182 outArgs.set_Np_Ng(1, 0);
183 outArgs.setSupports(OUT_ARG_f,
true);
184 outArgs.setSupports(OUT_ARG_W,
true);
187 outArgs.setSupports(OUT_ARG_f_sg,
true);
188 outArgs.setSupports(OUT_ARG_W_sg,
true);
204 double x0 = (*x_overlapped)[0];
205 double x1 = (*x_overlapped)[1];
240 int indices[2] = { 0, 1 };
243 values[0] = -1.0; values[1] = 0.0;
247 values[0] = -1.0; values[1] = 2.0*x1;
258 inArgs.get_sg_basis();
260 inArgs.get_sg_expansion();
263 InArgs::sg_const_vector_t x_sg = inArgs.get_x_sg();
266 for (
int i=0; i<basis->size(); i++) {
268 x0_sg[i] = (*x_overlapped)[0];
269 x1_sg[i] = (*x_overlapped)[1];
274 InArgs::sg_const_vector_t p_sg = inArgs.get_p_sg(0);
277 for (
int i=0; i<basis->size(); i++) {
278 a_sg[i] = (*p_sg)[i][0];
285 OutArgs::sg_vector_t f_sg = outArgs.get_f_sg();
291 expn->times(tmp0_sg, a_sg, a_sg);
292 expn->minus(tmp1_sg, tmp0_sg, x0_sg);
293 for (
int i=0; i<basis->size(); i++)
294 (*f_sg)[i].ReplaceGlobalValues(1, &tmp1_sg[i], &row);
298 expn->times(tmp0_sg, x1_sg, x1_sg);
299 expn->minus(tmp1_sg, tmp0_sg, x0_sg);
300 for (
int i=0; i<basis->size(); i++)
301 (*f_sg)[i].ReplaceGlobalValues(1, &tmp1_sg[i], &row);
308 OutArgs::sg_operator_t W_sg = outArgs.get_W_sg();
310 for (
int i=0; i<basis->size(); i++) {
313 int indices[2] = { 0, 1 };
328 values[1] = 2.0*x1_sg[i];
Teuchos::RCP< const Epetra_Vector > get_x_init() const
Return initial solution.
Teuchos::RCP< Epetra_Vector > x_init
Initial guess.
Teuchos::RCP< const Epetra_Map > get_f_map() const
Return residual vector map.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
SimpleME(const Teuchos::RCP< const Epetra_Comm > &comm)
Constructor.
Teuchos::RCP< const Epetra_Map > get_x_map() const
Return solution vector map.
Teuchos::RCP< Epetra_Vector > p_init
Initial parameters.
InArgs createInArgs() const
Create InArgs.
Teuchos::RCP< Epetra_Vector > x_overlapped
Overlapped solution vector.
Teuchos::RCP< Epetra_Map > x_map
Solution vector map.
int InsertGlobalIndices(int_type GlobalRow, int NumIndices, int_type *Indices)
int FillComplete(bool OptimizeDataStorage=true)
int ReplaceGlobalValues(int NumEntries, const double *Values, const int *Indices)
void evalModel(const InArgs &inArgs, const OutArgs &outArgs) const
Evaluate model on InArgs.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::RCP< Epetra_Map > p_map
Parameter vector map.
bool MyGID(int GID_in) const
Teuchos::RCP< Teuchos::Array< std::string > > p_names
Parameter names.
Teuchos::RCP< Epetra_CrsGraph > graph
Jacobian graph.
ScalarType f(const Teuchos::Array< ScalarType > &x, double a, double b)
Teuchos::RCP< const Epetra_Map > get_p_map(int l) const
Return parameter vector map.
Teuchos::RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
Return array of parameter names.
Teuchos::RCP< Epetra_Import > importer
Importer to overlapped distribution.
virtual int ReplaceGlobalValues(int GlobalRow, int NumEntries, const double *Values, const int *Indices)
OutArgs createOutArgs() const
Create OutArgs.
Teuchos::RCP< Epetra_Operator > create_W() const
Create W = alpha*M + beta*J matrix.
Teuchos::RCP< Epetra_Map > x_overlapped_map
Overlapped solution vector map.
Teuchos::RCP< const Epetra_Vector > get_p_init(int l) const
Return initial parameters.