Thyra  Version of the Day
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  );
89 
90 
96 template<class Scalar>
98 {
99 public:
100 
103 
106  const Ordinal x_size,
107  const ArrayView<const Ordinal> &p_sizes,
108  const ArrayView<const Ordinal> &g_sizes,
109  const bool supports_x_dot = false,
110  const bool supports_x_dot_dot = false,
111  const bool supports_extended_inargs = true,
112  const bool supports_extended_outargs = true
113  );
114 
116 
119 
147  void reportFinalPoint(
148  const ModelEvaluatorBase::InArgs<Scalar> &finalPoint,
149  const bool wasSolved
150  );
151 
153 
154 private: // functions
155 
158 
160  ModelEvaluatorBase::OutArgs<Scalar> createOutArgsImpl() const;
162  void evalModelImpl(
165  ) const;
166 
168 
169 private: // data members
170 
175  Array<std::string> g_names_;
177  ModelEvaluatorBase::InArgs<Scalar> nominalValues_;
179  ModelEvaluatorBase::InArgs<Scalar> prototypeInArgs_;
180  ModelEvaluatorBase::OutArgs<Scalar> prototypeOutArgs_;
181 
182 };
183 
184 
185 } // namespace Thyra
186 
187 
188 #endif // DUMMY_TEST_MODEL_EVALUATOR_DECL_HPP
Thyra::DummyTestModelEvaluator::get_x_space
RCP< const VectorSpaceBase< Scalar > > get_x_space() const
Definition: Thyra_DummyTestModelEvaluator_def.hpp:156
Thyra::DummyTestModelEvaluator::getLowerBounds
ModelEvaluatorBase::InArgs< Scalar > getLowerBounds() const
Definition: Thyra_DummyTestModelEvaluator_def.hpp:212
Thyra::DummyTestModelEvaluator::get_p_space
RCP< const VectorSpaceBase< Scalar > > get_p_space(int l) const
Definition: Thyra_DummyTestModelEvaluator_def.hpp:164
Thyra::DummyTestModelEvaluator
Test helper ModelEvaluator.
Definition: Thyra_DummyTestModelEvaluator_decl.hpp:71
Teuchos::ArrayView
Teuchos::RCP
Thyra::ModelEvaluatorBase::OutArgs
Concrete aggregate class for all output arguments computable by a ModelEvaluator subclass object.
Definition: Thyra_ModelEvaluatorBase_decl.hpp:787
Thyra::Ordinal
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
Definition: Thyra_OperatorVectorTypes.hpp:127
Teuchos::Array
Thyra::DummyTestModelEvaluator::getNominalValues
ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
Definition: Thyra_DummyTestModelEvaluator_def.hpp:204
Thyra::DummyTestModelEvaluator::get_p_names
RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
Definition: Thyra_DummyTestModelEvaluator_def.hpp:172
Thyra::ModelEvaluatorBase::InArgs
Concrete aggregate class for all input arguments computable by a ModelEvaluator subclass object.
Definition: Thyra_ModelEvaluatorBase_decl.hpp:159
Thyra::DummyTestModelEvaluator::getUpperBounds
ModelEvaluatorBase::InArgs< Scalar > getUpperBounds() const
Definition: Thyra_DummyTestModelEvaluator_def.hpp:220
Thyra::DummyTestModelEvaluator::reportFinalPoint
void reportFinalPoint(const ModelEvaluatorBase::InArgs< Scalar > &finalPoint, const bool wasSolved)
Definition: Thyra_DummyTestModelEvaluator_def.hpp:265
Thyra::DummyTestModelEvaluator::get_g_names
Teuchos::ArrayView< const std::string > get_g_names(int j) const
Definition: Thyra_DummyTestModelEvaluator_def.hpp:196
Thyra::DummyTestModelEvaluator::get_W_factory
RCP< const LinearOpWithSolveFactoryBase< Scalar > > get_W_factory() const
Definition: Thyra_DummyTestModelEvaluator_def.hpp:250
Thyra::DummyTestModelEvaluator::get_g_space
RCP< const VectorSpaceBase< Scalar > > get_g_space(int j) const
Definition: Thyra_DummyTestModelEvaluator_def.hpp:188
Thyra::ModelEvaluatorDefaultBase
Default base class for concrete model evaluators.
Definition: Thyra_ModelEvaluatorDefaultBase.hpp:188
Thyra::DummyTestModelEvaluator::create_W_op
RCP< LinearOpBase< Scalar > > create_W_op() const
Definition: Thyra_DummyTestModelEvaluator_def.hpp:228
Thyra::DummyTestModelEvaluator::create_W_prec
RCP< PreconditionerBase< Scalar > > create_W_prec() const
Definition: Thyra_DummyTestModelEvaluator_def.hpp:238
Thyra::DummyTestModelEvaluator::DummyTestModelEvaluator
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)
Definition: Thyra_DummyTestModelEvaluator_def.hpp:85
Thyra::DummyTestModelEvaluator::createInArgs
ModelEvaluatorBase::InArgs< Scalar > createInArgs() const
Definition: Thyra_DummyTestModelEvaluator_def.hpp:258
Thyra::DummyTestModelEvaluator::get_f_space
RCP< const VectorSpaceBase< Scalar > > get_f_space() const
Definition: Thyra_DummyTestModelEvaluator_def.hpp:180