ROL
ROL_StepFactory.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_STEPFACTORY_H
11 #define ROL_STEPFACTORY_H
12 
13 #include "ROL_Types.hpp"
14 
15 #include "ROL_ParameterList.hpp"
16 #include "ROL_Ptr.hpp"
17 
18 #include "ROL_Step.hpp"
19 #include "ROL_LineSearchStep.hpp"
20 #include "ROL_TrustRegionStep.hpp"
22 #include "ROL_CompositeStep.hpp"
25 #include "ROL_BundleStep.hpp"
27 #include "ROL_FletcherStep.hpp"
28 
29 namespace ROL {
30 
31  template<class Real>
32  class StepFactory {
33  public:
34  ~StepFactory(void){}
35 
36  ROL::Ptr<Step<Real>> getStep(const std::string &type,
37  ROL::ParameterList &parlist) const {
38  EStep els = StringToEStep(type);
39  switch(els) {
40  case STEP_AUGMENTEDLAGRANGIAN: return ROL::makePtr<AugmentedLagrangianStep<Real>>(parlist);
41  case STEP_BUNDLE: return ROL::makePtr<BundleStep<Real>>(parlist);
42  case STEP_COMPOSITESTEP: return ROL::makePtr<CompositeStep<Real>>(parlist);
43  case STEP_LINESEARCH: return ROL::makePtr<LineSearchStep<Real>>(parlist);
44  case STEP_MOREAUYOSIDAPENALTY: return ROL::makePtr<MoreauYosidaPenaltyStep<Real>>(parlist);
45  case STEP_PRIMALDUALACTIVESET: return ROL::makePtr<PrimalDualActiveSetStep<Real>>(parlist);
46  case STEP_TRUSTREGION: return ROL::makePtr<TrustRegionStep<Real>>(parlist);
47  case STEP_INTERIORPOINT: return ROL::makePtr<InteriorPointStep<Real>>(parlist);
48  case STEP_FLETCHER: return ROL::makePtr<FletcherStep<Real>>(parlist);
49  default: return ROL::nullPtr;
50  }
51  }
52  };
53 
54 }
55 
56 #endif
EStep StringToEStep(std::string s)
Definition: ROL_Types.hpp:361
ROL::Ptr< Step< Real > > getStep(const std::string &type, ROL::ParameterList &parlist) const
Contains definitions of custom data types in ROL.
EStep
Enumeration of step types.
Definition: ROL_Types.hpp:243