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

Last change on this file since 567 was 567, checked in by andreasw, 15 years ago

adapted for Portland compilers

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