コード例 #1
0
ファイル: objective.hpp プロジェクト: cihanuq/Trilinos
 void hessVec_11(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();
     data_->ApplyJacobian1ToVec(hvp, vp);
     Real two(2);
     hvp->scale(two*scale_);
   }
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
 void gradient_2(ROL::Vector<Real> &g, const ROL::Vector<Real> &u,
                 const ROL::Vector<Real> &z, Real &tol ) {
     try {
         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();
         assembler_->assembleQoIGradient2(qoi_,up,zp);
         gp->scale(static_cast<Real>(1),*(assembler_->getQoIGradient2()));
     }
     catch ( Exception::Zero & ez ) {
         g.zero();
     }
     catch ( Exception::NotImplemented & eni ) {
         ROL::ParametrizedObjective_SimOpt<Real>::gradient_2(g,u,z,tol);
     }
 }
コード例 #4
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 ) {
     try {
         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();
         assembler_->assembleQoIHessVec22(qoi_,vp,up,zp);
         hvp->scale(static_cast<Real>(1),*(assembler_->getQoIHessVec22()));
     }
     catch (Exception::Zero &ez) {
         hv.zero();
     }
     catch (Exception::NotImplemented &eni) {
         ROL::ParametrizedObjective_SimOpt<Real>::hessVec_22(hv,v,u,z,tol);
         //throw Exception::NotImplemented(">>> (IntegratedObjective::hessVec_22): Hessian not implemented.");
     }
 }
コード例 #5
0
ファイル: objective.hpp プロジェクト: cihanuq/Trilinos
 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_);
   }
 }
コード例 #6
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) 
  {
	  ahwv.zero();	
  }