ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
algorithm
TypeU
trustregion
ROL_TrustRegion_U_Types.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
14
15
#ifndef ROL_TRUSTREGION_U_TYPES_HPP
16
#define ROL_TRUSTREGION_U_TYPES_HPP
17
18
namespace
ROL
{
19
29
enum
ETrustRegionU
{
30
TRUSTREGION_U_CAUCHYPOINT
= 0,
31
TRUSTREGION_U_TRUNCATEDCG
,
32
TRUSTREGION_U_SPG
,
33
TRUSTREGION_U_DOGLEG
,
34
TRUSTREGION_U_DOUBLEDOGLEG
,
35
TRUSTREGION_U_LAST
36
};
37
38
inline
std::string
ETrustRegionUToString
(
ETrustRegionU
tr) {
39
std::string retString;
40
switch
(tr) {
41
case
TRUSTREGION_U_CAUCHYPOINT
: retString =
"Cauchy Point"
;
break
;
42
case
TRUSTREGION_U_TRUNCATEDCG
: retString =
"Truncated CG"
;
break
;
43
case
TRUSTREGION_U_SPG
: retString =
"SPG"
;
break
;
44
case
TRUSTREGION_U_DOGLEG
: retString =
"Dogleg"
;
break
;
45
case
TRUSTREGION_U_DOUBLEDOGLEG
: retString =
"Double Dogleg"
;
break
;
46
case
TRUSTREGION_U_LAST
: retString =
"Last Type (Dummy)"
;
break
;
47
default
: retString =
"INVALID ETrustRegionU"
;
48
}
49
return
retString;
50
}
51
57
inline
int
isValidTrustRegionU
(
ETrustRegionU
ls){
58
return
( (ls ==
TRUSTREGION_U_CAUCHYPOINT
) ||
59
(ls ==
TRUSTREGION_U_TRUNCATEDCG
) ||
60
(ls ==
TRUSTREGION_U_SPG
) ||
61
(ls ==
TRUSTREGION_U_DOGLEG
) ||
62
(ls ==
TRUSTREGION_U_DOUBLEDOGLEG
)
63
);
64
}
65
66
inline
ETrustRegionU
&
operator++
(
ETrustRegionU
&type) {
67
return
type =
static_cast<
ETrustRegionU
>
(type+1);
68
}
69
70
inline
ETrustRegionU
operator++
(
ETrustRegionU
&type,
int
) {
71
ETrustRegionU
oldval = type;
72
++type;
73
return
oldval;
74
}
75
76
inline
ETrustRegionU
&
operator--
(
ETrustRegionU
&type) {
77
return
type =
static_cast<
ETrustRegionU
>
(type-1);
78
}
79
80
inline
ETrustRegionU
operator--
(
ETrustRegionU
&type,
int
) {
81
ETrustRegionU
oldval = type;
82
--type;
83
return
oldval;
84
}
85
86
inline
ETrustRegionU
StringToETrustRegionU
(std::string s) {
87
s =
removeStringFormat
(s);
88
for
(
ETrustRegionU
tr =
TRUSTREGION_U_CAUCHYPOINT
; tr <
TRUSTREGION_U_LAST
; tr++ ) {
89
if
( !s.compare(
removeStringFormat
(
ETrustRegionUToString
(tr))) ) {
90
return
tr;
91
}
92
}
93
return
TRUSTREGION_U_CAUCHYPOINT
;
94
}
95
}
// ROL
96
97
#endif
ROL
Definition
ROL_ElementwiseVector.hpp:27
ROL::removeStringFormat
std::string removeStringFormat(std::string s)
Definition
ROL_Types.hpp:215
ROL::ETrustRegionU
ETrustRegionU
Definition
ROL_TrustRegion_U_Types.hpp:29
ROL::TRUSTREGION_U_TRUNCATEDCG
@ TRUSTREGION_U_TRUNCATEDCG
Definition
ROL_TrustRegion_U_Types.hpp:31
ROL::TRUSTREGION_U_LAST
@ TRUSTREGION_U_LAST
Definition
ROL_TrustRegion_U_Types.hpp:35
ROL::TRUSTREGION_U_DOUBLEDOGLEG
@ TRUSTREGION_U_DOUBLEDOGLEG
Definition
ROL_TrustRegion_U_Types.hpp:34
ROL::TRUSTREGION_U_DOGLEG
@ TRUSTREGION_U_DOGLEG
Definition
ROL_TrustRegion_U_Types.hpp:33
ROL::TRUSTREGION_U_SPG
@ TRUSTREGION_U_SPG
Definition
ROL_TrustRegion_U_Types.hpp:32
ROL::TRUSTREGION_U_CAUCHYPOINT
@ TRUSTREGION_U_CAUCHYPOINT
Definition
ROL_TrustRegion_U_Types.hpp:30
ROL::StringToETrustRegionU
ETrustRegionU StringToETrustRegionU(std::string s)
Definition
ROL_TrustRegion_U_Types.hpp:86
ROL::operator--
EPolyProjAlgo & operator--(EPolyProjAlgo &type)
Definition
ROL_PolyhedralProjectionFactory.hpp:81
ROL::isValidTrustRegionU
int isValidTrustRegionU(ETrustRegionU ls)
Verifies validity of a TrustRegionU enum.
Definition
ROL_TrustRegion_U_Types.hpp:57
ROL::operator++
EPolyProjAlgo & operator++(EPolyProjAlgo &type)
Definition
ROL_PolyhedralProjectionFactory.hpp:71
ROL::ETrustRegionUToString
std::string ETrustRegionUToString(ETrustRegionU tr)
Definition
ROL_TrustRegion_U_Types.hpp:38
Generated by
1.17.0