Ipopt  3.11.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 
18  {
29  public:
30 
32  SmartPtr<SchurData> A_data)
33  :
34  backsolver_(backsolver),
35  data_A_init(ConstPtr(A_data->MakeNewSchurDataCopy())),
36  data_A_(A_data)
37  {
38  }
39 
40  virtual ~PCalculator()
41  {
42  }
43 
45  virtual bool InitializeImpl(const OptionsList& options,
46  const std::string& prefix)
47  {
48  return true;
49  }
50 
52  virtual bool ComputeP()=0;
53 
55  virtual bool GetSchurMatrix(const SmartPtr<const SchurData>& B, SmartPtr<Matrix>& S) =0;
56 
57  virtual void PrintImpl(const Journalist& jnlst,
58  EJournalLevel level,
59  EJournalCategory category,
60  const std::string& name,
61  Index indent,
62  const std::string& prefix) const =0;
63 
64  void Print(const Journalist& jnlst,
65  EJournalLevel level,
66  EJournalCategory category,
67  const std::string& name,
68  Index indent=0,
69  const std::string& prefix="") const
70  {
71  if (jnlst.ProduceOutput(level, category)) {
72  PrintImpl(jnlst, level, category, name, indent, prefix);
73  }
74  }
75 
77  EJournalLevel level,
78  EJournalCategory category,
79  const std::string& name,
80  Index indent,
81  const std::string& prefix) const
82  {
83  if (IsValid(jnlst) && jnlst->ProduceOutput(level, category)) {
84  PrintImpl(*jnlst, level, category, name, indent, prefix);
85  }
86  }
87 
92  {
93  return backsolver_;
94  }
95 
97  {
98  return ConstPtr(data_A_);
99  }
100 
102  {
103  return data_A_;
104  }
105 
107  {
108  data_A_ = data_A_init->MakeNewSchurDataCopy();
109  }
110 
111  private:
112 
114 
117 
118 
119  };
120 
121 
122 }
123 
124 #endif