Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_DiagonalQuadraticResponseOnlyModelEvaluator_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 #ifndef THYRA_DIAGONAL_QUADRATIC_RESPONSE_ONLY_MODEL_EVALUATOR_DECL_HPP
45 #define THYRA_DIAGONAL_QUADRATIC_RESPONSE_ONLY_MODEL_EVALUATOR_DECL_HPP
46 
47 
48 #include "Thyra_ResponseOnlyModelEvaluatorBase.hpp"
49 #include "Teuchos_Comm.hpp"
50 
51 
52 namespace Thyra {
53 
54 
125 template<class Scalar>
127  : public ResponseOnlyModelEvaluatorBase<Scalar>
128 {
129 public:
130 
132 
135 
138  const int localDim,
139  const RCP<const Teuchos::Comm<Ordinal> > &comm = Teuchos::null
140  );
141 
143  void setSolutionVector(const RCP<const VectorBase<Scalar> > &ps);
144 
147  getSolutionVector() const;
148 
150  void setDiagonalVector(const RCP<const VectorBase<Scalar> > &diag);
151 
157  void setDiagonalBarVector(const RCP<const VectorBase<Scalar> > &diag_bar);
158 
160  void setNonlinearTermFactor(const Scalar &nonlinearTermFactor);
161 
163  void setScalarOffset(const Scalar &g_offset);
164 
166 
169 
171  int Np() const;
173  int Ng() const;
180 
182 
183 private:
184 
187 
189  ModelEvaluatorBase::OutArgs<Scalar> createOutArgsImpl() const;
191  void evalModelImpl(
194  ) const;
195 
197 
198 private:
199 
200  // //////////////////////
201  // Private data members
202 
203  int Np_;
204  int Ng_;
206  const int localDim_;
207 
209 
210  // Declared non-const so we can change the space in place!
211  RCP<VectorSpaceBase<Scalar> > p_space_;
212 
215  Scalar nonlinearTermFactor_;
216  Scalar g_offset_;
217 
218  RCP<const VectorBase<Scalar> > diag_bar_;
220 
221 };
222 
223 
225 template<class Scalar>
227 diagonalQuadraticResponseOnlyModelEvaluator(
228  const int localDim,
229  const RCP<const Teuchos::Comm<Ordinal> > &comm = Teuchos::null
230  )
231 {
232  using Teuchos::rcp;
233  return rcp(new DiagonalQuadraticResponseOnlyModelEvaluator<Scalar>(localDim, comm));
234 }
235 
236 
237 } // namespace Thyra
238 
239 
240 #endif // THYRA_DIAGONAL_QUADRATIC_RESPONSE_ONLY_MODEL_EVALUATOR_DECL_HPP
Concrete aggregate class for all output arguments computable by a ModelEvaluator subclass object...
void setSolutionVector(const RCP< const VectorBase< Scalar > > &ps)
Set the solution vector ps .
DiagonalQuadraticResponseOnlyModelEvaluator(const int localDim, const RCP< const Teuchos::Comm< Ordinal > > &comm=Teuchos::null)
const RCP< const VectorBase< Scalar > > getSolutionVector() const
Get the solution vector ps .
void setNonlinearTermFactor(const Scalar &nonlinearTermFactor)
Set nonlinear term factory.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
This base class defines default function implementations appropritate for a response-only model evalu...
Abstract interface for finite-dimensional dense vectors.
void setDiagonalVector(const RCP< const VectorBase< Scalar > > &diag)
Set the diagonal vector diag.
void setDiagonalBarVector(const RCP< const VectorBase< Scalar > > &diag_bar)
Set the diagonal vector diag_bar.
Concrete aggregate class for all input arguments computable by a ModelEvaluator subclass object...