ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
model49.cpp
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Author: David Fournier
5  * Copyright (c) 2008-2012 Regents of the University of California
6  */
11 #include <admodel.h>
12 #include "admb_messages.h"
13 
14 #if !defined(OPT_LIB)
15 #include <stdexcept>
16 
22  {
23  if (i<indexmin()) {
24  ADMB_ARRAY_BOUNDS_ERROR("Index too low",
25  "param_init_vector& param_init_vector_vector::operator [] (int i)",
26  indexmin(), indexmax(), i);
27  }
28  if (i>indexmax()) {
29  ADMB_ARRAY_BOUNDS_ERROR("Index too high",
30  "param_init_vector& param_init_vector_vector::operator [] (int i)",
31  indexmin(), indexmax(), i);
32  }
33  return v[i];
34  }
35 
41  {
42  if (i<indexmin()) {
43  ADMB_ARRAY_BOUNDS_ERROR("Index too low",
44  "param_init_vector& param_init_vector_vector::operator () (int i)",
45  indexmin(), indexmax(), i);
46  }
47  if (i>indexmax()) {
48  ADMB_ARRAY_BOUNDS_ERROR("Index too high",
49  "param_init_vector& param_init_vector_vector::operator () (int i)",
50  indexmin(), indexmax(), i);
51  }
52  return v[i];
53  }
54 
60  {
61  if (i<indexmin()) {
62  ADMB_ARRAY_BOUNDS_ERROR("Index too low",
63  "prevariable param_init_vector_vector::operator () (int i, int j)",
64  indexmin(), indexmax(), i);
65  }
66  if (i>indexmax()) {
67  ADMB_ARRAY_BOUNDS_ERROR("Index too high",
68  "prevariable param_init_vector_vector::operator () (int i, int j)",
69  indexmin(), indexmax(), i);
70  }
71  return v[i][j];
72  }
73 
79  {
80  if (i<indexmin()) {
81  ADMB_ARRAY_BOUNDS_ERROR("Index too low",
82  "param_init_matrix& prevariable param_init_vector_vector::operator[](int i)",
83  indexmin(), indexmax(), i);
84  }
85  if (i>indexmax()) {
86  ADMB_ARRAY_BOUNDS_ERROR("Index too high",
87 "param_init_matrix& prevariable param_init_vector_vector::operator[](int i)",
88  indexmin(), indexmax(), i);
89  }
90  return v[i];
91  }
92 
98  {
99  if (i<indexmin()) {
100  ADMB_ARRAY_BOUNDS_ERROR("Index too low",
101 "param_init_matrix& param_init_matrix_vector::operator () (int i)",
102  indexmin(), indexmax(), i);
103  }
104  if (i>indexmax()) {
105  ADMB_ARRAY_BOUNDS_ERROR("Index too high",
106 "param_init_matrix& param_init_matrix_vector::operator () (int i)",
107  indexmin(), indexmax(), i);
108  }
109  return v[i];
110  }
111 
117  {
118  if (i<indexmin()) {
119  ADMB_ARRAY_BOUNDS_ERROR("Index too low",
120 "dvar_vector& param_init_matrix_vector::operator () (int i, int j)",
121  indexmin(), indexmax(), i);
122  }
123  if (i>indexmax()) {
124  ADMB_ARRAY_BOUNDS_ERROR("Index too high",
125  "dvar_vector& param_init_matrix_vector::operator () (int i, int j)",
126  indexmin(), indexmax(), i);
127  }
128  return v[i][j];
129  }
130 
136  {
137  if (i<indexmin()) {
138  ADMB_ARRAY_BOUNDS_ERROR("Index too low",
139  "prevariable param_init_matrix_vector::operator () (int i, int j, int k)",
140  indexmin(), indexmax(), i);
141  }
142  if (i>indexmax()) {
143  ADMB_ARRAY_BOUNDS_ERROR("Index too high",
144  "prevariable param_init_matrix_vector::operator () (int i, int j, int k)",
145  indexmin(), indexmax(), i);
146  }
147  return v[i](j,k);
148  }
149 
155  {
156  if (i<indexmin()) {
157  ADMB_ARRAY_BOUNDS_ERROR("Index too low",
158  "param_init_bounded_vector_vector::operator [] (int i)",
159  indexmin(), indexmax(), i);
160  }
161  if (i>indexmax()) {
162  ADMB_ARRAY_BOUNDS_ERROR("Index too high",
163  "param_init_bounded_vector_vector::operator [] (int i)",
164  indexmin(), indexmax(), i);
165  }
166  return v[i];
167  }
168 
174  {
175  if (i<indexmin()) {
176  ADMB_ARRAY_BOUNDS_ERROR("Index too low",
177  "param_init_bounded_vector_vector::operator () (int i)",
178  indexmin(), indexmax(), i);
179  }
180  if (i>indexmax()) {
181  ADMB_ARRAY_BOUNDS_ERROR("Index too high",
182  "param_init_bounded_vector_vector::operator () (int i)",
183  indexmin(), indexmax(), i);
184  }
185  return v[i];
186  }
187 
193  {
194  if (i<indexmin()) {
195  ADMB_ARRAY_BOUNDS_ERROR("Index too low",
196  "prevariable param_init_bounded_vector_vector::operator()(int i, int j)",
197  indexmin(), indexmax(), i);
198  }
199  if (i>indexmax()) {
200  ADMB_ARRAY_BOUNDS_ERROR("Index too high",
201  "param_init_bounded_vector_vector::operator () (int i, int j)",
202  indexmin(), indexmax(), i);
203  }
204  return v[i][j];
205  }
206 
212  {
213  if (i<indexmin()) {
214  ADMB_ARRAY_BOUNDS_ERROR("Index too low",
215  "param_init_bounded_matrix_vector::operator [] (int i)",
216  indexmin(), indexmax(), i);
217  }
218  if (i>indexmax()) {
219  ADMB_ARRAY_BOUNDS_ERROR("Index too high",
220  "param_init_bounded_matrix_vector::operator [] (int i)",
221  indexmin(), indexmax(), i);
222  }
223  return v[i];
224  }
225 
231  {
232  if (i<indexmin()) {
233  ADMB_ARRAY_BOUNDS_ERROR("Index too low",
234  "param_init_bounded_matrix_vector::operator()(int i)",
235  indexmin(), indexmax(), i);
236  }
237  if (i>indexmax()) {
238  ADMB_ARRAY_BOUNDS_ERROR("Index too high",
239  "param_init_bounded_matrix_vector::operator () (int i)",
240  indexmin(), indexmax(), i);
241  }
242  return v[i];
243  }
244 
250  {
251  if (i<indexmin()) {
252  ADMB_ARRAY_BOUNDS_ERROR("Index too low",
253  "param_init_bounded_matrix_vector::operator () (int i, int j)",
254  indexmin(), indexmax(), i);
255  }
256  if (i>indexmax()) {
257  ADMB_ARRAY_BOUNDS_ERROR("Index too high",
258  "param_init_bounded_matrix_vector::operator () (int i, int j)",
259  indexmin(), indexmax(), i);
260  }
261  return v[i][j];
262  }
263 
269  {
270  if (i<indexmin()) {
271  ADMB_ARRAY_BOUNDS_ERROR("Index too low",
272  "param_init_bounded_matrix_vector::operator () (int i, int j, int k)",
273  indexmin(), indexmax(), i);
274  }
275  if (i>indexmax()) {
276  ADMB_ARRAY_BOUNDS_ERROR("Index too high",
277  "param_init_bounded_matrix_vector::operator () (int i, int j, int k)",
278  indexmin(), indexmax(), i);
279  }
280  return v[i](j,k);
281  }
282 
288  {
289  if (i<indexmin()) {
290  ADMB_ARRAY_BOUNDS_ERROR("Index too low",
291  "param_init_number_vector::operator [] (int i)",
292  indexmin(), indexmax(), i);
293  }
294  if (i>indexmax()) {
295  ADMB_ARRAY_BOUNDS_ERROR("Index too high",
296  "param_init_number_vector::operator [] (int i)",
297  indexmin(), indexmax(), i);
298  }
299  return v[i];
300  }
301 
307  {
308  if (i<indexmin()) {
309  ADMB_ARRAY_BOUNDS_ERROR("Index too low",
310  "param_init_number_vector::operator () (int i)",
311  indexmin(), indexmax(), i);
312  }
313  if (i>indexmax()) {
314  ADMB_ARRAY_BOUNDS_ERROR("Index too high",
315  "param_init_number& param_init_number_vector::operator () (int i)",
316  indexmin(), indexmax(), i);
317  }
318  return v[i];
319  }
320 
326 {
327  if (!v)
328  {
329  cerr << "Error: param_init_bounded_number_vector was not allocated.\n";
330  throw std::bad_alloc();
331  }
332  else if (i < indexmin() || indexmax() < i)
333  {
334  std::string what =
335  "Invalid index in param_init_number_vector::operator[](int i)";
336  throw std::out_of_range(what);
337  }
338  else
339  return v[i];
340 }
346 {
347  if (!v)
348  {
349  cerr << "Error: param_init_bounded_number_vector was not allocated.\n";
350  throw std::bad_alloc();
351  }
352  else if (i < indexmin() || indexmax() < i)
353  {
354  std::string what =
355  "Invalid index in param_init_number_vector::operator()(int i)";
356  throw std::out_of_range(what);
357  }
358  else
359  return v[i];
360 }
361 #endif
Base class for dvariable.
Definition: fvar.hpp:1315
param_init_bounded_number & operator()(int i)
Definition: admodel.h:2955
param_init_bounded_matrix & operator()(int i)
Definition: admodel.h:2859
param_init_matrix * v
Definition: admodel.h:2769
param_init_bounded_matrix * v
Definition: admodel.h:2815
int indexmin() const
Definition: admodel.h:2901
Description not yet available.
Definition: admodel.h:1151
param_init_bounded_number & operator[](int i)
Definition: admodel.h:2950
Description not yet available.
Definition: admodel.h:1409
ADMB variable vector.
Definition: fvar.hpp:2172
Description not yet available.
Definition: admodel.h:968
param_init_bounded_vector * v
Definition: admodel.h:2720
param_init_bounded_vector & operator[](int i)
Definition: admodel.h:2732
Description not yet available.
Definition: admodel.h:1228
param_init_bounded_vector & operator()(int i)
Definition: admodel.h:2733
Description not yet available.
Definition: admodel.h:1058
int indexmin() const
Definition: admodel.h:2803
Description not yet available.
param_init_number & operator()(int i)
Definition: admodel.h:2889
int indexmax() const
Definition: admodel.h:2804
param_init_bounded_number * v
Definition: admodel.h:2917
#define ADMB_ARRAY_BOUNDS_ERROR(message, function, lower_bounds, upper_bounds, index)
Definition: admb_messages.h:47
Description not yet available.
Definition: admodel.h:1316
param_init_bounded_matrix & operator[](int i)
Definition: admodel.h:2856
param_init_number * v
Definition: admodel.h:2875
param_init_number & operator[](int i)
Definition: admodel.h:2888
int indexmax() const
Definition: admodel.h:2902
param_init_vector & operator[](int i)
Definition: admodel.h:2691
param_init_vector & operator()(int i)
Definition: admodel.h:2692
param_init_matrix & operator[](int i)
Definition: admodel.h:2783
param_init_vector * v
Definition: admodel.h:2677
param_init_matrix & operator()(int i)
Definition: admodel.h:2784