ROL
ROL_RiskLessConstraint_Def.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Rapid Optimization Library (ROL) Package
4 //
5 // Copyright 2014 NTESS and the ROL contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef ROL_RISKLESS_CONSTRAINT_DEF_H
11 #define ROL_RISKLESS_CONSTRAINT_DEF_H
12 
13 namespace ROL {
14 
15 template<typename Real>
17  : con_(con) {}
18 
19 template<typename Real>
21  Ptr<const Vector<Real>> x0 = dynamic_cast<const RiskVector<Real>&>(x).getVector();
22  con_->update(*x0,type,iter);
23 }
24 
25 template<typename Real>
26 void RiskLessConstraint<Real>::update(const Vector<Real> &x, bool flag, int iter) {
27  Ptr<const Vector<Real>> x0 = dynamic_cast<const RiskVector<Real>&>(x).getVector();
28  con_->update(*x0,flag,iter);
29 }
30 
31 template<typename Real>
33  Ptr<const Vector<Real>> x0 = dynamic_cast<const RiskVector<Real>&>(x).getVector();
34  con_->value(c,*x0,tol);
35 }
36 
37 template<typename Real>
39  Ptr<const Vector<Real>> x0 = dynamic_cast<const RiskVector<Real>&>(x).getVector();
40  Ptr<const Vector<Real>> v0 = dynamic_cast<const RiskVector<Real>&>(v).getVector();
41  con_->applyJacobian(jv,*v0,*x0,tol);
42 }
43 
44 template<typename Real>
46  Ptr<const Vector<Real>> x0 = dynamic_cast<const RiskVector<Real>&>(x).getVector();
47  Ptr<Vector<Real>> ajv0 = dynamic_cast<RiskVector<Real>&>(ajv).getVector();
48  con_->applyAdjointJacobian(*ajv0,v,*x0,tol);
49 }
50 
51 template<typename Real>
53  Ptr<const Vector<Real>> x0 = dynamic_cast<const RiskVector<Real>&>(x).getVector();
54  Ptr<const Vector<Real>> v0 = dynamic_cast<const RiskVector<Real>&>(v).getVector();
55  Ptr<Vector<Real>> ahuv0 = dynamic_cast<RiskVector<Real>&>(ahuv).getVector();
56  con_->applyAdjointHessian(*ahuv0,u,*v0,*x0,tol);
57 }
58 
59 template<typename Real>
60 void RiskLessConstraint<Real>::setParameter(const std::vector<Real> &param) {
62  con_->setParameter(param);
63 }
64 
65 } // namespace ROL
66 
67 #endif
void applyJacobian(Vector< Real > &jv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply the constraint Jacobian at , , to vector .
RiskLessConstraint(const Ptr< Constraint< Real >> &con)
void value(Vector< Real > &c, const Vector< Real > &x, Real &tol) override
Evaluate the constraint operator at .
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
void applyAdjointJacobian(Vector< Real > &ajv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply the adjoint of the the constraint Jacobian at , , to vector .
void applyAdjointHessian(Vector< Real > &ahuv, const Vector< Real > &u, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply the derivative of the adjoint of the constraint Jacobian at to vector in direction ...
void update(const Vector< Real > &x, UpdateType type, int iter=-1) override
Update constraint function.
void setParameter(const std::vector< Real > &param) override
virtual void setParameter(const std::vector< Real > &param)
Defines the general constraint operator interface.