void gradient_2(ROL::Vector<Real> &g, const ROL::Vector<Real> &u, const ROL::Vector<Real> &z, Real &tol) { Teuchos::RCP<Tpetra::MultiVector<> > gp = (Teuchos::dyn_cast<ROL::TpetraMultiVector<Real> >(g)).getVector(); Teuchos::RCP<const Tpetra::MultiVector<> > up = (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(u)).getVector(); Teuchos::RCP<const Tpetra::MultiVector<> > zp = (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(z)).getVector(); data_->updateMaterialDensity (zp); data_->ApplyAdjointJacobian2ToVec (gp, up, up); gp->update(alpha_, *zp, 0.5); }
void applyAdjointJacobian_2(ROL::Vector<Real> &ajv, const ROL::Vector<Real> &v, const ROL::Vector<Real> &u, const ROL::Vector<Real> &z, Real &tol) { Teuchos::RCP<Tpetra::MultiVector<> > ajvp = (Teuchos::dyn_cast<ROL::TpetraMultiVector<Real> >(ajv)).getVector(); Teuchos::RCP<const Tpetra::MultiVector<> > vp = (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(v)).getVector(); Teuchos::RCP<const Tpetra::MultiVector<> > up = (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(u)).getVector(); Teuchos::RCP<const Tpetra::MultiVector<> > zp = (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(z)).getVector(); data_->updateMaterialDensity (zp); data_->ApplyAdjointJacobian2ToVec (ajvp, up, vp); }
void gradient_2(ROL::Vector<Real> &g, const ROL::Vector<Real> &u, const ROL::Vector<Real> &z, Real &tol) { Teuchos::RCP<Tpetra::MultiVector<> > gp = (Teuchos::dyn_cast<ROL::TpetraMultiVector<Real> >(g)).getVector(); if ( useFU_ ) { g.zero(); } else { Teuchos::RCP<const Tpetra::MultiVector<> > up = (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(u)).getVector(); Teuchos::RCP<Tpetra::MultiVector<> > tmp = Teuchos::rcp(new Tpetra::MultiVector<>(gp->getMap(), 1)); data_->ApplyAdjointJacobian2ToVec (tmp, up, up); filter_->apply(gp, tmp); } }
void hessVec_21(ROL::Vector<Real> &hv, const ROL::Vector<Real> &v, const ROL::Vector<Real> &u, const ROL::Vector<Real> &z, Real &tol) { if ( useFU_ ) { hv.zero(); } else { Teuchos::RCP<Tpetra::MultiVector<> > hvp = (Teuchos::dyn_cast<ROL::TpetraMultiVector<Real> >(hv)).getVector(); Teuchos::RCP<const Tpetra::MultiVector<> > vp = (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(v)).getVector(); Teuchos::RCP<const Tpetra::MultiVector<> > up = (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(u)).getVector(); Teuchos::RCP<Tpetra::MultiVector<> > tmp = Teuchos::rcp(new Tpetra::MultiVector<>(hvp->getMap(), 1)); data_->ApplyAdjointJacobian2ToVec (tmp, up, vp); filter_->apply(hvp, tmp); Real two(2); hvp->scale(two*scale_); } }