1 #ifndef __Panzer_Response_Functional_impl_hpp__ 2 #define __Panzer_Response_Functional_impl_hpp__ 4 #include "Teuchos_Comm.hpp" 5 #include "Teuchos_CommHelpers.hpp" 6 #include "Teuchos_dyn_cast.hpp" 8 #include "Epetra_LocalMap.h" 10 #include "Sacado_Traits.hpp" 14 template <
typename EvalT>
18 double locValue = Sacado::ScalarValue<ScalarT>::eval(
value);
19 double glbValue = 0.0;
22 Teuchos::reduceAll(*this->getComm(), Teuchos::REDUCE_SUM, static_cast<Thyra::Ordinal>(1), &locValue,&glbValue);
27 if(this->useEpetra()) {
29 this->getEpetraVector()[0] = glbValue;
35 this->getThyraVector()[0] = glbValue;
43 using Teuchos::rcp_dynamic_cast;
48 if(dgdx_unique==Teuchos::null)
51 uniqueContainer_ = linObjFactory_->buildLinearObjContainer();
56 uniqueContainer_ = Teuchos::null;
59 #ifdef Panzer_BUILD_HESSIAN_SUPPORT 64 using Teuchos::rcp_dynamic_cast;
69 if(dgdx_unique==Teuchos::null)
72 uniqueContainer_ = linObjFactory_->buildLinearObjContainer();
77 uniqueContainer_ = Teuchos::null;
85 const int n =
value.size();
86 const int num_deriv = this->numDeriv();
95 Teuchos::reduceAll(*this->getComm(), Teuchos::REDUCE_SUM, Thyra::Ordinal(n),
value.dx(), &glbValue.fastAccessDx(0));
100 if(this->useEpetra()) {
103 for (
int i=0; i<num_deriv; ++i)
104 deriv[i][0] = glbValue.dx(i);
109 Thyra::ArrayRCP< Thyra::ArrayRCP<double> > deriv = this->getThyraMultiVector();
110 for (
int i=0; i<num_deriv; ++i)
111 deriv[i][0] = glbValue.dx(i);
116 template <
typename EvalT>
125 setDerivativeVectorSpace(soln_vs);
129 #ifdef Panzer_BUILD_HESSIAN_SUPPORT 134 setDerivativeVectorSpace(soln_vs);
139 template <
typename EvalT>
148 linObjFactory_->adjustForDirichletConditions(Teuchos::dyn_cast<const LinearObjContainer>(localBCRows),
149 Teuchos::dyn_cast<const LinearObjContainer>(globalBCRows),
150 *ghostedContainer_,
true,
true);
153 #ifdef Panzer_BUILD_HESSIAN_SUPPORT 159 linObjFactory_->adjustForDirichletConditions(Teuchos::dyn_cast<const LinearObjContainer>(localBCRows),
160 Teuchos::dyn_cast<const LinearObjContainer>(globalBCRows),
161 *ghostedContainer_,
true,
true);
TEUCHOS_DEPRECATED void reduceAll(const Comm< Ordinal > &comm, const EReductionType reductType, const Packet &send, Packet *globalReduct)
virtual void scatterResponse()
This simply does global summation, then shoves the result into a vector.
void setSolnVectorSpace(const Teuchos::RCP< const Thyra::VectorSpaceBase< double > > &soln_vs)
Set solution vector space.
#define TEUCHOS_ASSERT(assertion_test)
void adjustForDirichletConditions(const GlobalEvaluationData &localBCRows, const GlobalEvaluationData &globalBCRows)