Thyra
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
core
src
support
nonlinear
model_evaluator
client_support
Thyra_ResponseOnlyModelEvaluatorBase.hpp
1
// @HEADER
2
// *****************************************************************************
3
// Thyra: Interfaces and Support for Abstract Numerical Algorithms
4
//
5
// Copyright 2004 NTESS and the Thyra contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef THYRA_RESPONSE_ONLY_MODEL_EVALUATOR_BASE_HPP
11
#define THYRA_RESPONSE_ONLY_MODEL_EVALUATOR_BASE_HPP
12
13
14
#include "Thyra_ModelEvaluatorDefaultBase.hpp"
15
#include "Teuchos_Assert.hpp"
16
17
18
namespace
Thyra {
19
20
31
template
<
class
Scalar>
32
class
ResponseOnlyModelEvaluatorBase
:
virtual
public
ModelEvaluatorDefaultBase
<Scalar> {
33
public
:
34
37
39
RCP<const VectorSpaceBase<Scalar>
>
get_x_space
()
const
;
41
RCP<const Teuchos::Array<std::string>
>
get_p_names
(
int
l)
const
;
43
Teuchos::ArrayView<const std::string>
get_g_names
(
int
j)
const
;
45
RCP<const VectorSpaceBase<Scalar>
>
get_f_space
()
const
;
47
ModelEvaluatorBase::InArgs<Scalar>
getNominalValues
()
const
;
49
ModelEvaluatorBase::InArgs<Scalar>
getLowerBounds
()
const
;
51
ModelEvaluatorBase::InArgs<Scalar>
getUpperBounds
()
const
;
53
RCP<LinearOpWithSolveBase<Scalar>
>
create_W
()
const
;
55
RCP<LinearOpBase<Scalar>
>
create_W_op
()
const
;
57
RCP<PreconditionerBase<Scalar>
>
create_W_prec
()
const
;
59
RCP<const LinearOpWithSolveFactoryBase<Scalar>
>
get_W_factory
()
const
;
61
void
reportFinalPoint
(
62
const
ModelEvaluatorBase::InArgs<Scalar>
&finalPoint,
63
const
bool
wasSolved
64
);
65
67
68
};
69
70
71
// /////////////////////////////////
72
// Implementations
73
74
75
// Public functions overridden from ModelEvaulator
76
77
78
template
<
class
Scalar>
79
RCP<const VectorSpaceBase<Scalar>
>
80
ResponseOnlyModelEvaluatorBase<Scalar>::get_x_space
()
const
81
{
82
return
Teuchos::null;
83
}
84
85
86
template
<
class
Scalar>
87
RCP<const Teuchos::Array<std::string>
>
88
ResponseOnlyModelEvaluatorBase<Scalar>::get_p_names
(
int
l)
const
89
{
90
#ifdef TEUCHOS_DEBUG
91
TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE
( l, 0, this->
Np
() );
92
#else
93
(void)l;
94
#endif
95
return
Teuchos::null;
96
}
97
98
99
template
<
class
Scalar>
100
Teuchos::ArrayView<const std::string>
101
ResponseOnlyModelEvaluatorBase<Scalar>::get_g_names
(
int
j)
const
102
{
103
#ifdef TEUCHOS_DEBUG
104
TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE
( j, 0, this->
Ng
() );
105
#else
106
(void)j;
107
#endif
108
return
Teuchos::ArrayView<const std::string>
(Teuchos::null);
109
}
110
111
template
<
class
Scalar>
112
RCP<const VectorSpaceBase<Scalar>
>
113
ResponseOnlyModelEvaluatorBase<Scalar>::get_f_space
()
const
114
{
115
return
Teuchos::null;
116
}
117
118
119
template
<
class
Scalar>
120
ModelEvaluatorBase::InArgs<Scalar>
121
ResponseOnlyModelEvaluatorBase<Scalar>::getNominalValues
()
const
122
{
return
this->
createInArgs
(); }
123
124
125
template
<
class
Scalar>
126
ModelEvaluatorBase::InArgs<Scalar>
127
ResponseOnlyModelEvaluatorBase<Scalar>::getLowerBounds
()
const
128
{
return
this->
createInArgs
(); }
129
130
131
template
<
class
Scalar>
132
ModelEvaluatorBase::InArgs<Scalar>
133
ResponseOnlyModelEvaluatorBase<Scalar>::getUpperBounds
()
const
134
{
return
this->
createInArgs
(); }
135
136
137
template
<
class
Scalar>
138
RCP<LinearOpWithSolveBase<Scalar>
>
139
ResponseOnlyModelEvaluatorBase<Scalar>::create_W
()
const
140
{
141
TEUCHOS_TEST_FOR_EXCEPTION
(
142
true
, std::logic_error
143
,
"Error, if \'W\' is supported by the ModelEvaluator subclass then"
144
" this function create_W() may be overridden by the subclass to return"
145
" a non-null object!"
146
);
147
TEUCHOS_UNREACHABLE_RETURN
(Teuchos::null);
148
}
149
150
151
template
<
class
Scalar>
152
RCP<LinearOpBase<Scalar>
>
153
ResponseOnlyModelEvaluatorBase<Scalar>::create_W_op
()
const
154
{
155
TEUCHOS_TEST_FOR_EXCEPTION
(
156
true
, std::logic_error,
157
"Error, if \'W\' is supported by the ModelEvaluator subclass then"
158
" this function create_W_op() may be overridden by the subclass "
159
<<this->
description
()<<
" to return a non-null object!"
160
);
161
TEUCHOS_UNREACHABLE_RETURN
(Teuchos::null);
162
}
163
164
165
template
<
class
Scalar>
166
RCP<PreconditionerBase<Scalar>
>
167
ResponseOnlyModelEvaluatorBase<Scalar>::create_W_prec
()
const
168
{
169
TEUCHOS_TEST_FOR_EXCEPTION
(
170
true
, std::logic_error,
171
"Error, if \'W\' is supported by the ModelEvaluator subclass then"
172
" this function create_W_prec() may be overridden by the subclass "
173
<<this->
description
()<<
" to return a non-null object!"
174
);
175
TEUCHOS_UNREACHABLE_RETURN
(Teuchos::null);
176
}
177
178
179
template
<
class
Scalar>
180
RCP<const LinearOpWithSolveFactoryBase<Scalar>
>
181
ResponseOnlyModelEvaluatorBase<Scalar>::get_W_factory
()
const
182
{
183
TEUCHOS_TEST_FOR_EXCEPTION
(
184
true
, std::logic_error
185
,
"Error, if \'W\' is supported by the ModelEvaluator subclass then"
186
" this function get_W_factory() may be overridden by the subclass "
187
<<this->
description
()<<
" to return a non-null object!"
188
);
189
TEUCHOS_UNREACHABLE_RETURN
(Teuchos::null);
190
}
191
192
193
template
<
class
Scalar>
194
void
ResponseOnlyModelEvaluatorBase<Scalar>::reportFinalPoint
(
195
const
ModelEvaluatorBase::InArgs<Scalar>
&
/* finalPoint */
,
196
const
bool
/* wasSolved */
197
)
198
{
199
// This final point is just ignored by default!
200
}
201
202
203
}
// namespace Thyra
204
205
206
#endif
// THYRA_RESPONSE_ONLY_MODEL_EVALUATOR_BASE_HPP
Teuchos::ArrayView
Teuchos::Describable::description
virtual std::string description() const
Teuchos::RCP
Thyra::ModelEvaluatorBase::InArgs
Concrete aggregate class for all input arguments computable by a ModelEvaluator subclass object.
Definition
Thyra_ModelEvaluatorBase_decl.hpp:127
Thyra::ModelEvaluatorDefaultBase::ModelEvaluatorDefaultBase
ModelEvaluatorDefaultBase()
Definition
Thyra_ModelEvaluatorDefaultBase.hpp:1004
Thyra::ModelEvaluatorDefaultBase::Ng
int Ng() const
Definition
Thyra_ModelEvaluatorDefaultBase.hpp:380
Thyra::ModelEvaluatorDefaultBase::Np
int Np() const
Definition
Thyra_ModelEvaluatorDefaultBase.hpp:372
Thyra::ModelEvaluator::createInArgs
virtual ModelEvaluatorBase::InArgs< Scalar > createInArgs() const =0
Create an empty input arguments object that can be set up and passed to evalModel().
Thyra::ResponseOnlyModelEvaluatorBase
This base class defines default function implementations appropritate for a response-only model evalu...
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:32
Thyra::ResponseOnlyModelEvaluatorBase::getUpperBounds
ModelEvaluatorBase::InArgs< Scalar > getUpperBounds() const
Returns this->createInArgs().
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:133
Thyra::ResponseOnlyModelEvaluatorBase::get_x_space
RCP< const VectorSpaceBase< Scalar > > get_x_space() const
Throws exception.
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:80
Thyra::ResponseOnlyModelEvaluatorBase::reportFinalPoint
void reportFinalPoint(const ModelEvaluatorBase::InArgs< Scalar > &finalPoint, const bool wasSolved)
Does nothing and ignores input.
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:194
Thyra::ResponseOnlyModelEvaluatorBase::create_W
RCP< LinearOpWithSolveBase< Scalar > > create_W() const
Thorws exception.
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:139
Thyra::ResponseOnlyModelEvaluatorBase::get_W_factory
RCP< const LinearOpWithSolveFactoryBase< Scalar > > get_W_factory() const
Thorws exception.
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:181
Thyra::ResponseOnlyModelEvaluatorBase::create_W_op
RCP< LinearOpBase< Scalar > > create_W_op() const
Thorws exception.
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:153
Thyra::ResponseOnlyModelEvaluatorBase::get_p_names
RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
Returns null.
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:88
Thyra::ResponseOnlyModelEvaluatorBase::get_f_space
RCP< const VectorSpaceBase< Scalar > > get_f_space() const
Throws exception.
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:113
Thyra::ResponseOnlyModelEvaluatorBase::getLowerBounds
ModelEvaluatorBase::InArgs< Scalar > getLowerBounds() const
Returns this->createInArgs().
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:127
Thyra::ResponseOnlyModelEvaluatorBase::create_W_prec
RCP< PreconditionerBase< Scalar > > create_W_prec() const
Thorws exception.
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:167
Thyra::ResponseOnlyModelEvaluatorBase::get_g_names
Teuchos::ArrayView< const std::string > get_g_names(int j) const
Returns null.
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:101
Thyra::ResponseOnlyModelEvaluatorBase::getNominalValues
ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
Returns this->createInArgs().
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:121
TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE
#define TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE(index, lower_inclusive, upper_exclusive)
TEUCHOS_TEST_FOR_EXCEPTION
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
TEUCHOS_UNREACHABLE_RETURN
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
Generated by
1.17.0