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 
55 template<class Scalar> class DummyTestModelEvaluator;
56 
57 
62 template<class Scalar>
63 RCP<DummyTestModelEvaluator<Scalar> >
64 dummyTestModelEvaluator(
65  const Ordinal x_size = 2,
66  const ArrayView<const Ordinal> &p_sizes = Teuchos::null,
67  const ArrayView<const Ordinal> &g_sizes = Teuchos::null
68  );
69 
70 
76 template<class Scalar>
78 {
79 public:
80 
83 
86  const Ordinal x_size,
87  const ArrayView<const Ordinal> &p_sizes,
88  const ArrayView<const Ordinal> &g_sizes
89  );
90 
92 
95 
97  RCP<const VectorSpaceBase<Scalar> > get_x_space() const;
99  RCP<const VectorSpaceBase<Scalar> > get_p_space(int l) const;
101  RCP<const Teuchos::Array<std::string> > get_p_names(int l) const;
103  RCP<const VectorSpaceBase<Scalar> > get_f_space() const;
105  RCP<const VectorSpaceBase<Scalar> > get_g_space(int j) const;
107  Teuchos::ArrayView<const std::string> get_g_names(int j) const;
115  RCP<LinearOpBase<Scalar> > create_W_op() const;
117  RCP<PreconditionerBase<Scalar> > create_W_prec() const;
119  RCP<const LinearOpWithSolveFactoryBase<Scalar> > get_W_factory() const;
123  void reportFinalPoint(
124  const ModelEvaluatorBase::InArgs<Scalar> &finalPoint,
125  const bool wasSolved
126  );
127 
129 
130 private: // functions
131 
134 
136  ModelEvaluatorBase::OutArgs<Scalar> createOutArgsImpl() const;
138  void evalModelImpl(
141  ) const;
142 
144 
145 private: // data members
146 
147  RCP<const VectorSpaceBase<Scalar> > x_space_;
148  Array<RCP<const VectorSpaceBase<Scalar> > > p_space_;
149  RCP<const VectorSpaceBase<Scalar> > f_space_;
150  Array<RCP<const VectorSpaceBase<Scalar> > > g_space_;
151  Array<std::string> g_names_;
152  RCP<const LinearOpWithSolveFactoryBase<Scalar> > W_factory_;
153  ModelEvaluatorBase::InArgs<Scalar> nominalValues_;
154  RCP<VectorBase<Scalar> > x0_;
155  ModelEvaluatorBase::InArgs<Scalar> prototypeInArgs_;
156  ModelEvaluatorBase::OutArgs<Scalar> prototypeOutArgs_;
157 
158 };
159 
160 
161 } // namespace Thyra
162 
163 
164 #endif // DUMMY_TEST_MODEL_EVALUATOR_DECL_HPP
ModelEvaluatorBase::InArgs< Scalar > getUpperBounds() const
RCP< const VectorSpaceBase< Scalar > > get_f_space() const
Default base class for concrete model evaluators.
RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
Concrete aggregate class for all output arguments computable by a ModelEvaluator subclass object...
DummyTestModelEvaluator(const Ordinal x_size, const ArrayView< const Ordinal > &p_sizes, const ArrayView< const Ordinal > &g_sizes)
void reportFinalPoint(const ModelEvaluatorBase::InArgs< Scalar > &finalPoint, const bool wasSolved)
RCP< const LinearOpWithSolveFactoryBase< Scalar > > get_W_factory() const
RCP< LinearOpBase< Scalar > > create_W_op() const
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
RCP< PreconditionerBase< Scalar > > create_W_prec() const
RCP< const VectorSpaceBase< Scalar > > get_p_space(int l) const
ModelEvaluatorBase::InArgs< Scalar > createInArgs() const
RCP< const VectorSpaceBase< Scalar > > get_g_space(int j) const
ModelEvaluatorBase::InArgs< Scalar > getLowerBounds() const
Teuchos::ArrayView< const std::string > get_g_names(int j) const
RCP< const VectorSpaceBase< Scalar > > get_x_space() const
Concrete aggregate class for all output arguments computable by a ModelEvaluator subclass object...