source: branches/dev/Algorithm/IpIteratesVector.cpp @ 501

Last change on this file since 501 was 501, checked in by claird, 15 years ago

Cleaned up all the Copyright comments.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1// Copyright (C) 2005 International Business Machines and others.
2// All Rights Reserved.
3// This code is published under the Common Public License.
4//
5// $Id: IpIteratesVector.cpp 501 2005-08-26 15:43:07Z claird $
6//
7// Authors:  Carl Laird, Andreas Waechter     IBM    2005-06-06
8
9#include "IpIteratesVector.hpp"
10
11namespace Ipopt
12{
13
14#ifdef IP_DEBUG
15  static const Index dbg_verbosity = 0;
16#endif
17
18  IteratesVector::IteratesVector(const IteratesVectorSpace* owner_space, bool create_new)
19      :
20      CompoundVector(owner_space, create_new),
21      owner_space_(owner_space)
22  {
23    DBG_ASSERT(owner_space_);
24  }
25
26  IteratesVector::~IteratesVector()
27  {}
28
29  SmartPtr<IteratesVector> IteratesVector::MakeNewIteratesVector(bool create_new) const
30  {
31    return owner_space_->MakeNewIteratesVector(create_new);
32  }
33
34  SmartPtr<IteratesVector> IteratesVector::MakeNewContainer() const
35  {
36    SmartPtr<IteratesVector> ret = MakeNewIteratesVector(false);
37
38    if (IsValid(x())) {
39      ret->Set_x(*x());
40    }
41    if (IsValid(s())) {
42      ret->Set_s(*s());
43    }
44    if (IsValid(y_c())) {
45      ret->Set_y_c(*y_c());
46    }
47    if (IsValid(y_d())) {
48      ret->Set_y_d(*y_d());
49    }
50    if (IsValid(z_L())) {
51      ret->Set_z_L(*z_L());
52    }
53    if (IsValid(z_U())) {
54      ret->Set_z_U(*z_U());
55    }
56    if (IsValid(v_L())) {
57      ret->Set_v_L(*v_L());
58    }
59    if (IsValid(v_U())) {
60      ret->Set_v_U(*v_U());
61    }
62
63    return ret;
64
65    // We may need a non const version
66    //     if (IsCompConst(0)) {
67    //       ret->Set_x(*x());
68    //     }
69    //     else {
70    //       ret->Set_x_NonConst(*x_NonConst());
71    //     }
72
73    //     if (IsCompConst(1)) {
74    //       ret->Set_s(*s());
75    //     }
76    //     else {
77    //       ret->Set_s_NonConst(*s_NonConst());
78    //     }
79
80    //     if (IsCompConst(2)) {
81    //       ret->Set_y_c(*y_c());
82    //     }
83    //     else {
84    //       ret->Set_y_c_NonConst(*y_c_NonConst());
85    //     }
86
87    //     if (IsCompConst(3)) {
88    //       ret->Set_y_d(*y_d());
89    //     }
90    //     else {
91    //       ret->Set_y_d_NonConst(*y_d_NonConst());
92    //     }
93
94    //     if (IsCompConst(4)) {
95    //       ret->Set_z_L(*z_L());
96    //     }
97    //     else {
98    //       ret->Set_z_L_NonConst(*z_L_NonConst());
99    //     }
100
101    //     if (IsCompConst(5)) {
102    //       ret->Set_z_U(*z_U());
103    //     }
104    //     else {
105    //       ret->Set_z_U_NonConst(*z_U_NonConst());
106    //     }
107
108    //     if (IsCompConst(6)) {
109    //       ret->Set_v_L(*v_L());
110    //     }
111    //     else {
112    //       ret->Set_v_L_NonConst(*v_L_NonConst());
113    //     }
114
115    //     if (IsCompConst(7)) {
116    //       ret->Set_v_U(*v_U());
117    //     }
118    //     else {
119    //       ret->Set_v_U_NonConst(*v_U_NonConst());
120    //     }
121
122    //    return ret;
123  }
124
125  IteratesVectorSpace::IteratesVectorSpace(const VectorSpace& x_space, const VectorSpace& s_space,
126      const VectorSpace& y_c_space, const VectorSpace& y_d_space,
127      const VectorSpace& z_L_space, const VectorSpace& z_U_space,
128      const VectorSpace& v_L_space, const VectorSpace& v_U_space
129                                          )
130      :
131      CompoundVectorSpace(8, x_space.Dim() + s_space.Dim()
132                          + y_c_space.Dim() + y_d_space.Dim()
133                          + z_L_space.Dim() + z_U_space.Dim()
134                          + v_L_space.Dim() + v_U_space.Dim()
135                         )
136  {
137    x_space_ = &x_space;
138    s_space_ = &s_space;
139    y_c_space_ = &y_c_space;
140    y_d_space_ = &y_d_space;
141    z_L_space_ = &z_L_space;
142    z_U_space_ = &z_U_space;
143    v_L_space_ = &v_L_space;
144    v_U_space_ = &v_U_space;
145
146    this->CompoundVectorSpace::SetCompSpace(0, *x_space_);
147    this->CompoundVectorSpace::SetCompSpace(1, *s_space_);
148    this->CompoundVectorSpace::SetCompSpace(2, *y_c_space_);
149    this->CompoundVectorSpace::SetCompSpace(3, *y_d_space_);
150    this->CompoundVectorSpace::SetCompSpace(4, *z_L_space_);
151    this->CompoundVectorSpace::SetCompSpace(5, *z_U_space_);
152    this->CompoundVectorSpace::SetCompSpace(6, *v_L_space_);
153    this->CompoundVectorSpace::SetCompSpace(7, *v_U_space_);
154  }
155
156  IteratesVectorSpace::~IteratesVectorSpace()
157  {}
158
159} // namespae Ipopt
Note: See TracBrowser for help on using the repository browser.