2#include <Thyra_ModelEvaluator.hpp>
3#include <Teuchos_Assert.hpp>
10 for (
int p = 0; p < me.Np(); ++p) {
11 auto p_names = me.get_p_names(p);
12 for (Teuchos::Ordinal p_sub=0; p_sub < p_names->size(); ++p_sub) {
13 if ((*p_names)[p_sub] == p_name) {
23 TEUCHOS_TEST_FOR_EXCEPTION( (!found and throw_if_not_found), std::runtime_error,
24 "ERROR: the parameter \"" << p_name <<
"\" is not a valid parameter name in the model evaluator!");
26 return {index,sub_index};
34 for (
int g = 0; g < me.Ng(); ++g) {
35 auto g_names = me.get_g_names(g);
36 for (Teuchos::Ordinal g_sub=0; g_sub < g_names.size(); ++g_sub) {
37 std::cout <<
"g(" << g <<
"," << g_sub <<
")=" << g_names[g_sub] << std::endl;
38 if (g_names[g_sub] == g_name) {
48 TEUCHOS_TEST_FOR_EXCEPTION( (!found and throw_if_not_found), std::runtime_error,
49 "ERROR: the response \"" << g_name <<
"\" is not a valid response name in the model evaluator!");
51 return {index,sub_index};
std::tuple< int, int > findParameterIndex(const std::string &p_name, const Thyra::ModelEvaluator< double > &me, const bool &throw_if_not_found=true)
Given a parameter name and a ModelEvaluator, returns the index and subindex of the parameter in the M...
std::tuple< int, int > findResponseIndex(const std::string &g_name, const Thyra::ModelEvaluator< double > &me, const bool &throw_if_not_found=true)
Given a response name and a ModelEvaluator, returns the index and subindex of the response in the Mod...