34 have_probe(false), linObjFactory_(linObjFact)
47 if constexpr (std::is_same<EvalT,panzer::Traits::Jacobian>::value) {
67 double glbValue = Sacado::scalarValue(value);
70 int locProc = have_probe ? this->getComm()->getRank() : this->getComm()->getSize();
72 Teuchos::reduceAll(*this->getComm(), Teuchos::REDUCE_MIN, Thyra::Ordinal(1), &locProc, &glbProc);
74 TEUCHOS_ASSERT(glbProc < this->getComm()->getSize());
77 Teuchos::broadcast(*this->getComm(), glbProc, Thyra::Ordinal(1), &glbValue);
82#ifdef PANZER_HAVE_EPETRA_STACK
83 if(this->useEpetra()) {
85 this->getEpetraVector()[0] = glbValue;
91 TEUCHOS_ASSERT(this->useThyra());
93 this->getThyraVector()[0] = glbValue;
101 using Teuchos::rcp_dynamic_cast;
109 int locProc = have_probe ? this->getComm()->getRank() : this->getComm()->getSize();
111 Teuchos::reduceAll(*this->getComm(), Teuchos::REDUCE_MIN, Thyra::Ordinal(1), &locProc, &glbProc);
112 TEUCHOS_ASSERT(glbProc < this->getComm()->getSize());
114 if (this->getComm()->getRank() != glbProc) {
115 auto ghosted = rcp_dynamic_cast<ThyraObjContainer<double> >(ghostedContainer_);
116 Thyra::assign(ghosted->get_x_th().ptr(),0.0);
119 Teuchos::RCP<Thyra::MultiVectorBase<double> > dgdx_unique = getDerivative();
121 uniqueContainer_ = linObjFactory_->buildLinearObjContainer();
122 Teuchos::rcp_dynamic_cast<ThyraObjContainer<double> >(uniqueContainer_)->set_x_th(dgdx_unique->col(0));
126 uniqueContainer_ = Teuchos::null;
134 using Teuchos::rcp_dynamic_cast;
136 Teuchos::RCP<Thyra::MultiVectorBase<double> > dgdx_unique = getDerivative();
138 uniqueContainer_ = linObjFactory_->buildLinearObjContainer();
139 Teuchos::rcp_dynamic_cast<ThyraObjContainer<double> >(uniqueContainer_)->set_x_th(dgdx_unique->col(0));
143 uniqueContainer_ = Teuchos::null;
152 if (!this->hasTargetVector())
155 const int n = value.size();
156 const int num_deriv = this->numDeriv();
157 TEUCHOS_ASSERT(n == 0 || n == num_deriv);
159 value.resize(num_deriv);
163 int locProc = have_probe ? this->getComm()->getRank() : this->getComm()->getSize();
165 Teuchos::reduceAll(*this->getComm(), Teuchos::REDUCE_MIN, Thyra::Ordinal(1), &locProc, &glbProc);
167 TEUCHOS_ASSERT(glbProc < this->getComm()->getSize());
170 Teuchos::broadcast(*this->getComm(), glbProc, Thyra::Ordinal(num_deriv), &value.fastAccessDx(0));
174#ifdef PANZER_HAVE_EPETRA_STACK
175 if(this->useEpetra()) {
177 Epetra_MultiVector& deriv = this->getEpetraMultiVector();
178 for (
int i=0; i<num_deriv; ++i)
179 deriv[i][0] = value.dx(i);
185 TEUCHOS_ASSERT(this->useThyra());
186 Thyra::ArrayRCP< Thyra::ArrayRCP<double> > deriv = this->getThyraMultiVector();
187 for (
int i=0; i<num_deriv; ++i) {
188 deriv[i][0] = value.dx(i);