11 #ifndef __Panzer_Response_Probe_impl_hpp__
12 #define __Panzer_Response_Probe_impl_hpp__
14 #include "Teuchos_Comm.hpp"
15 #include "Teuchos_CommHelpers.hpp"
16 #include "Teuchos_dyn_cast.hpp"
18 #include "PanzerDiscFE_config.hpp"
19 #ifdef PANZER_HAVE_EPETRA_STACK
20 #include "Epetra_LocalMap.h"
23 #include "Sacado_Traits.hpp"
27 template <
typename EvalT>
32 have_probe(false), linObjFactory_(linObjFact)
47 template <
typename EvalT>
54 if(ghostedContainer_!=Teuchos::null) ghostedContainer_->initialize();
57 template <
typename EvalT>
61 double glbValue = Sacado::scalarValue(value);
64 int locProc = have_probe ? this->getComm()->getRank() : this->getComm()->getSize();
66 Teuchos::reduceAll(*this->getComm(),
Teuchos::REDUCE_MIN, Thyra::Ordinal(1), &locProc, &glbProc);
71 Teuchos::broadcast(*this->getComm(), glbProc, Thyra::Ordinal(1), &glbValue);
76 #ifdef PANZER_HAVE_EPETRA_STACK
77 if(this->useEpetra()) {
79 this->getEpetraVector()[0] = glbValue;
87 this->getThyraVector()[0] = glbValue;
95 using Teuchos::rcp_dynamic_cast;
99 uniqueContainer_ = linObjFactory_->buildLinearObjContainer();
104 uniqueContainer_ = Teuchos::null;
107 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
112 using Teuchos::rcp_dynamic_cast;
116 uniqueContainer_ = linObjFactory_->buildLinearObjContainer();
121 uniqueContainer_ = Teuchos::null;
129 const int n = value.size();
130 const int num_deriv = this->numDeriv();
133 value.resize(num_deriv);
137 int locProc = have_probe ? this->getComm()->getRank() : this->getComm()->getSize();
139 Teuchos::reduceAll(*this->getComm(),
Teuchos::REDUCE_MIN, Thyra::Ordinal(1), &locProc, &glbProc);
144 Teuchos::broadcast(*this->getComm(), glbProc, Thyra::Ordinal(num_deriv), &value.fastAccessDx(0));
148 #ifdef PANZER_HAVE_EPETRA_STACK
149 if(this->useEpetra()) {
152 for (
int i=0; i<num_deriv; ++i)
153 deriv[i][0] = value.dx(i);
160 Thyra::ArrayRCP< Thyra::ArrayRCP<double> > deriv = this->getThyraMultiVector();
161 for (
int i=0; i<num_deriv; ++i)
162 deriv[i][0] = value.dx(i);
167 template <
typename EvalT>
176 setDerivativeVectorSpace(soln_vs);
179 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
185 setDerivativeVectorSpace(soln_vs);
190 template <
typename EvalT>
199 linObjFactory_->adjustForDirichletConditions(Teuchos::dyn_cast<const LinearObjContainer>(localBCRows),
200 Teuchos::dyn_cast<const LinearObjContainer>(globalBCRows),
201 *ghostedContainer_,
true,
true);
204 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
210 linObjFactory_->adjustForDirichletConditions(Teuchos::dyn_cast<const LinearObjContainer>(localBCRows),
211 Teuchos::dyn_cast<const LinearObjContainer>(globalBCRows),
212 *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)