00001
00002
00003
00004
00005
00006
00011 #include <admodel.h>
00012 #include "admb_messages.h"
00013
00014 #if !defined(OPT_LIB)
00015 #include <stdexcept>
00016
00021 param_init_vector& param_init_vector_vector::operator [] (int i)
00022 {
00023 if (i<indexmin()) {
00024 ADMB_ARRAY_BOUNDS_ERROR("Index too low",
00025 "param_init_vector& param_init_vector_vector::operator [] (int i)",
00026 indexmin(), indexmax(), i);
00027 }
00028 if (i>indexmax()) {
00029 ADMB_ARRAY_BOUNDS_ERROR("Index too high",
00030 "param_init_vector& param_init_vector_vector::operator [] (int i)",
00031 indexmin(), indexmax(), i);
00032 }
00033 return v[i];
00034 }
00035
00040 param_init_vector& param_init_vector_vector::operator () (int i)
00041 {
00042 if (i<indexmin()) {
00043 ADMB_ARRAY_BOUNDS_ERROR("Index too low",
00044 "param_init_vector& param_init_vector_vector::operator () (int i)",
00045 indexmin(), indexmax(), i);
00046 }
00047 if (i>indexmax()) {
00048 ADMB_ARRAY_BOUNDS_ERROR("Index too high",
00049 "param_init_vector& param_init_vector_vector::operator () (int i)",
00050 indexmin(), indexmax(), i);
00051 }
00052 return v[i];
00053 }
00054
00059 prevariable param_init_vector_vector::operator () (int i,int j)
00060 {
00061 if (i<indexmin()) {
00062 ADMB_ARRAY_BOUNDS_ERROR("Index too low",
00063 "prevariable param_init_vector_vector::operator () (int i, int j)",
00064 indexmin(), indexmax(), i);
00065 }
00066 if (i>indexmax()) {
00067 ADMB_ARRAY_BOUNDS_ERROR("Index too high",
00068 "prevariable param_init_vector_vector::operator () (int i, int j)",
00069 indexmin(), indexmax(), i);
00070 }
00071 return v[i][j];
00072 }
00073
00078 param_init_matrix& param_init_matrix_vector::operator [] (int i)
00079 {
00080 if (i<indexmin()) {
00081 ADMB_ARRAY_BOUNDS_ERROR("Index too low",
00082 "param_init_matrix& prevariable param_init_vector_vector::operator[](int i)",
00083 indexmin(), indexmax(), i);
00084 }
00085 if (i>indexmax()) {
00086 ADMB_ARRAY_BOUNDS_ERROR("Index too high",
00087 "param_init_matrix& prevariable param_init_vector_vector::operator[](int i)",
00088 indexmin(), indexmax(), i);
00089 }
00090 return v[i];
00091 }
00092
00097 param_init_matrix& param_init_matrix_vector::operator () (int i)
00098 {
00099 if (i<indexmin()) {
00100 ADMB_ARRAY_BOUNDS_ERROR("Index too low",
00101 "param_init_matrix& param_init_matrix_vector::operator () (int i)",
00102 indexmin(), indexmax(), i);
00103 }
00104 if (i>indexmax()) {
00105 ADMB_ARRAY_BOUNDS_ERROR("Index too high",
00106 "param_init_matrix& param_init_matrix_vector::operator () (int i)",
00107 indexmin(), indexmax(), i);
00108 }
00109 return v[i];
00110 }
00111
00116 dvar_vector& param_init_matrix_vector::operator () (int i,int j)
00117 {
00118 if (i<indexmin()) {
00119 ADMB_ARRAY_BOUNDS_ERROR("Index too low",
00120 "dvar_vector& param_init_matrix_vector::operator () (int i, int j)",
00121 indexmin(), indexmax(), i);
00122 }
00123 if (i>indexmax()) {
00124 ADMB_ARRAY_BOUNDS_ERROR("Index too high",
00125 "dvar_vector& param_init_matrix_vector::operator () (int i, int j)",
00126 indexmin(), indexmax(), i);
00127 }
00128 return v[i][j];
00129 }
00130
00135 prevariable param_init_matrix_vector::operator () (int i,int j,int k)
00136 {
00137 if (i<indexmin()) {
00138 ADMB_ARRAY_BOUNDS_ERROR("Index too low",
00139 "prevariable param_init_matrix_vector::operator () (int i, int j, int k)",
00140 indexmin(), indexmax(), i);
00141 }
00142 if (i>indexmax()) {
00143 ADMB_ARRAY_BOUNDS_ERROR("Index too high",
00144 "prevariable param_init_matrix_vector::operator () (int i, int j, int k)",
00145 indexmin(), indexmax(), i);
00146 }
00147 return v[i](j,k);
00148 }
00149
00154 param_init_bounded_vector& param_init_bounded_vector_vector::operator[](int i)
00155 {
00156 if (i<indexmin()) {
00157 ADMB_ARRAY_BOUNDS_ERROR("Index too low",
00158 "param_init_bounded_vector_vector::operator [] (int i)",
00159 indexmin(), indexmax(), i);
00160 }
00161 if (i>indexmax()) {
00162 ADMB_ARRAY_BOUNDS_ERROR("Index too high",
00163 "param_init_bounded_vector_vector::operator [] (int i)",
00164 indexmin(), indexmax(), i);
00165 }
00166 return v[i];
00167 }
00168
00173 param_init_bounded_vector& param_init_bounded_vector_vector::operator()(int i)
00174 {
00175 if (i<indexmin()) {
00176 ADMB_ARRAY_BOUNDS_ERROR("Index too low",
00177 "param_init_bounded_vector_vector::operator () (int i)",
00178 indexmin(), indexmax(), i);
00179 }
00180 if (i>indexmax()) {
00181 ADMB_ARRAY_BOUNDS_ERROR("Index too high",
00182 "param_init_bounded_vector_vector::operator () (int i)",
00183 indexmin(), indexmax(), i);
00184 }
00185 return v[i];
00186 }
00187
00192 prevariable param_init_bounded_vector_vector::operator () (int i,int j)
00193 {
00194 if (i<indexmin()) {
00195 ADMB_ARRAY_BOUNDS_ERROR("Index too low",
00196 "prevariable param_init_bounded_vector_vector::operator()(int i, int j)",
00197 indexmin(), indexmax(), i);
00198 }
00199 if (i>indexmax()) {
00200 ADMB_ARRAY_BOUNDS_ERROR("Index too high",
00201 "param_init_bounded_vector_vector::operator () (int i, int j)",
00202 indexmin(), indexmax(), i);
00203 }
00204 return v[i][j];
00205 }
00206
00211 param_init_bounded_matrix& param_init_bounded_matrix_vector::operator[](int i)
00212 {
00213 if (i<indexmin()) {
00214 ADMB_ARRAY_BOUNDS_ERROR("Index too low",
00215 "param_init_bounded_matrix_vector::operator [] (int i)",
00216 indexmin(), indexmax(), i);
00217 }
00218 if (i>indexmax()) {
00219 ADMB_ARRAY_BOUNDS_ERROR("Index too high",
00220 "param_init_bounded_matrix_vector::operator [] (int i)",
00221 indexmin(), indexmax(), i);
00222 }
00223 return v[i];
00224 }
00225
00230 param_init_bounded_matrix& param_init_bounded_matrix_vector::operator()(int i)
00231 {
00232 if (i<indexmin()) {
00233 ADMB_ARRAY_BOUNDS_ERROR("Index too low",
00234 "param_init_bounded_matrix_vector::operator()(int i)",
00235 indexmin(), indexmax(), i);
00236 }
00237 if (i>indexmax()) {
00238 ADMB_ARRAY_BOUNDS_ERROR("Index too high",
00239 "param_init_bounded_matrix_vector::operator () (int i)",
00240 indexmin(), indexmax(), i);
00241 }
00242 return v[i];
00243 }
00244
00249 dvar_vector& param_init_bounded_matrix_vector::operator () (int i,int j)
00250 {
00251 if (i<indexmin()) {
00252 ADMB_ARRAY_BOUNDS_ERROR("Index too low",
00253 "param_init_bounded_matrix_vector::operator () (int i, int j)",
00254 indexmin(), indexmax(), i);
00255 }
00256 if (i>indexmax()) {
00257 ADMB_ARRAY_BOUNDS_ERROR("Index too high",
00258 "param_init_bounded_matrix_vector::operator () (int i, int j)",
00259 indexmin(), indexmax(), i);
00260 }
00261 return v[i][j];
00262 }
00263
00268 prevariable param_init_bounded_matrix_vector::operator()(int i,int j,int k)
00269 {
00270 if (i<indexmin()) {
00271 ADMB_ARRAY_BOUNDS_ERROR("Index too low",
00272 "param_init_bounded_matrix_vector::operator () (int i, int j, int k)",
00273 indexmin(), indexmax(), i);
00274 }
00275 if (i>indexmax()) {
00276 ADMB_ARRAY_BOUNDS_ERROR("Index too high",
00277 "param_init_bounded_matrix_vector::operator () (int i, int j, int k)",
00278 indexmin(), indexmax(), i);
00279 }
00280 return v[i](j,k);
00281 }
00282
00287 param_init_number& param_init_number_vector::operator [] (int i)
00288 {
00289 if (i<indexmin()) {
00290 ADMB_ARRAY_BOUNDS_ERROR("Index too low",
00291 "param_init_number_vector::operator [] (int i)",
00292 indexmin(), indexmax(), i);
00293 }
00294 if (i>indexmax()) {
00295 ADMB_ARRAY_BOUNDS_ERROR("Index too high",
00296 "param_init_number_vector::operator [] (int i)",
00297 indexmin(), indexmax(), i);
00298 }
00299 return v[i];
00300 }
00301
00306 param_init_number& param_init_number_vector::operator () (int i)
00307 {
00308 if (i<indexmin()) {
00309 ADMB_ARRAY_BOUNDS_ERROR("Index too low",
00310 "param_init_number_vector::operator () (int i)",
00311 indexmin(), indexmax(), i);
00312 }
00313 if (i>indexmax()) {
00314 ADMB_ARRAY_BOUNDS_ERROR("Index too high",
00315 "param_init_number& param_init_number_vector::operator () (int i)",
00316 indexmin(), indexmax(), i);
00317 }
00318 return v[i];
00319 }
00320
00325 param_init_bounded_number& param_init_bounded_number_vector::operator[](int i)
00326 {
00327 if (!v)
00328 {
00329 cerr << "Error: param_init_bounded_number_vector was not allocated.\n";
00330 throw std::bad_alloc();
00331 }
00332 else if (i < indexmin() || indexmax() < i)
00333 {
00334 std::string what =
00335 "Invalid index in param_init_number_vector::operator[](int i)";
00336 throw std::out_of_range(what);
00337 }
00338 else
00339 return v[i];
00340 }
00345 param_init_bounded_number& param_init_bounded_number_vector::operator()(int i)
00346 {
00347 if (!v)
00348 {
00349 cerr << "Error: param_init_bounded_number_vector was not allocated.\n";
00350 throw std::bad_alloc();
00351 }
00352 else if (i < indexmin() || indexmax() < i)
00353 {
00354 std::string what =
00355 "Invalid index in param_init_number_vector::operator()(int i)";
00356 throw std::out_of_range(what);
00357 }
00358 else
00359 return v[i];
00360 }
00361 #endif