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
//
4
// Thyra: Interfaces and Support for Abstract Numerical Algorithms
5
// Copyright (2004) Sandia Corporation
6
//
7
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8
// license for use of this work by or on behalf of the U.S. Government.
9
//
10
// Redistribution and use in source and binary forms, with or without
11
// modification, are permitted provided that the following conditions are
12
// met:
13
//
14
// 1. Redistributions of source code must retain the above copyright
15
// notice, this list of conditions and the following disclaimer.
16
//
17
// 2. Redistributions in binary form must reproduce the above copyright
18
// notice, this list of conditions and the following disclaimer in the
19
// documentation and/or other materials provided with the distribution.
20
//
21
// 3. Neither the name of the Corporation nor the names of the
22
// contributors may be used to endorse or promote products derived from
23
// this software without specific prior written permission.
24
//
25
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
//
37
// Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov)
38
//
39
// ***********************************************************************
40
// @HEADER
41
42
#ifndef THYRA_RESPONSE_ONLY_MODEL_EVALUATOR_BASE_HPP
43
#define THYRA_RESPONSE_ONLY_MODEL_EVALUATOR_BASE_HPP
44
45
46
#include "Thyra_ModelEvaluatorDefaultBase.hpp"
47
#include "Teuchos_Assert.hpp"
48
49
50
namespace
Thyra {
51
52
63
template
<
class
Scalar>
64
class
ResponseOnlyModelEvaluatorBase
:
virtual
public
ModelEvaluatorDefaultBase
<Scalar> {
65
public
:
66
69
71
RCP<const VectorSpaceBase<Scalar>
>
get_x_space
()
const
;
73
RCP<const Teuchos::Array<std::string>
>
get_p_names
(
int
l)
const
;
75
Teuchos::ArrayView<const std::string>
get_g_names
(
int
j)
const
;
77
RCP<const VectorSpaceBase<Scalar>
>
get_f_space
()
const
;
79
ModelEvaluatorBase::InArgs<Scalar>
getNominalValues
()
const
;
81
ModelEvaluatorBase::InArgs<Scalar>
getLowerBounds
()
const
;
83
ModelEvaluatorBase::InArgs<Scalar>
getUpperBounds
()
const
;
85
RCP<LinearOpWithSolveBase<Scalar>
>
create_W
()
const
;
87
RCP<LinearOpBase<Scalar>
>
create_W_op
()
const
;
89
RCP<PreconditionerBase<Scalar>
>
create_W_prec
()
const
;
91
RCP<const LinearOpWithSolveFactoryBase<Scalar>
>
get_W_factory
()
const
;
93
void
reportFinalPoint
(
94
const
ModelEvaluatorBase::InArgs<Scalar>
&finalPoint,
95
const
bool
wasSolved
96
);
97
99
100
};
101
102
103
// /////////////////////////////////
104
// Implementations
105
106
107
// Public functions overridden from ModelEvaulator
108
109
110
template
<
class
Scalar>
111
RCP<const VectorSpaceBase<Scalar>
>
112
ResponseOnlyModelEvaluatorBase<Scalar>::get_x_space
()
const
113
{
114
return
Teuchos::null;
115
}
116
117
118
template
<
class
Scalar>
119
RCP<const Teuchos::Array<std::string>
>
120
ResponseOnlyModelEvaluatorBase<Scalar>::get_p_names
(
int
l)
const
121
{
122
#ifdef TEUCHOS_DEBUG
123
TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE
( l, 0, this->
Np
() );
124
#else
125
(void)l;
126
#endif
127
return
Teuchos::null;
128
}
129
130
131
template
<
class
Scalar>
132
Teuchos::ArrayView<const std::string>
133
ResponseOnlyModelEvaluatorBase<Scalar>::get_g_names
(
int
j)
const
134
{
135
#ifdef TEUCHOS_DEBUG
136
TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE
( j, 0, this->
Ng
() );
137
#else
138
(void)j;
139
#endif
140
return
Teuchos::ArrayView<const std::string>
(Teuchos::null);
141
}
142
143
template
<
class
Scalar>
144
RCP<const VectorSpaceBase<Scalar>
>
145
ResponseOnlyModelEvaluatorBase<Scalar>::get_f_space
()
const
146
{
147
return
Teuchos::null;
148
}
149
150
151
template
<
class
Scalar>
152
ModelEvaluatorBase::InArgs<Scalar>
153
ResponseOnlyModelEvaluatorBase<Scalar>::getNominalValues
()
const
154
{
return
this->
createInArgs
(); }
155
156
157
template
<
class
Scalar>
158
ModelEvaluatorBase::InArgs<Scalar>
159
ResponseOnlyModelEvaluatorBase<Scalar>::getLowerBounds
()
const
160
{
return
this->
createInArgs
(); }
161
162
163
template
<
class
Scalar>
164
ModelEvaluatorBase::InArgs<Scalar>
165
ResponseOnlyModelEvaluatorBase<Scalar>::getUpperBounds
()
const
166
{
return
this->
createInArgs
(); }
167
168
169
template
<
class
Scalar>
170
RCP<LinearOpWithSolveBase<Scalar>
>
171
ResponseOnlyModelEvaluatorBase<Scalar>::create_W
()
const
172
{
173
TEUCHOS_TEST_FOR_EXCEPTION
(
174
true
, std::logic_error
175
,
"Error, if \'W\' is supported by the ModelEvaluator subclass then"
176
" this function create_W() may be overridden by the subclass to return"
177
" a non-null object!"
178
);
179
TEUCHOS_UNREACHABLE_RETURN
(Teuchos::null);
180
}
181
182
183
template
<
class
Scalar>
184
RCP<LinearOpBase<Scalar>
>
185
ResponseOnlyModelEvaluatorBase<Scalar>::create_W_op
()
const
186
{
187
TEUCHOS_TEST_FOR_EXCEPTION
(
188
true
, std::logic_error,
189
"Error, if \'W\' is supported by the ModelEvaluator subclass then"
190
" this function create_W_op() may be overridden by the subclass "
191
<<this->
description
()<<
" to return a non-null object!"
192
);
193
TEUCHOS_UNREACHABLE_RETURN
(Teuchos::null);
194
}
195
196
197
template
<
class
Scalar>
198
RCP<PreconditionerBase<Scalar>
>
199
ResponseOnlyModelEvaluatorBase<Scalar>::create_W_prec
()
const
200
{
201
TEUCHOS_TEST_FOR_EXCEPTION
(
202
true
, std::logic_error,
203
"Error, if \'W\' is supported by the ModelEvaluator subclass then"
204
" this function create_W_prec() may be overridden by the subclass "
205
<<this->
description
()<<
" to return a non-null object!"
206
);
207
TEUCHOS_UNREACHABLE_RETURN
(Teuchos::null);
208
}
209
210
211
template
<
class
Scalar>
212
RCP<const LinearOpWithSolveFactoryBase<Scalar>
>
213
ResponseOnlyModelEvaluatorBase<Scalar>::get_W_factory
()
const
214
{
215
TEUCHOS_TEST_FOR_EXCEPTION
(
216
true
, std::logic_error
217
,
"Error, if \'W\' is supported by the ModelEvaluator subclass then"
218
" this function get_W_factory() may be overridden by the subclass "
219
<<this->
description
()<<
" to return a non-null object!"
220
);
221
TEUCHOS_UNREACHABLE_RETURN
(Teuchos::null);
222
}
223
224
225
template
<
class
Scalar>
226
void
ResponseOnlyModelEvaluatorBase<Scalar>::reportFinalPoint
(
227
const
ModelEvaluatorBase::InArgs<Scalar>
&
/* finalPoint */
,
228
const
bool
/* wasSolved */
229
)
230
{
231
// This final point is just ignored by default!
232
}
233
234
235
}
// namespace Thyra
236
237
238
#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:159
Thyra::ModelEvaluatorDefaultBase::ModelEvaluatorDefaultBase
ModelEvaluatorDefaultBase()
Definition
Thyra_ModelEvaluatorDefaultBase.hpp:1036
Thyra::ModelEvaluatorDefaultBase::Ng
int Ng() const
Definition
Thyra_ModelEvaluatorDefaultBase.hpp:412
Thyra::ModelEvaluatorDefaultBase::Np
int Np() const
Definition
Thyra_ModelEvaluatorDefaultBase.hpp:404
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:64
Thyra::ResponseOnlyModelEvaluatorBase::getUpperBounds
ModelEvaluatorBase::InArgs< Scalar > getUpperBounds() const
Returns this->createInArgs().
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:165
Thyra::ResponseOnlyModelEvaluatorBase::get_x_space
RCP< const VectorSpaceBase< Scalar > > get_x_space() const
Throws exception.
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:112
Thyra::ResponseOnlyModelEvaluatorBase::reportFinalPoint
void reportFinalPoint(const ModelEvaluatorBase::InArgs< Scalar > &finalPoint, const bool wasSolved)
Does nothing and ignores input.
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:226
Thyra::ResponseOnlyModelEvaluatorBase::create_W
RCP< LinearOpWithSolveBase< Scalar > > create_W() const
Thorws exception.
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:171
Thyra::ResponseOnlyModelEvaluatorBase::get_W_factory
RCP< const LinearOpWithSolveFactoryBase< Scalar > > get_W_factory() const
Thorws exception.
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:213
Thyra::ResponseOnlyModelEvaluatorBase::create_W_op
RCP< LinearOpBase< Scalar > > create_W_op() const
Thorws exception.
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:185
Thyra::ResponseOnlyModelEvaluatorBase::get_p_names
RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
Returns null.
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:120
Thyra::ResponseOnlyModelEvaluatorBase::get_f_space
RCP< const VectorSpaceBase< Scalar > > get_f_space() const
Throws exception.
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:145
Thyra::ResponseOnlyModelEvaluatorBase::getLowerBounds
ModelEvaluatorBase::InArgs< Scalar > getLowerBounds() const
Returns this->createInArgs().
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:159
Thyra::ResponseOnlyModelEvaluatorBase::create_W_prec
RCP< PreconditionerBase< Scalar > > create_W_prec() const
Thorws exception.
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:199
Thyra::ResponseOnlyModelEvaluatorBase::get_g_names
Teuchos::ArrayView< const std::string > get_g_names(int j) const
Returns null.
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:133
Thyra::ResponseOnlyModelEvaluatorBase::getNominalValues
ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
Returns this->createInArgs().
Definition
Thyra_ResponseOnlyModelEvaluatorBase.hpp:153
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