20 #include "ROL_TeuchosBatchManager.hpp"
22 #include "Teuchos_LAPACK.hpp"
50 void update(std::vector<Real> &u,
const std::vector<Real> &s,
const Real alpha=1.0)
const {
51 for (
unsigned i=0; i<u.size(); i++) {
56 void axpy(std::vector<Real> &out,
const Real a,
const std::vector<Real> &x,
const std::vector<Real> &y)
const {
57 for (
unsigned i=0; i < x.size(); i++) {
58 out[i] = a*x[i] + y[i];
62 void scale(std::vector<Real> &u,
const Real alpha=0.0)
const {
63 for (
unsigned i=0; i<u.size(); i++) {
68 void linear_solve(std::vector<Real> &u, std::vector<Real> &dl, std::vector<Real> &d, std::vector<Real> &du,
69 const std::vector<Real> &r,
const bool transpose =
false)
const {
70 if ( r.size() == 1 ) {
71 u.resize(1,r[0]/d[0]);
73 else if ( r.size() == 2 ) {
75 Real det = d[0]*d[1] - dl[0]*du[0];
76 u[0] = (d[1]*r[0] - du[0]*r[1])/det;
77 u[1] = (d[0]*r[1] - dl[0]*r[0])/det;
80 u.assign(r.begin(),r.end());
82 Teuchos::LAPACK<int,Real> lp;
83 std::vector<Real> du2(r.size()-2,0.0);
84 std::vector<int> ipiv(r.size(),0);
89 lp.GTTRF(dim,&dl[0],&d[0],&du[0],&du2[0],&ipiv[0],&info);
94 lp.GTTRS(trans,dim,nhrs,&dl[0],&d[0],&du[0],&du2[0],&ipiv[0],&u[0],ldb,&info);
99 BurgersFEM(
int nx = 128, Real nl = 1.0, Real cH1 = 1.0, Real cL2 = 1.0)
103 nu_ = std::pow(10.0,nu-2.0);
125 Real
compute_L2_dot(
const std::vector<Real> &x,
const std::vector<Real> &y)
const {
127 Real c = (((int)x.size()==
nx_) ? 4.0 : 2.0);
128 for (
unsigned i=0; i<x.size(); i++) {
130 ip +=
dx_/6.0*(c*x[i] + x[i+1])*y[i];
132 else if ( i == x.size()-1 ) {
133 ip +=
dx_/6.0*(x[i-1] + c*x[i])*y[i];
136 ip +=
dx_/6.0*(x[i-1] + 4.0*x[i] + x[i+1])*y[i];
148 void apply_mass(std::vector<Real> &Mu,
const std::vector<Real> &u )
const {
149 Mu.resize(u.size(),0.0);
150 Real c = (((int)u.size()==
nx_) ? 4.0 : 2.0);
151 for (
unsigned i=0; i<u.size(); i++) {
153 Mu[i] =
dx_/6.0*(c*u[i] + u[i+1]);
155 else if ( i == u.size()-1 ) {
156 Mu[i] =
dx_/6.0*(u[i-1] + c*u[i]);
159 Mu[i] =
dx_/6.0*(u[i-1] + 4.0*u[i] + u[i+1]);
166 unsigned nx = u.size();
168 std::vector<Real> dl(nx-1,
dx_/6.0);
169 std::vector<Real> d(nx,2.0*
dx_/3.0);
170 std::vector<Real> du(nx-1,
dx_/6.0);
171 if ( (
int)nx !=
nx_ ) {
180 std::vector<Real> u(
nx_,0.0), Mu(
nx_,0.0), iMMu(
nx_,0.0), diff(
nx_,0.0);
181 for (
int i = 0; i <
nx_; i++) {
182 u[i] = 2.0*(Real)rand()/(Real)RAND_MAX - 1.0;
186 axpy(diff,-1.0,iMMu,u);
189 outStream <<
"Test Inverse State Mass Matrix\n";
190 outStream <<
" ||u - inv(M)Mu|| = " << error <<
"\n";
191 outStream <<
" ||u|| = " << normu <<
"\n";
192 outStream <<
" Relative Error = " << error/normu <<
"\n";
195 u.resize(nx_+2,0.0); Mu.resize(nx_+2,0.0); iMMu.resize(nx_+2,0.0); diff.resize(nx_+2,0.0);
196 for (
int i = 0; i < nx_+2; i++) {
197 u[i] = 2.0*(Real)rand()/(Real)RAND_MAX - 1.0;
201 axpy(diff,-1.0,iMMu,u);
204 outStream <<
"Test Inverse Control Mass Matrix\n";
205 outStream <<
" ||z - inv(M)Mz|| = " << error <<
"\n";
206 outStream <<
" ||z|| = " << normu <<
"\n";
207 outStream <<
" Relative Error = " << error/normu <<
"\n";
215 Real
compute_H1_dot(
const std::vector<Real> &x,
const std::vector<Real> &y)
const {
217 for (
int i=0; i<
nx_; i++) {
219 ip +=
cL2_*
dx_/6.0*(4.0*x[i] + x[i+1])*y[i];
220 ip +=
cH1_*(2.0*x[i] - x[i+1])/
dx_*y[i];
222 else if ( i == nx_-1 ) {
223 ip +=
cL2_*
dx_/6.0*(x[i-1] + 4.0*x[i])*y[i];
224 ip +=
cH1_*(2.0*x[i] - x[i-1])/
dx_*y[i];
227 ip +=
cL2_*
dx_/6.0*(x[i-1] + 4.0*x[i] + x[i+1])*y[i];
228 ip +=
cH1_*(2.0*x[i] - x[i-1] - x[i+1])/
dx_*y[i];
240 void apply_H1(std::vector<Real> &Mu,
const std::vector<Real> &u )
const {
242 for (
int i=0; i<
nx_; i++) {
244 Mu[i] =
cL2_*
dx_/6.0*(4.0*u[i] + u[i+1])
245 +
cH1_*(2.0*u[i] - u[i+1])/
dx_;
247 else if ( i == nx_-1 ) {
248 Mu[i] =
cL2_*
dx_/6.0*(u[i-1] + 4.0*u[i])
249 +
cH1_*(2.0*u[i] - u[i-1])/
dx_;
252 Mu[i] =
cL2_*
dx_/6.0*(u[i-1] + 4.0*u[i] + u[i+1])
253 +
cH1_*(2.0*u[i] - u[i-1] - u[i+1])/
dx_;
268 std::vector<Real> u(
nx_,0.0), Mu(
nx_,0.0), iMMu(
nx_,0.0), diff(
nx_,0.0);
269 for (
int i = 0; i <
nx_; i++) {
270 u[i] = 2.0*(Real)rand()/(Real)RAND_MAX - 1.0;
274 axpy(diff,-1.0,iMMu,u);
277 outStream <<
"Test Inverse State H1 Matrix\n";
278 outStream <<
" ||u - inv(M)Mu|| = " << error <<
"\n";
279 outStream <<
" ||u|| = " << normu <<
"\n";
280 outStream <<
" Relative Error = " << error/normu <<
"\n";
289 const std::vector<Real> &z)
const {
292 for (
int i=0; i<
nx_; i++) {
295 r[i] =
nu_/
dx_*(2.0*u[i]-u[i+1]);
298 r[i] =
nu_/
dx_*(2.0*u[i]-u[i-1]);
301 r[i] =
nu_/
dx_*(2.0*u[i]-u[i-1]-u[i+1]);
305 r[i] +=
nl_*u[i+1]*(u[i]+u[i+1])/6.0;
308 r[i] -=
nl_*u[i-1]*(u[i-1]+u[i])/6.0;
311 r[i] -=
dx_/6.0*(z[i]+4.0*z[i+1]+z[i+2]);
325 std::vector<Real> &d,
326 std::vector<Real> &du,
327 const std::vector<Real> &u)
const {
336 for (
int i=0; i<
nx_; i++) {
338 dl[i] +=
nl_*(-2.0*u[i]-u[i+1])/6.0;
339 d[i] +=
nl_*u[i+1]/6.0;
342 d[i] -=
nl_*u[i-1]/6.0;
343 du[i-1] +=
nl_*(u[i-1]+2.0*u[i])/6.0;
353 const std::vector<Real> &v,
354 const std::vector<Real> &u,
355 const std::vector<Real> &z)
const {
357 for (
int i = 0; i <
nx_; i++) {
360 jv[i] += -
nu_/
dx_*v[i-1]-
nl_*(u[i-1]/6.0*v[i]+(u[i]+2.0*u[i-1])/6.0*v[i-1]);
363 jv[i] += -
nu_/
dx_*v[i+1]+
nl_*(u[i+1]/6.0*v[i]+(u[i]+2.0*u[i+1])/6.0*v[i+1]);
366 jv[ 0] -=
nl_*
u0_/6.0*v[0];
367 jv[nx_-1] +=
nl_*
u1_/6.0*v[nx_-1];
372 const std::vector<Real> &v,
373 const std::vector<Real> &u,
374 const std::vector<Real> &z)
const {
376 std::vector<Real> d(
nx_,0.0);
377 std::vector<Real> dl(
nx_-1,0.0);
378 std::vector<Real> du(
nx_-1,0.0);
386 const std::vector<Real> &v,
387 const std::vector<Real> &u,
388 const std::vector<Real> &z)
const {
390 for (
int i = 0; i <
nx_; i++) {
391 ajv[i] =
nu_/
dx_*2.0*v[i];
393 ajv[i] += -
nu_/
dx_*v[i-1]-
nl_*(u[i-1]/6.0*v[i]
394 -(u[i-1]+2.0*u[i])/6.0*v[i-1]);
397 ajv[i] += -
nu_/
dx_*v[i+1]+
nl_*(u[i+1]/6.0*v[i]
398 -(u[i+1]+2.0*u[i])/6.0*v[i+1]);
401 ajv[ 0] -=
nl_*
u0_/6.0*v[0];
402 ajv[nx_-1] +=
nl_*
u1_/6.0*v[nx_-1];
407 const std::vector<Real> &v,
408 const std::vector<Real> &u,
409 const std::vector<Real> &z)
const {
411 std::vector<Real> d(
nx_,0.0);
412 std::vector<Real> du(
nx_-1,0.0);
413 std::vector<Real> dl(
nx_-1,0.0);
424 const std::vector<Real> &v,
425 const std::vector<Real> &u,
426 const std::vector<Real> &z)
const {
427 for (
int i=0; i<
nx_; i++) {
429 jv[i] = -
dx_/6.0*(v[i]+4.0*v[i+1]+v[i+2]);
435 const std::vector<Real> &v,
436 const std::vector<Real> &u,
437 const std::vector<Real> &z)
const {
438 for (
int i=0; i<
nx_+2; i++) {
440 jv[i] = -
dx_/6.0*v[i];
443 jv[i] = -
dx_/6.0*(4.0*v[i-1]+v[i]);
445 else if ( i == nx_ ) {
446 jv[i] = -
dx_/6.0*(4.0*v[i-1]+v[i-2]);
448 else if ( i == nx_+1 ) {
449 jv[i] = -
dx_/6.0*v[i-2];
452 jv[i] = -
dx_/6.0*(v[i-2]+4.0*v[i-1]+v[i]);
461 const std::vector<Real> &w,
462 const std::vector<Real> &v,
463 const std::vector<Real> &u,
464 const std::vector<Real> &z)
const {
465 for (
int i=0; i<
nx_; i++) {
469 ahwv[i] += (w[i]*v[i+1] - w[i+1]*(2.0*v[i]+v[i+1]))/6.0;
472 ahwv[i] += (w[i-1]*(v[i-1]+2.0*v[i]) - w[i]*v[i-1])/6.0;
478 const std::vector<Real> &w,
479 const std::vector<Real> &v,
480 const std::vector<Real> &u,
481 const std::vector<Real> &z) {
482 ahwv.assign(u.size(),0.0);
485 const std::vector<Real> &w,
486 const std::vector<Real> &v,
487 const std::vector<Real> &u,
488 const std::vector<Real> &z) {
489 ahwv.assign(z.size(),0.0);
492 const std::vector<Real> &w,
493 const std::vector<Real> &v,
494 const std::vector<Real> &u,
495 const std::vector<Real> &z) {
496 ahwv.assign(z.size(),0.0);
503 ROL::Ptr<std::vector<Real> >
vec_;
504 ROL::Ptr<BurgersFEM<Real> >
fem_;
506 mutable ROL::Ptr<L2VectorDual<Real> >
dual_vec_;
515 const std::vector<Real>& xval = *ex.
getVector();
516 std::copy(xval.begin(),xval.end(),
vec_->begin());
521 const std::vector<Real>& xval = *ex.
getVector();
524 (*vec_)[i] += xval[i];
537 const std::vector<Real>& xval = *ex.
getVector();
538 return fem_->compute_L2_dot(xval,*
vec_);
543 val = std::sqrt(
dot(*
this) );
547 ROL::Ptr<ROL::Vector<Real> >
clone()
const {
548 return ROL::makePtr<L2VectorPrimal>( ROL::makePtr<std::vector<Real>>(
vec_->size(),0.0),
fem_);
559 ROL::Ptr<ROL::Vector<Real> >
basis(
const int i )
const {
560 ROL::Ptr<L2VectorPrimal> e
561 = ROL::makePtr<L2VectorPrimal>( ROL::makePtr<std::vector<Real>>(
vec_->size(),0.0),
fem_);
562 (*e->getVector())[i] = 1.0;
571 dual_vec_ = ROL::makePtr<L2VectorDual<Real>>(
572 ROL::makePtr<std::vector<Real>>(*vec_),
fem_);
574 fem_->apply_mass(*(ROL::constPtrCast<std::vector<Real> >(
dual_vec_->getVector())),*
vec_);
580 const std::vector<Real>& xval = *ex.
getVector();
581 return std::inner_product(
vec_->begin(),
vec_->end(), xval.begin(), Real(0));
589 ROL::Ptr<std::vector<Real> >
vec_;
590 ROL::Ptr<BurgersFEM<Real> >
fem_;
592 mutable ROL::Ptr<L2VectorPrimal<Real> >
dual_vec_;
601 const std::vector<Real>& xval = *ex.
getVector();
602 std::copy(xval.begin(),xval.end(),
vec_->begin());
607 const std::vector<Real>& xval = *ex.
getVector();
610 (*vec_)[i] += xval[i];
623 const std::vector<Real>& xval = *ex.
getVector();
625 std::vector<Real> Mx(dimension,0.0);
626 fem_->apply_inverse_mass(Mx,xval);
628 for (
unsigned i = 0; i <
dimension; i++) {
629 val += Mx[i]*(*vec_)[i];
636 val = std::sqrt(
dot(*
this) );
640 ROL::Ptr<ROL::Vector<Real> >
clone()
const {
641 return ROL::makePtr<L2VectorDual>( ROL::makePtr<std::vector<Real>>(
vec_->size(),0.0),
fem_);
652 ROL::Ptr<ROL::Vector<Real> >
basis(
const int i )
const {
653 ROL::Ptr<L2VectorDual> e
654 = ROL::makePtr<L2VectorDual>( ROL::makePtr<std::vector<Real>>(
vec_->size(),0.0),
fem_);
655 (*e->getVector())[i] = 1.0;
664 dual_vec_ = ROL::makePtr<L2VectorPrimal<Real>>(
665 ROL::makePtr<std::vector<Real>>(*vec_),
fem_);
667 fem_->apply_inverse_mass(*(ROL::constPtrCast<std::vector<Real> >(
dual_vec_->getVector())),*
vec_);
673 const std::vector<Real>& xval = *ex.
getVector();
674 return std::inner_product(
vec_->begin(),
vec_->end(), xval.begin(), Real(0));
682 ROL::Ptr<std::vector<Real> >
vec_;
683 ROL::Ptr<BurgersFEM<Real> >
fem_;
685 mutable ROL::Ptr<H1VectorDual<Real> >
dual_vec_;
694 const std::vector<Real>& xval = *ex.
getVector();
695 std::copy(xval.begin(),xval.end(),
vec_->begin());
700 const std::vector<Real>& xval = *ex.
getVector();
703 (*vec_)[i] += xval[i];
716 const std::vector<Real>& xval = *ex.
getVector();
717 return fem_->compute_H1_dot(xval,*
vec_);
722 val = std::sqrt(
dot(*
this) );
726 ROL::Ptr<ROL::Vector<Real> >
clone()
const {
727 return ROL::makePtr<H1VectorPrimal>( ROL::makePtr<std::vector<Real>>(
vec_->size(),0.0),
fem_);
738 ROL::Ptr<ROL::Vector<Real> >
basis(
const int i )
const {
739 ROL::Ptr<H1VectorPrimal> e
740 = ROL::makePtr<H1VectorPrimal>( ROL::makePtr<std::vector<Real>>(
vec_->size(),0.0),
fem_);
741 (*e->getVector())[i] = 1.0;
750 dual_vec_ = ROL::makePtr<H1VectorDual<Real>>(
751 ROL::makePtr<std::vector<Real>>(*vec_),
fem_);
753 fem_->apply_H1(*(ROL::constPtrCast<std::vector<Real> >(
dual_vec_->getVector())),*
vec_);
759 const std::vector<Real>& xval = *ex.
getVector();
760 return std::inner_product(
vec_->begin(),
vec_->end(), xval.begin(), Real(0));
768 ROL::Ptr<std::vector<Real> >
vec_;
769 ROL::Ptr<BurgersFEM<Real> >
fem_;
771 mutable ROL::Ptr<H1VectorPrimal<Real> >
dual_vec_;
780 const std::vector<Real>& xval = *ex.
getVector();
781 std::copy(xval.begin(),xval.end(),
vec_->begin());
786 const std::vector<Real>& xval = *ex.
getVector();
789 (*vec_)[i] += xval[i];
802 const std::vector<Real>& xval = *ex.
getVector();
804 std::vector<Real> Mx(dimension,0.0);
805 fem_->apply_inverse_H1(Mx,xval);
807 for (
unsigned i = 0; i <
dimension; i++) {
808 val += Mx[i]*(*vec_)[i];
815 val = std::sqrt(
dot(*
this) );
819 ROL::Ptr<ROL::Vector<Real> >
clone()
const {
820 return ROL::makePtr<H1VectorDual>( ROL::makePtr<std::vector<Real>>(
vec_->size(),0.0),
fem_);
831 ROL::Ptr<ROL::Vector<Real> >
basis(
const int i )
const {
832 ROL::Ptr<H1VectorDual> e
833 = ROL::makePtr<H1VectorDual>( ROL::makePtr<std::vector<Real>>(
vec_->size(),0.0),
fem_);
834 (*e->getVector())[i] = 1.0;
843 dual_vec_ = ROL::makePtr<H1VectorPrimal<Real>>(
844 ROL::makePtr<std::vector<Real>>(*vec_),
fem_);
846 fem_->apply_inverse_H1(*(ROL::constPtrCast<std::vector<Real> >(
dual_vec_->getVector())),*
vec_);
852 const std::vector<Real>& xval = *ex.
getVector();
853 return std::inner_product(
vec_->begin(),
vec_->end(), xval.begin(), Real(0));
873 ROL::Ptr<BurgersFEM<Real> >
fem_;
882 ROL::Ptr<std::vector<Real> > cp =
884 ROL::Ptr<const std::vector<Real> > up =
886 ROL::Ptr<const std::vector<Real> > zp =
889 const std::vector<Real> param
891 fem_->set_problem_data(param[0],param[1],param[2],param[3]);
893 fem_->compute_residual(*cp,*up,*zp);
898 ROL::Ptr<std::vector<Real> > jvp =
900 ROL::Ptr<const std::vector<Real> > vp =
902 ROL::Ptr<const std::vector<Real> > up =
904 ROL::Ptr<const std::vector<Real> > zp =
907 const std::vector<Real> param
909 fem_->set_problem_data(param[0],param[1],param[2],param[3]);
911 fem_->apply_pde_jacobian(*jvp,*vp,*up,*zp);
916 ROL::Ptr<std::vector<Real> > jvp =
918 ROL::Ptr<const std::vector<Real> > vp =
920 ROL::Ptr<const std::vector<Real> > up =
922 ROL::Ptr<const std::vector<Real> > zp =
925 const std::vector<Real> param
927 fem_->set_problem_data(param[0],param[1],param[2],param[3]);
929 fem_->apply_control_jacobian(*jvp,*vp,*up,*zp);
934 ROL::Ptr<std::vector<Real> > ijvp =
936 ROL::Ptr<const std::vector<Real> > vp =
938 ROL::Ptr<const std::vector<Real> > up =
940 ROL::Ptr<const std::vector<Real> > zp =
943 const std::vector<Real> param
945 fem_->set_problem_data(param[0],param[1],param[2],param[3]);
947 fem_->apply_inverse_pde_jacobian(*ijvp,*vp,*up,*zp);
952 ROL::Ptr<std::vector<Real> > jvp =
954 ROL::Ptr<const std::vector<Real> > vp =
956 ROL::Ptr<const std::vector<Real> > up =
958 ROL::Ptr<const std::vector<Real> > zp =
961 const std::vector<Real> param
963 fem_->set_problem_data(param[0],param[1],param[2],param[3]);
965 fem_->apply_adjoint_pde_jacobian(*jvp,*vp,*up,*zp);
970 ROL::Ptr<std::vector<Real> > jvp =
972 ROL::Ptr<const std::vector<Real> > vp =
974 ROL::Ptr<const std::vector<Real> > up =
976 ROL::Ptr<const std::vector<Real> > zp =
979 const std::vector<Real> param
981 fem_->set_problem_data(param[0],param[1],param[2],param[3]);
983 fem_->apply_adjoint_control_jacobian(*jvp,*vp,*up,*zp);
988 ROL::Ptr<std::vector<Real> > iajvp =
990 ROL::Ptr<const std::vector<Real> > vp =
992 ROL::Ptr<const std::vector<Real> > up =
994 ROL::Ptr<const std::vector<Real> > zp =
997 const std::vector<Real> param
999 fem_->set_problem_data(param[0],param[1],param[2],param[3]);
1001 fem_->apply_inverse_adjoint_pde_jacobian(*iajvp,*vp,*up,*zp);
1007 ROL::Ptr<std::vector<Real> > ahwvp =
1009 ROL::Ptr<const std::vector<Real> > wp =
1011 ROL::Ptr<const std::vector<Real> > vp =
1013 ROL::Ptr<const std::vector<Real> > up =
1015 ROL::Ptr<const std::vector<Real> > zp =
1018 const std::vector<Real> param
1020 fem_->set_problem_data(param[0],param[1],param[2],param[3]);
1022 fem_->apply_adjoint_pde_hessian(*ahwvp,*wp,*vp,*up,*zp);
1032 ROL::Ptr<std::vector<Real> > ahwvp =
1034 ROL::Ptr<const std::vector<Real> > wp =
1036 ROL::Ptr<const std::vector<Real> > vp =
1038 ROL::Ptr<const std::vector<Real> > up =
1040 ROL::Ptr<const std::vector<Real> > zp =
1043 const std::vector<Real> param
1045 fem_->set_problem_data(param[0],param[1],param[2],param[3]);
1047 fem_->apply_adjoint_control_pde_hessian(*ahwvp,*wp,*vp,*up,*zp);
1056 ROL::Ptr<std::vector<Real> > ahwvp =
1058 ROL::Ptr<const std::vector<Real> > wp =
1060 ROL::Ptr<const std::vector<Real> > vp =
1062 ROL::Ptr<const std::vector<Real> > up =
1064 ROL::Ptr<const std::vector<Real> > zp =
1067 const std::vector<Real> param
1069 fem_->set_problem_data(param[0],param[1],param[2],param[3]);
1071 fem_->apply_adjoint_pde_control_hessian(*ahwvp,*wp,*vp,*up,*zp);
1080 ROL::Ptr<std::vector<Real> > ahwvp =
1082 ROL::Ptr<const std::vector<Real> > wp =
1084 ROL::Ptr<const std::vector<Real> > vp =
1086 ROL::Ptr<const std::vector<Real> > up =
1088 ROL::Ptr<const std::vector<Real> > zp =
1091 const std::vector<Real> param
1093 fem_->set_problem_data(param[0],param[1],param[2],param[3]);
1095 fem_->apply_adjoint_control_hessian(*ahwvp,*wp,*vp,*up,*zp);
1103 template<
class Real>
1115 ROL::Ptr<BurgersFEM<Real> >
fem_;
1122 Real x = 0.0) :
fem_(fem),
x_(x) {
1123 for (
int i = 1; i <
fem_->num_dof()+1; i++) {
1124 if ( (Real)i*(
fem_->mesh_spacing()) >=
x_ ) {
1133 ROL::Ptr<const std::vector<Real> > up =
1143 Real val = 0.5*((((Real)
indices_[0]+1.)*(
fem_->mesh_spacing())-
x_)
1146 for (
uint i = 1; i < indices_.size(); i++) {
1147 val += (
fem_->mesh_spacing())*(*up)[indices_[i]];
1153 ROL::Ptr<std::vector<Real> > gp =
1155 ROL::Ptr<const std::vector<Real> > up =
1167 (*gp)[
indices_[0]] = -0.5*((((Real)indices_[0]+1.)*(
fem_->mesh_spacing())-
x_)
1168 *(
x_+(2.-((Real)indices_[0]+1.))*(
fem_->mesh_spacing()))/(
fem_->mesh_spacing())
1169 +(
fem_->mesh_spacing()));
1172 for (
uint i = 1; i < indices_.size(); i++) {
1173 (*gp)[indices_[i]] = -(
fem_->mesh_spacing());
1215 template<
class Real>
1219 std::vector<Real>
x_lo_;
1220 std::vector<Real>
x_up_;
1223 ROL::Ptr<BurgersFEM<Real> >
fem_;
1224 ROL::Ptr<ROL::Vector<Real> >
l_;
1225 ROL::Ptr<ROL::Vector<Real> >
u_;
1232 catch (std::exception &e) {
1242 catch (std::exception &e) {
1247 void axpy(std::vector<Real> &out,
const Real a,
1248 const std::vector<Real> &x,
const std::vector<Real> &y)
const{
1249 out.resize(
dim_,0.0);
1250 for (
unsigned i = 0; i <
dim_; i++) {
1251 out[i] = a*x[i] + y[i];
1256 for (
int i = 0; i <
dim_; i++ ) {
1257 x[i] = std::max(
x_lo_[i],std::min(
x_up_[i],x[i]));
1266 for (
int i = 0; i <
dim_; i++ ) {
1275 l_ = ROL::makePtr<L2VectorPrimal<Real>>(
1276 ROL::makePtr<std::vector<Real>>(l), fem);
1277 u_ = ROL::makePtr<L2VectorPrimal<Real>>(
1278 ROL::makePtr<std::vector<Real>>(u), fem);
1285 for (
int i = 0; i <
dim_; i++ ) {
1286 if ( (*ex)[i] >=
x_lo_[i] && (*ex)[i] <=
x_up_[i] ) { cnt *= 1; }
1289 if ( cnt == 0 ) { val =
false; }
1294 ROL::Ptr<std::vector<Real> > ex;
cast_vector(ex,x);
1300 ROL::Ptr<std::vector<Real> > ev;
cast_vector(ev,v);
1302 for (
int i = 0; i <
dim_; i++ ) {
1303 if ( ((*ex)[i] <=
x_lo_[i]+epsn) ) {
1311 ROL::Ptr<std::vector<Real> > ev;
cast_vector(ev,v);
1313 for (
int i = 0; i <
dim_; i++ ) {
1314 if ( ((*ex)[i] >=
x_up_[i]-epsn) ) {
1322 ROL::Ptr<std::vector<Real> > ev;
cast_vector(ev,v);
1324 for (
int i = 0; i <
dim_; i++ ) {
1325 if ( ((*ex)[i] <=
x_lo_[i]+epsn) ||
1326 ((*ex)[i] >=
x_up_[i]-epsn) ) {
1335 ROL::Ptr<std::vector<Real> > ev;
cast_vector(ev,v);
1337 for (
int i = 0; i <
dim_; i++ ) {
1338 if ( ((*ex)[i] <=
x_lo_[i]+epsn && (*eg)[i] > geps) ) {
1347 ROL::Ptr<std::vector<Real> > ev;
cast_vector(ev,v);
1349 for (
int i = 0; i <
dim_; i++ ) {
1350 if ( ((*ex)[i] >=
x_up_[i]-epsn && (*eg)[i] < -geps) ) {
1359 ROL::Ptr<std::vector<Real> > ev;
cast_vector(ev,v);
1361 for (
int i = 0; i <
dim_; i++ ) {
1362 if ( ((*ex)[i] <=
x_lo_[i]+epsn && (*eg)[i] > geps) ||
1363 ((*ex)[i] >=
x_up_[i]-epsn && (*eg)[i] < -geps) ) {
1378 template<
class Real>
1382 std::vector<Real>
x_lo_;
1383 std::vector<Real>
x_up_;
1386 ROL::Ptr<BurgersFEM<Real> >
fem_;
1387 ROL::Ptr<ROL::Vector<Real> >
l_;
1388 ROL::Ptr<ROL::Vector<Real> >
u_;
1393 xvec = ROL::constPtrCast<std::vector<Real> >(
1396 catch (std::exception &e) {
1397 xvec = ROL::constPtrCast<std::vector<Real> >(
1408 catch (std::exception &e) {
1414 void axpy(std::vector<Real> &out,
const Real a,
1415 const std::vector<Real> &x,
const std::vector<Real> &y)
const{
1416 out.resize(
dim_,0.0);
1417 for (
unsigned i = 0; i <
dim_; i++) {
1418 out[i] = a*x[i] + y[i];
1423 for (
int i = 0; i <
dim_; i++ ) {
1424 x[i] = std::max(
x_lo_[i],std::min(
x_up_[i],x[i]));
1433 for (
int i = 0; i <
dim_; i++ ) {
1442 l_ = ROL::makePtr<H1VectorPrimal<Real>>(
1443 ROL::makePtr<std::vector<Real>>(l), fem);
1444 u_ = ROL::makePtr<H1VectorPrimal<Real>>(
1445 ROL::makePtr<std::vector<Real>>(u), fem);
1452 for (
int i = 0; i <
dim_; i++ ) {
1453 if ( (*ex)[i] >=
x_lo_[i] && (*ex)[i] <=
x_up_[i] ) { cnt *= 1; }
1456 if ( cnt == 0 ) { val =
false; }
1461 ROL::Ptr<std::vector<Real> > ex;
cast_vector(ex,x);
1467 ROL::Ptr<std::vector<Real> > ev;
cast_vector(ev,v);
1469 for (
int i = 0; i <
dim_; i++ ) {
1470 if ( ((*ex)[i] <=
x_lo_[i]+epsn) ) {
1478 ROL::Ptr<std::vector<Real> > ev;
cast_vector(ev,v);
1480 for (
int i = 0; i <
dim_; i++ ) {
1481 if ( ((*ex)[i] >=
x_up_[i]-epsn) ) {
1489 ROL::Ptr<std::vector<Real> > ev;
cast_vector(ev,v);
1491 for (
int i = 0; i <
dim_; i++ ) {
1492 if ( ((*ex)[i] <=
x_lo_[i]+epsn) ||
1493 ((*ex)[i] >=
x_up_[i]-epsn) ) {
1502 ROL::Ptr<std::vector<Real> > ev;
cast_vector(ev,v);
1504 for (
int i = 0; i <
dim_; i++ ) {
1505 if ( ((*ex)[i] <=
x_lo_[i]+epsn && (*eg)[i] > geps) ) {
1514 ROL::Ptr<std::vector<Real> > ev;
cast_vector(ev,v);
1516 for (
int i = 0; i <
dim_; i++ ) {
1517 if ( ((*ex)[i] >=
x_up_[i]-epsn && (*eg)[i] < -geps) ) {
1526 ROL::Ptr<std::vector<Real> > ev;
cast_vector(ev,v);
1528 for (
int i = 0; i <
dim_; i++ ) {
1529 if ( ((*ex)[i] <=
x_lo_[i]+epsn && (*eg)[i] > geps) ||
1530 ((*ex)[i] >=
x_up_[i]-epsn && (*eg)[i] < -geps) ) {
1545 template<
class Real,
class Ordinal>
1551 xvec = ROL::constPtrCast<std::vector<Real> >(
1554 catch (std::exception &e) {
1555 xvec = ROL::constPtrCast<std::vector<Real> >(
1562 : ROL::TeuchosBatchManager<Real,Ordinal>(comm) {}
1564 ROL::Ptr<std::vector<Real> > input_ptr;
1566 int dim_i = input_ptr->size();
1567 ROL::Ptr<std::vector<Real> > output_ptr;
1569 int dim_o = output_ptr->size();
1570 if ( dim_i != dim_o ) {
1571 std::cout <<
"L2VectorBatchManager: DIMENSION MISMATCH ON RANK "
1572 << ROL::TeuchosBatchManager<Real,Ordinal>::batchID() <<
"\n";
1575 ROL::TeuchosBatchManager<Real,Ordinal>::sumAll(&(*input_ptr)[0],&(*output_ptr)[0],dim_i);
1580 template<
class Real,
class Ordinal>
1586 xvec = ROL::constPtrCast<std::vector<Real> >(
1589 catch (std::exception &e) {
1590 xvec = ROL::constPtrCast<std::vector<Real> >(
1597 : ROL::TeuchosBatchManager<Real,Ordinal>(comm) {}
1599 ROL::Ptr<std::vector<Real> > input_ptr;
1601 int dim_i = input_ptr->size();
1602 ROL::Ptr<std::vector<Real> > output_ptr;
1604 int dim_o = output_ptr->size();
1605 if ( dim_i != dim_o ) {
1606 std::cout <<
"H1VectorBatchManager: DIMENSION MISMATCH ON RANK "
1607 << ROL::TeuchosBatchManager<Real,Ordinal>::batchID() <<
"\n";
1610 ROL::TeuchosBatchManager<Real,Ordinal>::sumAll(&(*input_ptr)[0],&(*output_ptr)[0],dim_i);
1615 template<
class Real>
1616 Real
random(
const ROL::Ptr<
const Teuchos::Comm<int> > &comm) {
1618 if ( Teuchos::rank<int>(*comm)==0 ) {
1619 val = (Real)rand()/(Real)RAND_MAX;
1621 Teuchos::broadcast<int,Real>(*comm,0,1,&val);
H1VectorPrimal< Real > DualConstraintVector
BurgersFEM(int nx=128, Real nl=1.0, Real cH1=1.0, Real cL2=1.0)
L2VectorDual(const ROL::Ptr< std::vector< Real > > &vec, const ROL::Ptr< BurgersFEM< Real > > &fem)
ROL::Ptr< std::vector< Real > > vec_
Provides the interface to evaluate simulation-based objective functions.
std::vector< Real > x_up_
typename PV< Real >::size_type size_type
Real compute_H1_dot(const std::vector< Real > &x, const std::vector< Real > &y) const
void applyAdjointJacobian_1(ROL::Vector< Real > &ajv, const ROL::Vector< Real > &v, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Apply the adjoint of the partial constraint Jacobian at , , to the vector . This is the primary inter...
Real norm() const
Returns where .
void apply_mass(std::vector< Real > &Mu, const std::vector< Real > &u) const
bool isFeasible(const ROL::Vector< Real > &x)
Check if the vector, v, is feasible.
void pruneActive(ROL::Vector< Real > &v, const ROL::Vector< Real > &g, const ROL::Vector< Real > &x, Real xeps=Real(0), Real geps=Real(0))
void axpy(std::vector< Real > &out, const Real a, const std::vector< Real > &x, const std::vector< Real > &y) const
ROL::Ptr< ROL::Vector< Real > > basis(const int i) const
Return i-th basis vector.
void cast_vector(ROL::Ptr< std::vector< Real > > &xvec, ROL::Vector< Real > &x) const
Real dot(const ROL::Vector< Real > &x) const override
Compute where .
Real dot(const ROL::Vector< Real > &x) const
Compute where .
void apply_adjoint_pde_control_hessian(std::vector< Real > &ahwv, const std::vector< Real > &w, const std::vector< Real > &v, const std::vector< Real > &u, const std::vector< Real > &z)
ROL::Ptr< std::vector< Real > > vec_
int dimension() const
Return dimension of the vector space.
ROL::Ptr< L2VectorDual< Real > > dual_vec_
Real get_viscosity(void) const
void applyAdjointHessian_12(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)
Apply the optimization-space derivative of the adjoint of the constraint simulation-space Jacobian at...
void plus(const ROL::Vector< Real > &x)
Compute , where .
std::vector< Real > x_up_
void pruneUpperActive(ROL::Vector< Real > &v, const ROL::Vector< Real > &g, const ROL::Vector< Real > &x, Real xeps=Real(0), Real geps=Real(0))
Set variables to zero if they correspond to the upper -binding set.
void apply_adjoint_pde_hessian(std::vector< Real > &ahwv, const std::vector< Real > &w, const std::vector< Real > &v, const std::vector< Real > &u, const std::vector< Real > &z) const
ROL::Ptr< BurgersFEM< Real > > fem_
H1VectorPrimal(const ROL::Ptr< std::vector< Real > > &vec, const ROL::Ptr< BurgersFEM< Real > > &fem)
Real norm() const
Returns where .
Contains definitions of custom data types in ROL.
Real dot(const ROL::Vector< Real > &x) const
Compute where .
void cast_vector(ROL::Ptr< std::vector< Real > > &xvec, ROL::Vector< Real > &x) const
void applyAdjointHessian_11(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)
Apply the simulation-space derivative of the adjoint of the constraint simulation-space Jacobian at ...
ROL::Ptr< const std::vector< Real > > getVector() const
const ROL::Ptr< const ROL::Vector< Real > > getUpperBound(void) const
Return the ref count pointer to the upper bound vector.
void plus(const ROL::Vector< Real > &x)
Compute , where .
ROL::Ptr< BurgersFEM< Real > > fem_
const std::vector< Real > getParameter(void) const
Real compute_H1_norm(const std::vector< Real > &r) const
L2BoundConstraint(std::vector< Real > &l, std::vector< Real > &u, const ROL::Ptr< BurgersFEM< Real > > &fem, Real scale=1.0)
Real norm() const
Returns where .
Real apply(const ROL::Vector< Real > &x) const
Apply to a dual vector. This is equivalent to the call .
void applyInverseAdjointJacobian_1(ROL::Vector< Real > &iajv, const ROL::Vector< Real > &v, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Apply the inverse of the adjoint of the partial constraint Jacobian at , , to the vector ...
ROL::Ptr< std::vector< Real > > vec_
void pruneLowerActive(ROL::Vector< Real > &v, const ROL::Vector< Real > &x, Real eps=Real(0))
Set variables to zero if they correspond to the lower -active set.
H1VectorDual(const ROL::Ptr< std::vector< Real > > &vec, const ROL::Ptr< BurgersFEM< Real > > &fem)
void project(ROL::Vector< Real > &x)
Project optimization variables onto the bounds.
virtual void zero()
Set to zero vector.
ROL::Ptr< std::vector< Real > > getVector()
Defines the linear algebra or vector space interface.
void cast_vector(ROL::Ptr< std::vector< Real > > &xvec, ROL::Vector< Real > &x) const
ROL::Ptr< BurgersFEM< Real > > fem_
H1VectorDual< Real > DualStateVector
H1VectorDual< Real > PrimalConstraintVector
void pruneLowerActive(ROL::Vector< Real > &v, const ROL::Vector< Real > &x, Real eps=Real(0))
Set variables to zero if they correspond to the lower -active set.
Real apply(const ROL::Vector< Real > &x) const
Apply to a dual vector. This is equivalent to the call .
void scale(const Real alpha)
Compute where .
std::vector< Real >::size_type uint
void pruneLowerActive(ROL::Vector< Real > &v, const ROL::Vector< Real > &g, const ROL::Vector< Real > &x, Real xeps=Real(0), Real geps=Real(0))
Set variables to zero if they correspond to the -binding set.
L2VectorPrimal(const ROL::Ptr< std::vector< Real > > &vec, const ROL::Ptr< BurgersFEM< Real > > &fem)
Real dot(const ROL::Vector< Real > &x) const override
Compute where .
Real dot(const ROL::Vector< Real > &x) const
Compute where .
H1VectorPrimal< Real > PrimalStateVector
void hessVec_22(ROL::Vector< Real > &hv, const ROL::Vector< Real > &v, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Constraint_BurgersControl(ROL::Ptr< BurgersFEM< Real > > &fem, bool useHessian=true)
Real value(const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Compute value.
void plus(const ROL::Vector< Real > &x)
Compute , where .
void gradient_1(ROL::Vector< Real > &g, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Compute gradient with respect to first component.
Real mesh_spacing(void) const
ROL::Ptr< ROL::Vector< Real > > clone() const
Clone to make a new (uninitialized) vector.
bool isFeasible(const ROL::Vector< Real > &x)
Check if the vector, v, is feasible.
int dimension() const
Return dimension of the vector space.
ROL::Ptr< std::vector< Real > > vec_
void test_inverse_mass(std::ostream &outStream=std::cout)
void apply_pde_jacobian(std::vector< Real > &jv, const std::vector< Real > &v, const std::vector< Real > &u, const std::vector< Real > &z) const
ROL::Ptr< BurgersFEM< Real > > fem_
const ROL::Ptr< const ROL::Vector< Real > > getLowerBound(void) const
Return the ref count pointer to the lower bound vector.
L2VectorBatchManager(const ROL::Ptr< const Teuchos::Comm< int > > &comm)
ROL::Ptr< ROL::Vector< Real > > basis(const int i) const
Return i-th basis vector.
void applyAdjointHessian_21(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)
Apply the simulation-space derivative of the adjoint of the constraint optimization-space Jacobian at...
void pruneUpperActive(ROL::Vector< Real > &v, const ROL::Vector< Real > &x, Real eps=Real(0))
Set variables to zero if they correspond to the upper -active set.
ROL::Ptr< const std::vector< Real > > getVector() const
ROL::Ptr< ROL::Vector< Real > > clone() const
Clone to make a new (uninitialized) vector.
ROL::Ptr< const std::vector< Real > > getVector() const
ROL::Ptr< BurgersFEM< Real > > fem_
void set(const ROL::Vector< Real > &x)
Set where .
void scale(const Real alpha)
Compute where .
void compute_pde_jacobian(std::vector< Real > &dl, std::vector< Real > &d, std::vector< Real > &du, const std::vector< Real > &u) const
ROL::Ptr< ROL::Vector< Real > > basis(const int i) const
Return i-th basis vector.
H1VectorDual< Real > DualStateVector
void applyJacobian_1(ROL::Vector< Real > &jv, const ROL::Vector< Real > &v, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Apply the partial constraint Jacobian at , , to the vector .
Real compute_L2_dot(const std::vector< Real > &x, const std::vector< Real > &y) const
void hessVec_21(ROL::Vector< Real > &hv, const ROL::Vector< Real > &v, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
void linear_solve(std::vector< Real > &u, std::vector< Real > &dl, std::vector< Real > &d, std::vector< Real > &du, const std::vector< Real > &r, const bool transpose=false) const
std::vector< Real > x_lo_
ROL::Ptr< std::vector< Real > > getVector()
L2VectorPrimal< Real > PrimalControlVector
ROL::Ptr< ROL::Vector< Real > > u_
void apply_inverse_mass(std::vector< Real > &Mu, const std::vector< Real > &u) const
void pruneActive(ROL::Vector< Real > &v, const ROL::Vector< Real > &g, const ROL::Vector< Real > &x, Real xeps=Real(0), Real geps=Real(0))
void axpy(std::vector< Real > &out, const Real a, const std::vector< Real > &x, const std::vector< Real > &y) const
void hessVec_12(ROL::Vector< Real > &hv, const ROL::Vector< Real > &v, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
ROL::Ptr< std::vector< Real > > getVector()
ROL::Ptr< BurgersFEM< Real > > fem_
ROL::Ptr< const std::vector< Real > > getVector() const
ROL::Ptr< BurgersFEM< Real > > fem_
void update(std::vector< Real > &u, const std::vector< Real > &s, const Real alpha=1.0) const
void pruneUpperActive(ROL::Vector< Real > &v, const ROL::Vector< Real > &x, Real eps=Real(0))
Set variables to zero if they correspond to the upper -active set.
void scale(const Real alpha)
Compute where .
void projection(std::vector< Real > &x)
void gradient_2(ROL::Vector< Real > &g, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Compute gradient with respect to second component.
Real random(const ROL::Ptr< const Teuchos::Comm< int > > &comm)
void pruneActive(ROL::Vector< Real > &v, const ROL::Vector< Real > &x, Real eps=Real(0))
void set(const ROL::Vector< Real > &x)
Set where .
ROL::Ptr< ROL::Vector< Real > > l_
Real apply(const ROL::Vector< Real > &x) const
Apply to a dual vector. This is equivalent to the call .
void apply_adjoint_control_hessian(std::vector< Real > &ahwv, const std::vector< Real > &w, const std::vector< Real > &v, const std::vector< Real > &u, const std::vector< Real > &z)
void applyInverseJacobian_1(ROL::Vector< Real > &ijv, const ROL::Vector< Real > &v, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Apply the inverse partial constraint Jacobian at , , to the vector .
Provides the interface to apply upper and lower bound constraints.
void compute_residual(std::vector< Real > &r, const std::vector< Real > &u, const std::vector< Real > &z) const
void projection(std::vector< Real > &x)
void cast_const_vector(ROL::Ptr< const std::vector< Real > > &xvec, const ROL::Vector< Real > &x) const
ROL::Ptr< ROL::Vector< Real > > l_
ROL::Ptr< ROL::Vector< Real > > clone() const
Clone to make a new (uninitialized) vector.
H1VectorBatchManager(const ROL::Ptr< const Teuchos::Comm< int > > &comm)
void set_problem_data(const Real nu, const Real f, const Real u0, const Real u1)
void hessVec_11(ROL::Vector< Real > &hv, const ROL::Vector< Real > &v, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Apply Hessian approximation to vector.
void applyJacobian_2(ROL::Vector< Real > &jv, const ROL::Vector< Real > &v, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Apply the partial constraint Jacobian at , , to the vector .
void apply_control_jacobian(std::vector< Real > &jv, const std::vector< Real > &v, const std::vector< Real > &u, const std::vector< Real > &z) const
Real dot(const ROL::Vector< Real > &x) const override
Compute where .
void test_inverse_H1(std::ostream &outStream=std::cout)
const ROL::Vector< Real > & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
void apply_adjoint_control_jacobian(std::vector< Real > &jv, const std::vector< Real > &v, const std::vector< Real > &u, const std::vector< Real > &z) const
Real dot(const ROL::Vector< Real > &x) const
Compute where .
void cast_vector(ROL::Ptr< std::vector< Real > > &xvec, ROL::Vector< Real > &x) const
L2VectorPrimal< Real > PrimalControlVector
void cast_const_vector(ROL::Ptr< const std::vector< Real > > &xvec, const ROL::Vector< Real > &x) const
H1VectorPrimal< Real > PrimalStateVector
std::vector< Real > x_lo_
void apply_inverse_pde_jacobian(std::vector< Real > &ijv, const std::vector< Real > &v, const std::vector< Real > &u, const std::vector< Real > &z) const
void axpy(std::vector< Real > &out, const Real a, const std::vector< Real > &x, const std::vector< Real > &y) const
L2VectorDual< Real > DualControlVector
void pruneLowerActive(ROL::Vector< Real > &v, const ROL::Vector< Real > &g, const ROL::Vector< Real > &x, Real xeps=Real(0), Real geps=Real(0))
Set variables to zero if they correspond to the -binding set.
std::vector< int > indices_
ROL::Ptr< ROL::Vector< Real > > basis(const int i) const
Return i-th basis vector.
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)
Apply the optimization-space derivative of the adjoint of the constraint optimization-space Jacobian ...
void apply_H1(std::vector< Real > &Mu, const std::vector< Real > &u) const
void plus(const ROL::Vector< Real > &x)
Compute , where .
const ROL::Ptr< const ROL::Vector< Real > > getLowerBound(void) const
Return the ref count pointer to the lower bound vector.
void sumAll(ROL::Vector< Real > &input, ROL::Vector< Real > &output)
void apply_inverse_H1(std::vector< Real > &Mu, const std::vector< Real > &u) const
void project(ROL::Vector< Real > &x)
Project optimization variables onto the bounds.
void apply_adjoint_pde_jacobian(std::vector< Real > &ajv, const std::vector< Real > &v, const std::vector< Real > &u, const std::vector< Real > &z) const
void set(const ROL::Vector< Real > &x)
Set where .
ROL::Ptr< BurgersFEM< Real > > fem_
ROL::Ptr< ROL::Vector< Real > > u_
Real apply(const ROL::Vector< Real > &x) const
Apply to a dual vector. This is equivalent to the call .
ROL::Ptr< ROL::Vector< Real > > clone() const
Clone to make a new (uninitialized) vector.
void apply_inverse_adjoint_pde_jacobian(std::vector< Real > &iajv, const std::vector< Real > &v, const std::vector< Real > &u, const std::vector< Real > &z) const
void apply_adjoint_control_pde_hessian(std::vector< Real > &ahwv, const std::vector< Real > &w, const std::vector< Real > &v, const std::vector< Real > &u, const std::vector< Real > &z)
void pruneUpperActive(ROL::Vector< Real > &v, const ROL::Vector< Real > &g, const ROL::Vector< Real > &x, Real xeps=Real(0), Real geps=Real(0))
Set variables to zero if they correspond to the upper -binding set.
Objective_BurgersControl(const ROL::Ptr< BurgersFEM< Real > > &fem, Real x=0.0)
void pruneActive(ROL::Vector< Real > &v, const ROL::Vector< Real > &x, Real eps=Real(0))
void applyAdjointJacobian_2(ROL::Vector< Real > &jv, const ROL::Vector< Real > &v, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Apply the adjoint of the partial constraint Jacobian at , , to vector . This is the primary interface...
int dimension() const
Return dimension of the vector space.
Defines the constraint operator interface for simulation-based optimization.
L2VectorDual< Real > DualControlVector
ROL::Ptr< H1VectorPrimal< Real > > dual_vec_
const ROL::Vector< Real > & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
void value(ROL::Vector< Real > &c, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Evaluate the constraint operator at .
void sumAll(ROL::Vector< Real > &input, ROL::Vector< Real > &output)
void set(const ROL::Vector< Real > &x)
Set where .
Real norm() const
Returns where .
void scale(std::vector< Real > &u, const Real alpha=0.0) const
const ROL::Vector< Real > & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
ROL::Ptr< H1VectorDual< Real > > dual_vec_
const ROL::Ptr< const ROL::Vector< Real > > getUpperBound(void) const
Return the ref count pointer to the upper bound vector.
Real dot(const ROL::Vector< Real > &x) const override
Compute where .
ROL::Ptr< std::vector< Real > > getVector()
std::vector< Real >::size_type uint
H1BoundConstraint(std::vector< Real > &l, std::vector< Real > &u, const ROL::Ptr< BurgersFEM< Real > > &fem, Real scale=1.0)
void scale(const Real alpha)
Compute where .
int dimension() const
Return dimension of the vector space.
const ROL::Vector< Real > & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
Real compute_L2_norm(const std::vector< Real > &r) const
ROL::Ptr< L2VectorPrimal< Real > > dual_vec_