Ipopt Documentation  
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SensPCalculator.hpp
Go to the documentation of this file.
1 // Copyright 2009, 2011 Hans Pirnay
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // Date : 2009-05-06
6 
7 #ifndef __ASPCALCULATOR_HPP__
8 #define __ASPCALCULATOR_HPP__
9 
10 #include "IpAlgStrategy.hpp"
11 #include "SensSimpleBacksolver.hpp"
12 #include "SensSchurData.hpp"
13 
14 namespace Ipopt
15 {
16 
27 {
28 public:
30  SmartPtr<SensBacksolver> backsolver,
31  SmartPtr<SchurData> A_data
32  )
33  : backsolver_(backsolver),
34  data_A_init(ConstPtr(A_data->MakeNewSchurDataCopy())),
35  data_A_(A_data)
36  { }
37 
38  virtual ~PCalculator()
39  { }
40 
41  /* Overloaded from AlgorithmStrategyObject */
42  virtual bool InitializeImpl(
43  const OptionsList& /*options*/,
44  const std::string& /*prefix*/
45  )
46  {
47  return true;
48  }
49 
51  virtual bool ComputeP() = 0;
52 
57  virtual bool GetSchurMatrix(
60  ) = 0;
61 
62  virtual void PrintImpl(
63  const Journalist& jnlst,
64  EJournalLevel level,
65  EJournalCategory category,
66  const std::string& name,
67  Index indent,
68  const std::string& prefix
69  ) const = 0;
70 
71  void Print(
72  const Journalist& jnlst,
73  EJournalLevel level,
74  EJournalCategory category,
75  const std::string& name,
76  Index indent = 0,
77  const std::string& prefix = ""
78  ) const
79  {
80  if( jnlst.ProduceOutput(level, category) )
81  {
82  PrintImpl(jnlst, level, category, name, indent, prefix);
83  }
84  }
85 
86  void Print(
88  EJournalLevel level,
89  EJournalCategory category,
90  const std::string& name,
91  Index indent,
92  const std::string& prefix
93  ) const
94  {
95  if( IsValid(jnlst) && jnlst->ProduceOutput(level, category) )
96  {
97  PrintImpl(*jnlst, level, category, name, indent, prefix);
98  }
99  }
100 
108  {
109  return backsolver_;
110  }
111 
113  {
114  return ConstPtr(data_A_);
115  }
116 
118  {
119  return data_A_;
120  }
121 
123  {
124  data_A_ = data_A_init->MakeNewSchurDataCopy();
125  }
126 
127 private:
128 
130 
133 };
134 
135 }
136 
137 #endif
SmartPtr< const SchurData > data_A_init
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:674
SmartPtr< SensBacksolver > backsolver_
This is the base class for all algorithm strategy objects.
void Print(const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent=0, const std::string &prefix="") const
This class is the interface for implementations of any class that calculates the matrix of the follo...
virtual bool InitializeImpl(const OptionsList &, const std::string &)
Implementation of the initialization method that has to be overloaded by for each derived class...
SmartPtr< SchurData > data_A_nonconst() const
SmartPtr< SensBacksolver > Solver() const
Accessor methods for data and backsolver.
#define SIPOPTLIB_EXPORT
Include file for the configuration of Ipopt.
Definition: IpoptConfig.h:79
EJournalLevel
Print Level Enum.
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:171
This class stores a list of user set options.
PCalculator(SmartPtr< SensBacksolver > backsolver, SmartPtr< SchurData > A_data)
void Print(SmartPtr< const Journalist > jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent, const std::string &prefix) const
SmartPtr< const SchurData > data_A() const
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:17
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:665
SmartPtr< SchurData > data_A_
Class responsible for all message output.
virtual bool ProduceOutput(EJournalLevel level, EJournalCategory category) const
Method that returns true if there is a Journal that would write output for the given JournalLevel and...
EJournalCategory
Category Selection Enum.