ROL
ROL_BoundToConstraint_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_BOUND_TO_CONSTRAINT_H
11 #define ROL_BOUND_TO_CONSTRAINT_H
12 
13 namespace ROL {
14 
15 template<typename Real>
17  lo_ = makePtr<LowerBoundToConstraint<Real>>(bnd);
18  up_ = makePtr<UpperBoundToConstraint<Real>>(bnd);
19  tmp_ = x.clone();
20 }
21 
22 template<typename Real>
24  lo_ = makePtr<LowerBoundToConstraint<Real>>(lo);
25  up_ = makePtr<UpperBoundToConstraint<Real>>(up);
26  tmp_ = lo.clone();
27 }
28 
29 template<typename Real>
31  Vector<Real> &c0 = *(dynamic_cast<PartitionedVector<Real>&>(c).get(0));
32  Vector<Real> &c1 = *(dynamic_cast<PartitionedVector<Real>&>(c).get(1));
33  lo_->value(c0,x,tol);
34  up_->value(c1,x,tol);
35 }
36 
37 template<typename Real>
39  const Vector<Real> &v, const Vector<Real> &x, Real &tol) {
40  Vector<Real> &jv0 = *(dynamic_cast<PartitionedVector<Real>&>(jv).get(0));
41  Vector<Real> &jv1 = *(dynamic_cast<PartitionedVector<Real>&>(jv).get(1));
42  lo_->applyJacobian(jv0,v,x,tol);
43  up_->applyJacobian(jv1,v,x,tol);
44 }
45 
46 template<typename Real>
48  const Vector<Real> &v, const Vector<Real> &x, Real &tol) {
49  const Vector<Real> &v0 = *(dynamic_cast<const PartitionedVector<Real>&>(v).get(0));
50  const Vector<Real> &v1 = *(dynamic_cast<const PartitionedVector<Real>&>(v).get(1));
51  lo_->applyAdjointJacobian(ajv,v0,x,tol);
52  up_->applyAdjointJacobian(*tmp_,v1,x,tol);
53  ajv.plus(*tmp_);
54 }
55 
56 template<typename Real>
58  const Vector<Real> &u, const Vector<Real> &v,
59  const Vector<Real> &x, Real &tol) {
60  ahuv.zero();
61 }
62 
63 }
64 
65 #endif
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual void plus(const Vector &x)=0
Compute , where .
Defines the linear algebra of vector space on a generic partitioned vector.
virtual void zero()
Set to zero vector.
Definition: ROL_Vector.hpp:133
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
void value(Vector< Real > &c, const Vector< Real > &x, Real &tol) override
Evaluate the constraint operator at .
Provides the interface to apply upper and lower bound constraints.
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 ...
BoundToConstraint(BoundConstraint< Real > &bnd)
void applyJacobian(Vector< Real > &jv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply the constraint Jacobian at , , to vector .