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 "PanzerDiscFE_config.hpp"
51 #ifdef PANZER_HAVE_EPETRA_STACK
52 #include "Epetra_LocalMap.h"
55 #include "Sacado_Traits.hpp"
59 template <
typename EvalT>
64 have_probe(false), linObjFactory_(linObjFact)
79 template <
typename EvalT>
86 if(ghostedContainer_!=Teuchos::null) ghostedContainer_->initialize();
89 template <
typename EvalT>
93 double glbValue = Sacado::scalarValue(value);
96 int locProc = have_probe ? this->getComm()->getRank() : this->getComm()->getSize();
98 Teuchos::reduceAll(*this->getComm(),
Teuchos::REDUCE_MIN, Thyra::Ordinal(1), &locProc, &glbProc);
103 Teuchos::broadcast(*this->getComm(), glbProc, Thyra::Ordinal(1), &glbValue);
108 #ifdef PANZER_HAVE_EPETRA_STACK
109 if(this->useEpetra()) {
111 this->getEpetraVector()[0] = glbValue;
119 this->getThyraVector()[0] = glbValue;
127 using Teuchos::rcp_dynamic_cast;
131 uniqueContainer_ = linObjFactory_->buildLinearObjContainer();
136 uniqueContainer_ = Teuchos::null;
139 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
144 using Teuchos::rcp_dynamic_cast;
148 uniqueContainer_ = linObjFactory_->buildLinearObjContainer();
153 uniqueContainer_ = Teuchos::null;
161 const int n = value.size();
162 const int num_deriv = this->numDeriv();
165 value.resize(num_deriv);
169 int locProc = have_probe ? this->getComm()->getRank() : this->getComm()->getSize();
171 Teuchos::reduceAll(*this->getComm(),
Teuchos::REDUCE_MIN, Thyra::Ordinal(1), &locProc, &glbProc);
176 Teuchos::broadcast(*this->getComm(), glbProc, Thyra::Ordinal(num_deriv), &value.fastAccessDx(0));
180 #ifdef PANZER_HAVE_EPETRA_STACK
181 if(this->useEpetra()) {
184 for (
int i=0; i<num_deriv; ++i)
185 deriv[i][0] = value.dx(i);
192 Thyra::ArrayRCP< Thyra::ArrayRCP<double> > deriv = this->getThyraMultiVector();
193 for (
int i=0; i<num_deriv; ++i)
194 deriv[i][0] = value.dx(i);
199 template <
typename EvalT>
208 setDerivativeVectorSpace(soln_vs);
211 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
217 setDerivativeVectorSpace(soln_vs);
222 template <
typename EvalT>
231 linObjFactory_->adjustForDirichletConditions(Teuchos::dyn_cast<const LinearObjContainer>(localBCRows),
232 Teuchos::dyn_cast<const LinearObjContainer>(globalBCRows),
233 *ghostedContainer_,
true,
true);
236 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
242 linObjFactory_->adjustForDirichletConditions(Teuchos::dyn_cast<const LinearObjContainer>(localBCRows),
243 Teuchos::dyn_cast<const LinearObjContainer>(globalBCRows),
244 *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::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)