Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_Response_Residual.cpp
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
12
15
16#include "Thyra_VectorSpaceBase.hpp"
17
18namespace panzer {
19
22
23Teuchos::RCP<Thyra::VectorBase<panzer::Traits::RealType> >
26{
27 using Teuchos::RCP;
28 using Teuchos::rcp_dynamic_cast;
29
31
32 // if already computed, uses that ghosted vector
33 if(ghostedResidual_!=Teuchos::null)
34 return ghostedResidual_;
35
36 // otherwise, allocate a new ghosted vector
37 RCP<LinearObjContainer> loc = linObjFactory_->buildGhostedLinearObjContainer();
38 linObjFactory_->initializeGhostedContainer(LinearObjContainer::F,*loc);
39
40 RCP<TOC> th_loc = rcp_dynamic_cast<TOC>(loc);
41 return th_loc->get_f_th();
42}
43
44Teuchos::RCP<Thyra::VectorBase<panzer::Traits::RealType> >
46getResidual() const
47{
48 return residual_;
49}
50
51void
57
58Teuchos::RCP<Thyra::VectorBase<panzer::Traits::RealType> >
61{
62 using Teuchos::RCP;
63 using Teuchos::rcp_dynamic_cast;
64
66
67 RCP<const ObjFactory> objFactory = rcp_dynamic_cast<const ObjFactory>(linObjFactory_);
68 return Thyra::createMember(objFactory->getThyraRangeSpace());
69}
70
73
74Teuchos::RCP<Thyra::LinearOpBase<panzer::Traits::RealType> >
77{
78 using Teuchos::RCP;
79 using Teuchos::rcp_dynamic_cast;
80
82
83 // if already computed, uses that ghosted vector
84 if(ghostedJacobian_!=Teuchos::null)
85 return ghostedJacobian_;
86
87 // otherwise, allocate a new ghosted vector
88 RCP<LinearObjContainer> loc = linObjFactory_->buildGhostedLinearObjContainer();
89 linObjFactory_->initializeGhostedContainer(LinearObjContainer::Mat,*loc);
90
91 RCP<TOC> th_loc = rcp_dynamic_cast<TOC>(loc);
92 return th_loc->get_A_th();
93}
94
95Teuchos::RCP<Thyra::LinearOpBase<panzer::Traits::RealType> >
97getJacobian() const
98{
99 return jacobian_;
100}
101
102void
108
109Teuchos::RCP<Thyra::LinearOpBase<panzer::Traits::RealType> >
111allocateJacobian() const
112{
113 using Teuchos::RCP;
114 using Teuchos::rcp_dynamic_cast;
115
117
118 RCP<const ObjFactory> objFactory = rcp_dynamic_cast<const ObjFactory>(linObjFactory_);
119 return objFactory->getThyraMatrix();
120}
121
124
125#ifdef Panzer_BUILD_HESSIAN_SUPPORT
126
127Teuchos::RCP<Thyra::LinearOpBase<panzer::Traits::RealType> >
129getGhostedHessian() const
130{
131 using Teuchos::RCP;
132 using Teuchos::rcp_dynamic_cast;
133
135
136 // if already computed, uses that ghosted vector
137 if(ghostedHessian_!=Teuchos::null)
138 return ghostedHessian_;
139
140 // otherwise, allocate a new ghosted vector
141 RCP<LinearObjContainer> loc = linObjFactory_->buildGhostedLinearObjContainer();
142 linObjFactory_->initializeGhostedContainer(LinearObjContainer::Mat,*loc);
143
144 RCP<TOC> th_loc = rcp_dynamic_cast<TOC>(loc);
145 return th_loc->get_A_th();
146}
147
148Teuchos::RCP<Thyra::LinearOpBase<panzer::Traits::RealType> >
150getHessian() const
151{
152 return hessian_;
153}
154
155void
161
162Teuchos::RCP<Thyra::LinearOpBase<panzer::Traits::RealType> >
164allocateHessian() const
165{
166 using Teuchos::RCP;
167 using Teuchos::rcp_dynamic_cast;
168
170
171 RCP<const ObjFactory> objFactory = rcp_dynamic_cast<const ObjFactory>(linObjFactory_);
172 return objFactory->getThyraMatrix();
173}
174#endif
175
178
179} // end namespace panzer