43 #ifndef __Panzer_Response_Probe_impl_hpp__
44 #define __Panzer_Response_Probe_impl_hpp__
46 #include "Teuchos_Comm.hpp"
47 #include "Teuchos_CommHelpers.hpp"
48 #include "Teuchos_dyn_cast.hpp"
50 #include "Epetra_LocalMap.h"
52 #include "Sacado_Traits.hpp"
56 template <
typename EvalT>
61 have_probe(false), linObjFactory_(linObjFact)
76 template <
typename EvalT>
83 if(ghostedContainer_!=Teuchos::null) ghostedContainer_->initialize();
86 template <
typename EvalT>
90 double glbValue = Sacado::ScalarValue<ScalarT>::eval(value);
93 int locProc = have_probe ? this->getComm()->getRank() : this->getComm()->getSize();
100 Teuchos::broadcast(*this->getComm(), glbProc, Thyra::Ordinal(1), &glbValue);
105 if(this->useEpetra()) {
107 this->getEpetraVector()[0] = glbValue;
113 this->getThyraVector()[0] = glbValue;
121 using Teuchos::rcp_dynamic_cast;
125 uniqueContainer_ = linObjFactory_->buildLinearObjContainer();
130 uniqueContainer_ = Teuchos::null;
133 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
138 using Teuchos::rcp_dynamic_cast;
142 uniqueContainer_ = linObjFactory_->buildLinearObjContainer();
147 uniqueContainer_ = Teuchos::null;
155 const int n = value.size();
156 const int num_deriv = this->numDeriv();
159 value.resize(num_deriv);
163 int locProc = have_probe ? this->getComm()->getRank() : this->getComm()->getSize();
170 Teuchos::broadcast(*this->getComm(), glbProc, Thyra::Ordinal(num_deriv), &value.fastAccessDx(0));
174 if(this->useEpetra()) {
177 for (
int i=0; i<num_deriv; ++i)
178 deriv[i][0] = value.dx(i);
183 Thyra::ArrayRCP< Thyra::ArrayRCP<double> > deriv = this->getThyraMultiVector();
184 for (
int i=0; i<num_deriv; ++i)
185 deriv[i][0] = value.dx(i);
190 template <
typename EvalT>
199 setDerivativeVectorSpace(soln_vs);
202 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
208 setDerivativeVectorSpace(soln_vs);
213 template <
typename EvalT>
222 linObjFactory_->adjustForDirichletConditions(Teuchos::dyn_cast<const LinearObjContainer>(localBCRows),
223 Teuchos::dyn_cast<const LinearObjContainer>(globalBCRows),
224 *ghostedContainer_,
true,
true);
227 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
233 linObjFactory_->adjustForDirichletConditions(Teuchos::dyn_cast<const LinearObjContainer>(localBCRows),
234 Teuchos::dyn_cast<const LinearObjContainer>(globalBCRows),
235 *ghostedContainer_,
true,
true);
virtual void scatterResponse()
This simply does global summation, then shoves the result into a vector.
Teuchos::RCP< LinearObjContainer > ghostedContainer_
Teuchos::RCP< const panzer::LinearObjFactory< panzer::Traits > > linObjFactory_
void adjustForDirichletConditions(const GlobalEvaluationData &localBCRows, const GlobalEvaluationData &globalBCRows)
TEUCHOS_DEPRECATED void reduceAll(const Comm< Ordinal > &comm, const EReductionType reductType, const Packet &send, Packet *globalReduct)
Teuchos::RCP< const panzer::ThyraObjFactory< double > > thyraObjFactory_
void setSolnVectorSpace(const Teuchos::RCP< const Thyra::VectorSpaceBase< double > > &soln_vs)
Set solution vector space.
virtual void initializeResponse()
#define TEUCHOS_ASSERT(assertion_test)