Thyra
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
core
src
support
nonlinear
model_evaluator
client_support
Thyra_StateFuncModelEvaluatorBase.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_STATE_FUNC_MODEL_EVALUATOR_BASE_HPP
11
#define THYRA_STATE_FUNC_MODEL_EVALUATOR_BASE_HPP
12
13
#include "Thyra_ModelEvaluatorDefaultBase.hpp"
14
15
16
namespace
Thyra {
17
18
29
template
<
class
Scalar>
30
class
StateFuncModelEvaluatorBase
:
virtual
public
ModelEvaluatorDefaultBase
<Scalar> {
31
public
:
32
35
37
RCP<const VectorSpaceBase<Scalar>
>
get_p_space
(
int
l)
const
;
39
RCP<const Teuchos::Array<std::string>
>
get_p_names
(
int
l)
const
;
41
RCP<const VectorSpaceBase<Scalar>
>
get_g_space
(
int
j)
const
;
43
Teuchos::ArrayView<const std::string>
get_g_names
(
int
j)
const
;
45
ModelEvaluatorBase::InArgs<Scalar>
getNominalValues
()
const
;
47
ModelEvaluatorBase::InArgs<Scalar>
getLowerBounds
()
const
;
49
ModelEvaluatorBase::InArgs<Scalar>
getUpperBounds
()
const
;
51
RCP<LinearOpBase<Scalar>
>
create_W_op
()
const
;
53
RCP<PreconditionerBase<Scalar>
>
create_W_prec
()
const
;
55
RCP<const LinearOpWithSolveFactoryBase<Scalar>
>
get_W_factory
()
const
;
57
void
reportFinalPoint
(
58
const
ModelEvaluatorBase::InArgs<Scalar>
&finalPoint,
59
const
bool
wasSolved
60
);
61
63
64
};
65
66
67
// /////////////////////////////////
68
// Implementations
69
70
71
// Public functions overridden from ModelEvaulator
72
73
74
template
<
class
Scalar>
75
RCP<const VectorSpaceBase<Scalar>
>
76
StateFuncModelEvaluatorBase<Scalar>::get_p_space
(
int
/* l */
)
const
77
{
78
TEUCHOS_TEST_FOR_EXCEPTION
(
79
true
,std::logic_error
80
,
"ModelEvaluator<"
<<
Teuchos::ScalarTraits<Scalar>::name
()<<
">::get_p_space(l): "
81
"Error, this function was not overridden in *this = \'"
<<this->
description
()<<
"\'!"
82
);
83
TEUCHOS_UNREACHABLE_RETURN
(Teuchos::null);
84
}
85
86
87
template
<
class
Scalar>
88
RCP<const Teuchos::Array<std::string>
>
89
StateFuncModelEvaluatorBase<Scalar>::get_p_names
(
int
/* l */
)
const
90
{
91
TEUCHOS_TEST_FOR_EXCEPTION
(
92
true
,std::logic_error
93
,
"ModelEvaluator<"
<<
Teuchos::ScalarTraits<Scalar>::name
()<<
">::get_p_names(l): "
94
"Error, this function was not overridden in *this = \'"
<<this->
description
()<<
"\'!"
95
);
96
TEUCHOS_UNREACHABLE_RETURN
(Teuchos::null);
97
}
98
99
100
template
<
class
Scalar>
101
RCP<const VectorSpaceBase<Scalar>
>
102
StateFuncModelEvaluatorBase<Scalar>::get_g_space
(
int
/* j */
)
const
103
{
104
TEUCHOS_TEST_FOR_EXCEPTION
(
105
true
,std::logic_error
106
,
"ModelEvaluator<"
<<
Teuchos::ScalarTraits<Scalar>::name
()<<
">::get_g_space(j): "
107
" Error, this function was not overridden in \'"
108
<<this->
description
()<<
"\'!"
109
);
110
TEUCHOS_UNREACHABLE_RETURN
(Teuchos::null);
111
}
112
113
114
template
<
class
Scalar>
115
Teuchos::ArrayView<const std::string>
116
StateFuncModelEvaluatorBase<Scalar>::get_g_names
(
int
/* j */
)
const
117
{
118
TEUCHOS_TEST_FOR_EXCEPTION
(
119
true
,std::logic_error
120
,
"ModelEvaluator<"
<<
Teuchos::ScalarTraits<Scalar>::name
()<<
">::get_g_names(j): "
121
"Error, this function was not overridden in *this = \'"
<<this->
description
()<<
"\'!"
122
);
123
TEUCHOS_UNREACHABLE_RETURN
(
Teuchos::ArrayView<const std::string>
(Teuchos::null));
124
}
125
126
127
template
<
class
Scalar>
128
ModelEvaluatorBase::InArgs<Scalar>
129
StateFuncModelEvaluatorBase<Scalar>::getNominalValues
()
const
130
{
return
this->
createInArgs
(); }
131
132
133
template
<
class
Scalar>
134
ModelEvaluatorBase::InArgs<Scalar>
135
StateFuncModelEvaluatorBase<Scalar>::getLowerBounds
()
const
136
{
return
this->
createInArgs
(); }
137
138
139
template
<
class
Scalar>
140
ModelEvaluatorBase::InArgs<Scalar>
141
StateFuncModelEvaluatorBase<Scalar>::getUpperBounds
()
const
142
{
return
this->
createInArgs
(); }
143
144
145
template
<
class
Scalar>
146
RCP<LinearOpBase<Scalar>
>
147
StateFuncModelEvaluatorBase<Scalar>::create_W_op
()
const
148
{
149
TEUCHOS_TEST_FOR_EXCEPTION
(
150
true
, std::logic_error
151
,
"Error, if \'W_op\' is supported by the ModelEvaluator subclass then"
152
" this function create_W_op() must be overridden by the subclass "
153
<<this->
description
()<<
" to return a non-null object!"
154
);
155
TEUCHOS_UNREACHABLE_RETURN
(Teuchos::null);
156
}
157
158
159
template
<
class
Scalar>
160
RCP<PreconditionerBase<Scalar>
>
161
StateFuncModelEvaluatorBase<Scalar>::create_W_prec
()
const
162
{
163
return
Teuchos::null;
164
}
165
166
167
template
<
class
Scalar>
168
RCP<const LinearOpWithSolveFactoryBase<Scalar>
>
169
StateFuncModelEvaluatorBase<Scalar>::get_W_factory
()
const
170
{
171
return
Teuchos::null;
172
}
173
174
175
template
<
class
Scalar>
176
void
StateFuncModelEvaluatorBase<Scalar>::reportFinalPoint
(
177
const
ModelEvaluatorBase::InArgs<Scalar>
&
/* finalPoint */
,
178
const
bool
/* wasSolved */
179
)
180
{
181
// This final point is just ignored by default!
182
}
183
184
185
}
// namespace Thyra
186
187
188
#endif
// THYRA_STATE_FUNC_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::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::StateFuncModelEvaluatorBase
This base class defines default function implementations appropritate for a set of nonlinear state fu...
Definition
Thyra_StateFuncModelEvaluatorBase.hpp:30
Thyra::StateFuncModelEvaluatorBase::get_W_factory
RCP< const LinearOpWithSolveFactoryBase< Scalar > > get_W_factory() const
Returns null .
Definition
Thyra_StateFuncModelEvaluatorBase.hpp:169
Thyra::StateFuncModelEvaluatorBase::create_W_prec
RCP< PreconditionerBase< Scalar > > create_W_prec() const
Returns null.
Definition
Thyra_StateFuncModelEvaluatorBase.hpp:161
Thyra::StateFuncModelEvaluatorBase::getUpperBounds
ModelEvaluatorBase::InArgs< Scalar > getUpperBounds() const
Returns this->createInArgs().
Definition
Thyra_StateFuncModelEvaluatorBase.hpp:141
Thyra::StateFuncModelEvaluatorBase::getNominalValues
ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
Returns this->createInArgs().
Definition
Thyra_StateFuncModelEvaluatorBase.hpp:129
Thyra::StateFuncModelEvaluatorBase::getLowerBounds
ModelEvaluatorBase::InArgs< Scalar > getLowerBounds() const
Returns this->createInArgs().
Definition
Thyra_StateFuncModelEvaluatorBase.hpp:135
Thyra::StateFuncModelEvaluatorBase::get_g_names
Teuchos::ArrayView< const std::string > get_g_names(int j) const
Throws exception.
Definition
Thyra_StateFuncModelEvaluatorBase.hpp:116
Thyra::StateFuncModelEvaluatorBase::create_W_op
RCP< LinearOpBase< Scalar > > create_W_op() const
Throws exception.
Definition
Thyra_StateFuncModelEvaluatorBase.hpp:147
Thyra::StateFuncModelEvaluatorBase::get_p_space
RCP< const VectorSpaceBase< Scalar > > get_p_space(int l) const
Throws exception.
Definition
Thyra_StateFuncModelEvaluatorBase.hpp:76
Thyra::StateFuncModelEvaluatorBase::get_p_names
RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
Throws exception.
Definition
Thyra_StateFuncModelEvaluatorBase.hpp:89
Thyra::StateFuncModelEvaluatorBase::reportFinalPoint
void reportFinalPoint(const ModelEvaluatorBase::InArgs< Scalar > &finalPoint, const bool wasSolved)
Ignores input and does nothing.
Definition
Thyra_StateFuncModelEvaluatorBase.hpp:176
Thyra::StateFuncModelEvaluatorBase::get_g_space
RCP< const VectorSpaceBase< Scalar > > get_g_space(int j) const
Throws exception.
Definition
Thyra_StateFuncModelEvaluatorBase.hpp:102
TEUCHOS_TEST_FOR_EXCEPTION
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
TEUCHOS_UNREACHABLE_RETURN
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
Teuchos::ScalarTraits::name
static std::string name()
Generated by
1.17.0