ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
function
dynamic
ROL_Constraint_DynamicState.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_CONSTRAINT_DYNAMICSTATE_H
11
#define ROL_CONSTRAINT_DYNAMICSTATE_H
12
13
#include "
ROL_DynamicConstraint.hpp
"
14
#include "
ROL_Constraint.hpp
"
15
16
namespace
ROL
{
17
18
template
<
class
Real>
19
class
Constraint_DynamicState
:
public
Constraint
<Real> {
20
private
:
21
const
Ptr<DynamicConstraint<Real>>
con_
;
22
const
Ptr<const Vector<Real>>
uo_
;
23
const
Ptr<const Vector<Real>>
z_
;
24
const
Ptr<const TimeStamp<Real>>
ts_
;
25
26
Ptr<Vector<Real>>
ijv_
;
27
bool
isInit_
;
28
29
public
:
30
Constraint_DynamicState
(
const
Ptr<
DynamicConstraint<Real>
> &con,
31
const
Ptr<
const
Vector<Real>
> &uo,
32
const
Ptr<
const
Vector<Real>
> &z,
33
const
Ptr<
const
TimeStamp<Real>
> &ts)
34
:
con_
(con),
uo_
(uo),
z_
(z),
ts_
(ts),
isInit_
(false) {}
35
36
void
value
(
Vector<Real>
&c,
const
Vector<Real>
&u,Real &tol) {
37
con_
->value(c,*
uo_
,u,*
z_
,*
ts_
);
38
}
39
40
void
applyJacobian
(
Vector<Real>
&jv,
const
Vector<Real>
&v,
const
Vector<Real>
&u,Real &tol) {
41
con_
->applyJacobian_un(jv,v,*
uo_
,u,*
z_
,*
ts_
);
42
}
43
44
using
Constraint
<Real>
::applyAdjointJacobian
;
45
void
applyAdjointJacobian
(
Vector<Real>
&ajv,
const
Vector<Real>
&v,
const
Vector<Real>
&u,Real &tol) {
46
con_
->applyAdjointJacobian_un(ajv,v,*
uo_
,u,*
z_
,*
ts_
);
47
}
48
49
void
applyAdjointHessian
(
Vector<Real>
&ahwv,
const
Vector<Real>
&w,
const
Vector<Real>
&v,
const
Vector<Real>
&u,Real &tol) {
50
con_
->applyAdjointHessian_un_un(ahwv,w,v,*
uo_
,u,*
z_
,*
ts_
);
51
}
52
53
void
update
(
const
Vector<Real>
&u,
bool
flag =
true
,
int
iter = -1 ) {
54
//con_->update_un(u,*ts_);
55
con_
->update(*
uo_
,u,*
z_
,*
ts_
);
56
}
57
58
void
applyPreconditioner
(
Vector<Real>
&pv,
const
Vector<Real>
&v,
const
Vector<Real>
&u,
const
Vector<Real>
&g,Real &tol) {
59
if
(!
isInit_
) {
60
ijv_
= u.
clone
();
61
isInit_
=
true
;
62
}
63
con_
->applyInverseJacobian_un(*
ijv_
,v,*
uo_
,u,*
z_
,*
ts_
);
64
con_
->applyInverseAdjointJacobian_un(pv,
ijv_
->dual(),*
uo_
,u,*
z_
,*
ts_
);
65
}
66
67
// Definitions for parametrized (stochastic) equality constraints
68
//void setParameter(const std::vector<Real> ¶m) {
69
// con_->setParameter(param);
70
// Constraint<Real>::setParameter(param);
71
//}
72
73
};
// class Constraint_State
74
75
}
// namespace ROL
76
77
#endif
ROL_Constraint.hpp
ROL_DynamicConstraint.hpp
ROL::Constraint_DynamicState::value
void value(Vector< Real > &c, const Vector< Real > &u, Real &tol)
Definition
ROL_Constraint_DynamicState.hpp:36
ROL::Constraint_DynamicState::ijv_
Ptr< Vector< Real > > ijv_
Definition
ROL_Constraint_DynamicState.hpp:26
ROL::Constraint_DynamicState::applyAdjointHessian
void applyAdjointHessian(Vector< Real > &ahwv, const Vector< Real > &w, const Vector< Real > &v, const Vector< Real > &u, Real &tol)
Definition
ROL_Constraint_DynamicState.hpp:49
ROL::Constraint_DynamicState::con_
const Ptr< DynamicConstraint< Real > > con_
Definition
ROL_Constraint_DynamicState.hpp:21
ROL::Constraint_DynamicState::z_
const Ptr< const Vector< Real > > z_
Definition
ROL_Constraint_DynamicState.hpp:23
ROL::Constraint_DynamicState::applyPreconditioner
void applyPreconditioner(Vector< Real > &pv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &g, Real &tol)
Definition
ROL_Constraint_DynamicState.hpp:58
ROL::Constraint_DynamicState::uo_
const Ptr< const Vector< Real > > uo_
Definition
ROL_Constraint_DynamicState.hpp:22
ROL::Constraint_DynamicState::update
void update(const Vector< Real > &u, bool flag=true, int iter=-1)
Definition
ROL_Constraint_DynamicState.hpp:53
ROL::Constraint_DynamicState::ts_
const Ptr< const TimeStamp< Real > > ts_
Definition
ROL_Constraint_DynamicState.hpp:24
ROL::Constraint_DynamicState::Constraint_DynamicState
Constraint_DynamicState(const Ptr< DynamicConstraint< Real > > &con, const Ptr< const Vector< Real > > &uo, const Ptr< const Vector< Real > > &z, const Ptr< const TimeStamp< Real > > &ts)
Definition
ROL_Constraint_DynamicState.hpp:30
ROL::Constraint_DynamicState::applyJacobian
void applyJacobian(Vector< Real > &jv, const Vector< Real > &v, const Vector< Real > &u, Real &tol)
Definition
ROL_Constraint_DynamicState.hpp:40
ROL::Constraint_DynamicState::isInit_
bool isInit_
Definition
ROL_Constraint_DynamicState.hpp:27
ROL::Constraint_DynamicState::applyAdjointJacobian
void applyAdjointJacobian(Vector< Real > &ajv, const Vector< Real > &v, const Vector< Real > &u, Real &tol)
Definition
ROL_Constraint_DynamicState.hpp:45
ROL::Constraint
Defines the general constraint operator interface.
Definition
ROL_Constraint.hpp:52
ROL::DynamicConstraint
Defines the time-dependent constraint operator interface for simulation-based optimization.
Definition
ROL_DynamicConstraint.hpp:53
ROL::ROL::Constraint::Constraint
Constraint(void)
Definition
ROL_Constraint_SerialSimOpt.hpp:59
ROL::Vector
Defines the linear algebra or vector space interface.
Definition
ROL_Vector.hpp:51
ROL::Vector::clone
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
ROL
Definition
ROL_ElementwiseVector.hpp:27
ROL::TimeStamp
Contains local time step information.
Definition
ROL_TimeStamp.hpp:35
Generated by
1.17.0