Ipopt Documentation  
SensSchurData.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 __ASSCHURDATA_HPP__
8 #define __ASSCHURDATA_HPP__
9 
10 #include "IpVector.hpp"
11 #include "IpIteratesVector.hpp"
12 #include <vector>
13 
14 namespace Ipopt
15 {
16 
29 class SIPOPTLIB_EXPORT SchurData: public ReferencedObject
30 {
31 public:
33  : initialized_(false),
34  nrows_(0)
35  { }
36 
37  virtual ~SchurData()
38  { }
39 
40  virtual SmartPtr<SchurData> MakeNewSchurDataCopy() const = 0;
41 
42  /* Functions to set the Schurdata. At least one must be overloaded */
43 
45  virtual void SetData_Flag(
46  Index dim,
47  const Index* flags,
48  Number v = 1.0
49  ) = 0;
50 
52  virtual void SetData_Flag(
53  Index dim,
54  const Index* flags,
55  const Number* values
56  ) = 0;
57 
58  virtual Index SetData_Index(
59  Index dim,
60  const Index* flags,
61  Number v = 1.0
62  ) = 0;
63 
64  virtual void SetData_List(
65  const std::vector<Index>& list,
66  Number v = 1.0
67  ) = 0;
68 
69  virtual void AddData_List(
70  std::vector<Index> cols,
71  std::vector<Index>& delta_u_sort,
72  Index& new_du_size,
73  Index v
74  ) = 0;
75 
77  virtual Index GetNRowsAdded() const
78  {
79  return nrows_;
80  }
81 
82  virtual bool Is_Initialized() const
83  {
84  return initialized_;
85  }
86 
88  virtual void GetRow(
89  Index i,
91  ) const = 0;
92 
100  virtual void GetMultiplyingVectors(
101  Index row,
102  std::vector<Index>& indices,
103  std::vector<Number>& factors
104  ) const = 0;
105 
107  virtual void Multiply(
108  const IteratesVector& v,
109  Vector& u
110  ) const = 0;
111 
113  virtual void TransMultiply(
114  const Vector& u,
115  IteratesVector& v
116  ) const = 0;
117 
118  virtual void PrintImpl(
119  const Journalist& jnlst,
120  EJournalLevel level,
121  EJournalCategory category,
122  const std::string& name,
123  Index indent,
124  const std::string& prefix
125  ) const = 0;
126 
127  void Print(
128  const Journalist& jnlst,
129  EJournalLevel level,
130  EJournalCategory category,
131  const std::string& name,
132  Index indent = 0,
133  const std::string& prefix = ""
134  ) const
135  {
136  if( jnlst.ProduceOutput(level, category) )
137  {
138  PrintImpl(jnlst, level, category, name, indent, prefix);
139  }
140  }
141 
142  void Print(
144  EJournalLevel level,
145  EJournalCategory category,
146  const std::string& name,
147  Index indent,
148  const std::string& prefix
149  ) const
150  {
151  if( IsValid(jnlst) && jnlst->ProduceOutput(level, category) )
152  {
153  PrintImpl(*jnlst, level, category, name, indent, prefix);
154  }
155  }
156 
157 protected:
158 
159  virtual void Set_Initialized()
160  {
161  initialized_ = true;
162  }
163 
164  virtual void Set_NRows(
165  Index nrows
166  )
167  {
168  nrows_ = nrows;
169  }
170 
171 private:
172 
175 
178 };
179 
180 }
181 
182 #endif
Ipopt::SchurData::Set_NRows
virtual void Set_NRows(Index nrows)
Definition: SensSchurData.hpp:164
Ipopt
This file contains a base class for all exceptions and a set of macros to help with exceptions.
Definition: IpInexactAlgBuilder.hpp:13
Ipopt::Number
double Number
Type of all numbers.
Definition: IpTypes.hpp:15
Ipopt::SchurData::Is_Initialized
virtual bool Is_Initialized() const
Definition: SensSchurData.hpp:82
Ipopt::SchurData
This interface serves as a reference point for multiple classes that need to use SchurData (PCalculat...
Definition: SensSchurData.hpp:29
IpIteratesVector.hpp
Ipopt::EJournalLevel
EJournalLevel
Print Level Enum.
Definition: IpJournalist.hpp:31
Ipopt::SchurData::Print
void Print(SmartPtr< const Journalist > jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent, const std::string &prefix) const
Definition: SensSchurData.hpp:142
Ipopt::SchurData::SchurData
SchurData()
Definition: SensSchurData.hpp:32
Ipopt::SchurData::Set_Initialized
virtual void Set_Initialized()
Definition: SensSchurData.hpp:159
Ipopt::Journalist::ProduceOutput
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...
Ipopt::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:17
Ipopt::SchurData::initialized_
bool initialized_
Makes sure that data is not set twice accidentially.
Definition: SensSchurData.hpp:174
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:171
Ipopt::EJournalCategory
EJournalCategory
Category Selection Enum.
Definition: IpJournalist.hpp:51
Ipopt::SchurData::GetNRowsAdded
virtual Index GetNRowsAdded() const
Returns number of rows/columns in schur matrix.
Definition: SensSchurData.hpp:77
Ipopt::Journalist
Class responsible for all message output.
Definition: IpJournalist.hpp:116
IpVector.hpp
Ipopt::SchurData::Print
void Print(const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent=0, const std::string &prefix="") const
Definition: SensSchurData.hpp:127
Ipopt::IsValid
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:674
Ipopt::SchurData::~SchurData
virtual ~SchurData()
Definition: SensSchurData.hpp:37
Ipopt::SchurData::nrows_
Index nrows_
Number of columns/rows of corresponding Schur Matrix.
Definition: SensSchurData.hpp:177
Ipopt::ReferencedObject
Storing the reference count of all the smart pointers that currently reference it.
Definition: IpReferenced.hpp:169
Ipopt::Vector
Vector Base Class.
Definition: IpVector.hpp:47
Ipopt::IteratesVector
Specialized CompoundVector class specifically for the algorithm iterates.
Definition: IpIteratesVector.hpp:25