Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_Response_Residual.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Panzer: A partial differential equation assembly
4// engine for strongly coupled complex multiphysics systems
5//
6// Copyright 2011 NTESS and the Panzer contributors.
7// SPDX-License-Identifier: BSD-3-Clause
8// *****************************************************************************
9// @HEADER
10
11#ifndef __Panzer_Response_Residual_hpp__
12#define __Panzer_Response_Residual_hpp__
13
14#include <string>
15
16#include "Teuchos_RCP.hpp"
17
18#include "Thyra_VectorBase.hpp"
19#include "Thyra_LinearOpBase.hpp"
20
23#include "Panzer_Traits.hpp"
24
25namespace panzer {
26
31template <typename EvalT>
33public:
34 Response_Residual(const std::string & responseName,
35 const Teuchos::RCP<const panzer::LinearObjFactory<panzer::Traits> > & /* lof */) :
36 ResponseBase(responseName) {}
37 virtual ~Response_Residual() {}
38 virtual void scatterResponse() {}
39 virtual void initializeResponse() {}
40};
41
48template < >
50private:
51 Teuchos::RCP<const panzer::LinearObjFactory<panzer::Traits> > linObjFactory_;
52
53 Teuchos::RCP<Thyra::VectorBase<panzer::Traits::RealType> > residual_;
54 mutable Teuchos::RCP<Thyra::VectorBase<panzer::Traits::RealType> > ghostedResidual_;
55 // mutable because of lazy construction (as needed)
56
57public:
58 Response_Residual(const std::string & responseName,
59 const Teuchos::RCP<const panzer::LinearObjFactory<panzer::Traits> > & lof)
60 : ResponseBase(responseName)
61 , linObjFactory_(lof) {}
62 virtual ~Response_Residual() {}
63
67 Teuchos::RCP<Thyra::VectorBase<panzer::Traits::RealType> > getGhostedResidual() const;
68
72 Teuchos::RCP<Thyra::VectorBase<panzer::Traits::RealType> > getResidual() const;
73
77 void setResidual(const Teuchos::RCP<Thyra::VectorBase<panzer::Traits::RealType> > & res);
78
82 Teuchos::RCP<Thyra::VectorBase<panzer::Traits::RealType> > allocateResidualVector() const;
83
84 // Functions inherited from ResponseBase
85 virtual void initializeResponse() {}
86 virtual void scatterResponse() {}
87};
88
95template < >
97private:
98 Teuchos::RCP<const panzer::LinearObjFactory<panzer::Traits> > linObjFactory_;
99
100 Teuchos::RCP<Thyra::LinearOpBase<panzer::Traits::RealType> > jacobian_;
101 mutable Teuchos::RCP<Thyra::LinearOpBase<panzer::Traits::RealType> > ghostedJacobian_;
102 // mutable because of lazy construction (as needed)
103
104public:
105 Response_Residual(const std::string & responseName,
106 const Teuchos::RCP<const panzer::LinearObjFactory<panzer::Traits> > & lof)
107 : ResponseBase(responseName)
108 , linObjFactory_(lof) {}
110
114 Teuchos::RCP<Thyra::LinearOpBase<panzer::Traits::RealType> > getGhostedJacobian() const;
115
119 Teuchos::RCP<Thyra::LinearOpBase<panzer::Traits::RealType> > getJacobian() const;
120
124 void setJacobian(const Teuchos::RCP<Thyra::LinearOpBase<panzer::Traits::RealType> > & res);
125
129 Teuchos::RCP<Thyra::LinearOpBase<panzer::Traits::RealType> > allocateJacobian() const;
130
131 // Functions inherited from ResponseBase
132 virtual void initializeResponse() {}
133 virtual void scatterResponse() {}
134};
135
136#ifdef Panzer_BUILD_HESSIAN_SUPPORT
143template < >
145private:
146 Teuchos::RCP<const panzer::LinearObjFactory<panzer::Traits> > linObjFactory_;
147
148 Teuchos::RCP<Thyra::LinearOpBase<panzer::Traits::RealType> > hessian_;
149 mutable Teuchos::RCP<Thyra::LinearOpBase<panzer::Traits::RealType> > ghostedHessian_;
150 // mutable because of lazy construction (as needed)
151
152public:
153 Response_Residual(const std::string & responseName,
154 const Teuchos::RCP<const panzer::LinearObjFactory<panzer::Traits> > & lof)
155 : ResponseBase(responseName)
156 , linObjFactory_(lof) {}
158
162 Teuchos::RCP<Thyra::LinearOpBase<panzer::Traits::RealType> > getGhostedHessian() const;
163
167 Teuchos::RCP<Thyra::LinearOpBase<panzer::Traits::RealType> > getHessian() const;
168
172 void setHessian(const Teuchos::RCP<Thyra::LinearOpBase<panzer::Traits::RealType> > & res);
173
177 Teuchos::RCP<Thyra::LinearOpBase<panzer::Traits::RealType> > allocateHessian() const;
178
179 // Functions inherited from ResponseBase
180 virtual void initializeResponse() {}
181 virtual void scatterResponse() {}
182};
183#endif
184
185}
186
187#endif
Response_Residual(const std::string &responseName, const Teuchos::RCP< const panzer::LinearObjFactory< panzer::Traits > > &lof)
Teuchos::RCP< Thyra::LinearOpBase< panzer::Traits::RealType > > ghostedHessian_
Teuchos::RCP< Thyra::LinearOpBase< panzer::Traits::RealType > > hessian_
virtual void scatterResponse()
Prepare the response for access by the user (do global communication)
Teuchos::RCP< const panzer::LinearObjFactory< panzer::Traits > > linObjFactory_
Teuchos::RCP< Thyra::LinearOpBase< panzer::Traits::RealType > > jacobian_
Teuchos::RCP< const panzer::LinearObjFactory< panzer::Traits > > linObjFactory_
Teuchos::RCP< Thyra::LinearOpBase< panzer::Traits::RealType > > ghostedJacobian_
Response_Residual(const std::string &responseName, const Teuchos::RCP< const panzer::LinearObjFactory< panzer::Traits > > &lof)
virtual void scatterResponse()
Prepare the response for access by the user (do global communication)
Teuchos::RCP< const panzer::LinearObjFactory< panzer::Traits > > linObjFactory_
Response_Residual(const std::string &responseName, const Teuchos::RCP< const panzer::LinearObjFactory< panzer::Traits > > &lof)
Teuchos::RCP< Thyra::VectorBase< panzer::Traits::RealType > > ghostedResidual_
Teuchos::RCP< Thyra::VectorBase< panzer::Traits::RealType > > residual_
virtual void scatterResponse()
Prepare the response for access by the user (do global communication)
Response_Residual(const std::string &responseName, const Teuchos::RCP< const panzer::LinearObjFactory< panzer::Traits > > &)
virtual void scatterResponse()
Prepare the response for access by the user (do global communication)
Evaluation type for computing second derivatives, using HessianType as the scalar type....
Evaluation type for computing the residual and its Jacobian, using FadType as the scalar type.
Evaluation type for computing the residual only, using RealType as the scalar type.