Thyra  Version of the Day
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>
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;
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> >
113 {
114  return Teuchos::null;
115 }
116 
117 
118 template<class Scalar>
119 RCP<const Teuchos::Array<std::string> >
121 {
122 #ifdef TEUCHOS_DEBUG
123  TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE( l, 0, this->Np() );
124 #endif
125  return Teuchos::null;
126 }
127 
128 
129 template<class Scalar>
130 Teuchos::ArrayView<const std::string>
132 {
133 #ifdef TEUCHOS_DEBUG
134  TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE( j, 0, this->Ng() );
135 #endif
136  return Teuchos::ArrayView<const std::string>(Teuchos::null);
137 }
138 
139 template<class Scalar>
140 RCP<const VectorSpaceBase<Scalar> >
142 {
143  return Teuchos::null;
144 }
145 
146 
147 template<class Scalar>
150 { return this->createInArgs(); }
151 
152 
153 template<class Scalar>
156 { return this->createInArgs(); }
157 
158 
159 template<class Scalar>
162 { return this->createInArgs(); }
163 
164 
165 template<class Scalar>
166 RCP<LinearOpWithSolveBase<Scalar> >
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() may be overridden by the subclass to return"
173  " a non-null object!"
174  );
175  return Teuchos::null; // Should never be called!
176 }
177 
178 
179 template<class Scalar>
180 RCP<LinearOpBase<Scalar> >
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 create_W_op() may be overridden by the subclass "
187  <<this->description()<<" to return a non-null object!"
188  );
189  return Teuchos::null; // Should never be called!
190 }
191 
192 
193 template<class Scalar>
194 RCP<PreconditionerBase<Scalar> >
196 {
197  TEUCHOS_TEST_FOR_EXCEPTION(
198  true, std::logic_error,
199  "Error, if \'W\' is supported by the ModelEvaluator subclass then"
200  " this function create_W_prec() may be overridden by the subclass "
201  <<this->description()<<" to return a non-null object!"
202  );
203  return Teuchos::null; // Should never be called!
204 }
205 
206 
207 template<class Scalar>
208 RCP<const LinearOpWithSolveFactoryBase<Scalar> >
210 {
211  TEUCHOS_TEST_FOR_EXCEPTION(
212  true, std::logic_error
213  ,"Error, if \'W\' is supported by the ModelEvaluator subclass then"
214  " this function get_W_factory() may be overridden by the subclass "
215  <<this->description()<<" to return a non-null object!"
216  );
217  return Teuchos::null; // Should never be called!
218 }
219 
220 
221 template<class Scalar>
223  const ModelEvaluatorBase::InArgs<Scalar> &finalPoint,
224  const bool wasSolved
225  )
226 {
227  // This final point is just ignored by default!
228 }
229 
230 
231 } // namespace Thyra
232 
233 
234 #endif // THYRA_RESPONSE_ONLY_MODEL_EVALUATOR_BASE_HPP
RCP< PreconditionerBase< Scalar > > create_W_prec() const
Thorws exception.
Default base class for concrete model evaluators.
RCP< const VectorSpaceBase< Scalar > > get_f_space() const
Throws exception.
void reportFinalPoint(const ModelEvaluatorBase::InArgs< Scalar > &finalPoint, const bool wasSolved)
Does nothing and ignores input.
Teuchos::ArrayView< const std::string > get_g_names(int j) const
Returns null.
RCP< const VectorSpaceBase< Scalar > > get_x_space() const
Throws exception.
ModelEvaluatorBase::InArgs< Scalar > getLowerBounds() const
Returns this->createInArgs().
RCP< LinearOpBase< Scalar > > create_W_op() const
Thorws exception.
This base class defines default function implementations appropritate for a response-only model evalu...
ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
Returns this->createInArgs().
RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
Returns null.
ModelEvaluatorBase::InArgs< Scalar > getUpperBounds() const
Returns this->createInArgs().
RCP< LinearOpWithSolveBase< Scalar > > create_W() const
Thorws exception.
RCP< const LinearOpWithSolveFactoryBase< Scalar > > get_W_factory() const
Thorws exception.
Concrete aggregate class for all output arguments computable by a ModelEvaluator subclass object...