Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_DummyTestModelEvaluator_decl.hpp
1 /*
2 // @HEADER
3 // ***********************************************************************
4 //
5 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
6 // Copyright (2004) Sandia Corporation
7 //
8 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
9 // license for use of this work by or on behalf of the U.S. Government.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov)
39 //
40 // ***********************************************************************
41 // @HEADER
42 */
43 
44 
45 #ifndef DUMMY_TEST_MODEL_EVALUATOR_DECL_HPP
46 #define DUMMY_TEST_MODEL_EVALUATOR_DECL_HPP
47 
48 
49 #include "Thyra_ModelEvaluatorDefaultBase.hpp"
50 
51 
52 namespace Thyra {
53 
54 // Mock Extended InArgs and OutArgs Objects. In practice, these
55 // objects will be defined by a solver that needs to extend the
56 // InArgs/OutArgs for specialized data without cluttering the core
57 // model evaluator interface.
58 template<class Scalar>
59 struct MockExtendedInArgs
60 {
62 };
63 
64 template<class Scalar>
65 struct MockExtendedOutArgs
66 {
68 };
69 
70 
71 template<class Scalar> class DummyTestModelEvaluator;
72 
73 
78 template<class Scalar>
80 dummyTestModelEvaluator(
81  const Ordinal x_size = 2,
82  const ArrayView<const Ordinal> &p_sizes = Teuchos::null,
83  const ArrayView<const Ordinal> &g_sizes = Teuchos::null,
84  const bool supports_x_dot = false,
85  const bool supports_x_dot_dot = false,
86  const bool supports_extended_inargs = true,
87  const bool supports_extended_outargs = true,
88  const bool supports_derivatives = false
89  );
90 
91 
97 template<class Scalar>
99 {
100 public:
101 
104 
107  const Ordinal x_size,
108  const ArrayView<const Ordinal> &p_sizes,
109  const ArrayView<const Ordinal> &g_sizes,
110  const bool supports_x_dot = false,
111  const bool supports_x_dot_dot = false,
112  const bool supports_extended_inargs = true,
113  const bool supports_extended_outargs = true,
114  const bool supports_derivatives = false
115  );
116 
118 
121 
149  void reportFinalPoint(
150  const ModelEvaluatorBase::InArgs<Scalar> &finalPoint,
151  const bool wasSolved
152  );
153 
155 
156  // For unit testing
157  void change_p_size_incorrectly(const Ordinal new_size);
158  void change_p_size_correctly(const Ordinal new_size);
159 
160 private: // functions
161 
164 
166  ModelEvaluatorBase::OutArgs<Scalar> createOutArgsImpl() const;
168  void evalModelImpl(
171  ) const;
172 
174 
175 private: // data members
176 
181  Array<std::string> g_names_;
183  ModelEvaluatorBase::InArgs<Scalar> nominalValues_;
185  ModelEvaluatorBase::InArgs<Scalar> prototypeInArgs_;
186  ModelEvaluatorBase::OutArgs<Scalar> prototypeOutArgs_;
187 
188 };
189 
190 
191 } // namespace Thyra
192 
193 
194 #endif // DUMMY_TEST_MODEL_EVALUATOR_DECL_HPP
ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
Default base class for concrete model evaluators.
Concrete aggregate class for all output arguments computable by a ModelEvaluator subclass object...
void reportFinalPoint(const ModelEvaluatorBase::InArgs< Scalar > &finalPoint, const bool wasSolved)
RCP< const VectorSpaceBase< Scalar > > get_p_space(int l) const
RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
ModelEvaluatorBase::InArgs< Scalar > createInArgs() const
RCP< LinearOpBase< Scalar > > create_W_op() const
ModelEvaluatorBase::InArgs< Scalar > getUpperBounds() const
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
RCP< const VectorSpaceBase< Scalar > > get_x_space() const
Teuchos::ArrayView< const std::string > get_g_names(int j) const
RCP< const VectorSpaceBase< Scalar > > get_f_space() const
ModelEvaluatorBase::InArgs< Scalar > getLowerBounds() const
RCP< const VectorSpaceBase< Scalar > > get_g_space(int j) const
DummyTestModelEvaluator(const Ordinal x_size, const ArrayView< const Ordinal > &p_sizes, const ArrayView< const Ordinal > &g_sizes, const bool supports_x_dot=false, const bool supports_x_dot_dot=false, const bool supports_extended_inargs=true, const bool supports_extended_outargs=true, const bool supports_derivatives=false)
RCP< const LinearOpWithSolveFactoryBase< Scalar > > get_W_factory() const
RCP< PreconditionerBase< Scalar > > create_W_prec() const
Concrete aggregate class for all input arguments computable by a ModelEvaluator subclass object...