Esempio n. 1
0
 void applyAdjointHessian_22(ROL::Vector<Real> &ahwv, const ROL::Vector<Real> &w, const ROL::Vector<Real> &v,
                             const ROL::Vector<Real> &u, const ROL::Vector<Real> &z, Real &tol) {
   Teuchos::RCP<Tpetra::MultiVector<> > ahwvp = (Teuchos::dyn_cast<ROL::TpetraMultiVector<Real> >(ahwv)).getVector();
   Teuchos::RCP<const Tpetra::MultiVector<> > wp = (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(w)).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_->ApplyAdjointHessian22ToVec (ahwvp, up, vp, wp);
 }
 void hessVec_22(ROL::Vector<Real> &hv, const ROL::Vector<Real> &v,
                 const ROL::Vector<Real> &u, const ROL::Vector<Real> &z, Real &tol) {
   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<const Tpetra::MultiVector<> > zp = (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(z)).getVector();
   
   data_->updateMaterialDensity (zp);
   data_->ApplyAdjointHessian22ToVec (hvp, up, vp, up);
   hvp->update(alpha_, *vp, 0.5);
 }
Esempio n. 3
0
 void hessVec_22(ROL::Vector<Real> &hv,
           const ROL::Vector<Real> &v,
           const ROL::Vector<Real> &u,
           const ROL::Vector<Real> &z,
                 Real &tol) {
   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();
   if ( useFU_ ) {
     hv.zero();
   }
   else {
     Teuchos::RCP<const Tpetra::MultiVector<> > up
       = (Teuchos::dyn_cast<const ROL::TpetraMultiVector<Real> >(u)).getVector();
     Teuchos::RCP<Tpetra::MultiVector<> > Fvp
       = Teuchos::rcp(new Tpetra::MultiVector<>(vp->getMap(), 1));
     filter_->apply(Fvp, vp);
     Teuchos::RCP<Tpetra::MultiVector<> > tmp
       = Teuchos::rcp(new Tpetra::MultiVector<>(hvp->getMap(), 1));
     data_->ApplyAdjointHessian22ToVec (tmp, up, Fvp, up);
     filter_->apply(hvp, tmp);
   }
 }