Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_Response_Residual.cpp
Go to the documentation of this file.
2 
5 
6 #include "Thyra_VectorSpaceBase.hpp"
7 
8 namespace panzer {
9 
12 
16 {
17  using Teuchos::RCP;
18  using Teuchos::rcp_dynamic_cast;
19 
21 
22  // if already computed, uses that ghosted vector
23  if(ghostedResidual_!=Teuchos::null)
24  return ghostedResidual_;
25 
26  // otherwise, allocate a new ghosted vector
27  RCP<LinearObjContainer> loc = linObjFactory_->buildGhostedLinearObjContainer();
28  linObjFactory_->initializeGhostedContainer(LinearObjContainer::F,*loc);
29 
30  RCP<TOC> th_loc = rcp_dynamic_cast<TOC>(loc);
31  return th_loc->get_f_th();
32 }
33 
36 getResidual() const
37 {
38  return residual_;
39 }
40 
41 void
44 {
45  residual_ = res;
46 }
47 
51 {
52  using Teuchos::RCP;
53  using Teuchos::rcp_dynamic_cast;
54 
56 
57  RCP<const ObjFactory> objFactory = rcp_dynamic_cast<const ObjFactory>(linObjFactory_);
58  return Thyra::createMember(objFactory->getThyraRangeSpace());
59 }
60 
63 
67 {
68  using Teuchos::RCP;
69  using Teuchos::rcp_dynamic_cast;
70 
72 
73  // if already computed, uses that ghosted vector
74  if(ghostedJacobian_!=Teuchos::null)
75  return ghostedJacobian_;
76 
77  // otherwise, allocate a new ghosted vector
78  RCP<LinearObjContainer> loc = linObjFactory_->buildGhostedLinearObjContainer();
79  linObjFactory_->initializeGhostedContainer(LinearObjContainer::Mat,*loc);
80 
81  RCP<TOC> th_loc = rcp_dynamic_cast<TOC>(loc);
82  return th_loc->get_A_th();
83 }
84 
87 getJacobian() const
88 {
89  return jacobian_;
90 }
91 
92 void
95 {
96  jacobian_ = jac;
97 }
98 
102 {
103  using Teuchos::RCP;
104  using Teuchos::rcp_dynamic_cast;
105 
107 
108  RCP<const ObjFactory> objFactory = rcp_dynamic_cast<const ObjFactory>(linObjFactory_);
109  return objFactory->getThyraMatrix();
110 }
111 
114 
115 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
116 
120 {
121  using Teuchos::RCP;
122  using Teuchos::rcp_dynamic_cast;
123 
125 
126  // if already computed, uses that ghosted vector
127  if(ghostedHessian_!=Teuchos::null)
128  return ghostedHessian_;
129 
130  // otherwise, allocate a new ghosted vector
131  RCP<LinearObjContainer> loc = linObjFactory_->buildGhostedLinearObjContainer();
132  linObjFactory_->initializeGhostedContainer(LinearObjContainer::Mat,*loc);
133 
134  RCP<TOC> th_loc = rcp_dynamic_cast<TOC>(loc);
135  return th_loc->get_A_th();
136 }
137 
140 getHessian() const
141 {
142  return hessian_;
143 }
144 
145 void
148 {
149  hessian_ = jac;
150 }
151 
155 {
156  using Teuchos::RCP;
157  using Teuchos::rcp_dynamic_cast;
158 
160 
161  RCP<const ObjFactory> objFactory = rcp_dynamic_cast<const ObjFactory>(linObjFactory_);
162  return objFactory->getThyraMatrix();
163 }
164 #endif
165 
168 
169 } // end namespace panzer
Teuchos::RCP< Thyra::VectorBase< panzer::Traits::RealType > > getGhostedResidual() const