Thyra Version of the Day
Loading...
Searching...
No Matches
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
52namespace 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.
58template<class Scalar>
59struct MockExtendedInArgs
60{
62};
63
64template<class Scalar>
65struct MockExtendedOutArgs
66{
68};
69
70
71template<class Scalar> class DummyTestModelEvaluator;
72
73
78template<class Scalar>
79RCP<DummyTestModelEvaluator<Scalar> >
80dummyTestModelEvaluator(
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
97template<class Scalar>
99{
100public:
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
160private: // functions
161
164
166 ModelEvaluatorBase::OutArgs<Scalar> createOutArgsImpl() const;
168 void evalModelImpl(
171 ) const;
172
174
175private: // data members
176
181 Array<std::string> g_names_;
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
RCP< const VectorSpaceBase< Scalar > > get_x_space() const
RCP< const LinearOpWithSolveFactoryBase< Scalar > > get_W_factory() const
ModelEvaluatorBase::InArgs< Scalar > getUpperBounds() const
RCP< PreconditionerBase< Scalar > > create_W_prec() const
RCP< const VectorSpaceBase< Scalar > > get_g_space(int j) const
ModelEvaluatorBase::InArgs< Scalar > getLowerBounds() const
RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
RCP< const VectorSpaceBase< Scalar > > get_f_space() const
Teuchos::ArrayView< const std::string > get_g_names(int j) const
void reportFinalPoint(const ModelEvaluatorBase::InArgs< Scalar > &finalPoint, const bool wasSolved)
RCP< LinearOpBase< Scalar > > create_W_op() const
ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
ModelEvaluatorBase::InArgs< Scalar > createInArgs() const
RCP< const VectorSpaceBase< Scalar > > get_p_space(int l) const
Concrete aggregate class for all input arguments computable by a ModelEvaluator subclass object.
Concrete aggregate class for all output arguments computable by a ModelEvaluator subclass object.
Default base class for concrete model evaluators.
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.