ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
function
constraint
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>
16
BoundToConstraint<Real>::BoundToConstraint
(
BoundConstraint<Real>
&bnd) {
17
lo_
= makePtr<LowerBoundToConstraint<Real>>(bnd);
18
up_
= makePtr<UpperBoundToConstraint<Real>>(bnd);
19
tmp_
= x.clone();
20
}
21
22
template
<
typename
Real>
23
BoundToConstraint<Real>::BoundToConstraint
(
const
Vector<Real>
&lo,
const
Vector<Real>
&up) {
24
lo_
= makePtr<LowerBoundToConstraint<Real>>(lo);
25
up_
= makePtr<UpperBoundToConstraint<Real>>(up);
26
tmp_
= lo.
clone
();
27
}
28
29
template
<
typename
Real>
30
void
BoundToConstraint<Real>::value
(
Vector<Real>
&c,
const
Vector<Real>
&x, Real &tol) {
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>
38
void
BoundToConstraint<Real>::applyJacobian
(
Vector<Real>
&jv,
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>
47
void
BoundToConstraint<Real>::applyAdjointJacobian
(
Vector<Real>
&ajv,
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>
57
void
BoundToConstraint<Real>::applyAdjointHessian
(
Vector<Real>
&ahuv,
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
ROL::BoundConstraint
Provides the interface to apply upper and lower bound constraints.
Definition
ROL_BoundConstraint.hpp:39
ROL::BoundToConstraint::BoundToConstraint
BoundToConstraint(BoundConstraint< Real > &bnd)
Definition
ROL_BoundToConstraint_Def.hpp:16
ROL::BoundToConstraint::applyAdjointJacobian
void applyAdjointJacobian(Vector< Real > &ajv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Definition
ROL_BoundToConstraint_Def.hpp:47
ROL::BoundToConstraint::tmp_
Ptr< Vector< Real > > tmp_
Definition
ROL_BoundToConstraint.hpp:28
ROL::BoundToConstraint::applyAdjointHessian
void applyAdjointHessian(Vector< Real > &ahuv, const Vector< Real > &u, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Definition
ROL_BoundToConstraint_Def.hpp:57
ROL::BoundToConstraint::up_
Ptr< Constraint< Real > > up_
Definition
ROL_BoundToConstraint.hpp:27
ROL::BoundToConstraint::value
void value(Vector< Real > &c, const Vector< Real > &x, Real &tol) override
Definition
ROL_BoundToConstraint_Def.hpp:30
ROL::BoundToConstraint::applyJacobian
void applyJacobian(Vector< Real > &jv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Definition
ROL_BoundToConstraint_Def.hpp:38
ROL::BoundToConstraint::lo_
Ptr< Constraint< Real > > lo_
Definition
ROL_BoundToConstraint.hpp:26
ROL::PartitionedVector
Defines the linear algebra of vector space on a generic partitioned vector.
Definition
ROL_PartitionedVector.hpp:26
ROL::PartitionedVector::get
ROL::Ptr< const Vector< Real > > get(size_type i) const
Definition
ROL_PartitionedVector.hpp:221
ROL::Vector
Defines the linear algebra or vector space interface.
Definition
ROL_Vector.hpp:51
ROL::Vector::plus
virtual void plus(const Vector &x)=0
Compute , where .
ROL::Vector::zero
virtual void zero()
Set to zero vector.
Definition
ROL_Vector.hpp:134
ROL::Vector::clone
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
ROL
Definition
ROL_ElementwiseVector.hpp:27
Generated by
1.17.0