ADMB Documentation  11.1.1920
 All Classes Files Functions Variables Typedefs Friends Defines
i3arr1.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: i3arr1.cpp 1714 2014-03-01 00:45:28Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include "fvar.hpp"
00012 #include "admb_messages.h"
00013 //#include "i3_array.h"
00014 
00015 #ifndef OPT_LIB
00016 
00021     int& i3_array::operator () (int k, int i, int j)
00022     {
00023       #ifdef SAFE_ARRAYS
00024       if (k < slicemin())
00025       {
00026         ADMB_ARRAY_BOUNDS_ERROR("matrix bound exceeded -- row index too low",
00027         "ivector& i3_array::operator() (int k, int i, int j)",
00028         slicemin(), slicemax(), k);
00029       }
00030       if (k > slicemax())
00031       {
00032         ADMB_ARRAY_BOUNDS_ERROR("matrix bound exceeded -- row index too low",
00033         "ivector& i3_array::operator() (int k, int i, int j)",
00034         slicemin(), slicemax(), k);
00035       }
00036       #endif
00037       return ( (elem(k))(i,j) );
00038     }
00039 
00044     ivector& i3_array::operator () (int k, int i)
00045     {
00046       #ifdef SAFE_ARRAYS
00047       if (k < slicemin())
00048       {
00049         ADMB_ARRAY_BOUNDS_ERROR("matrix bound exceeded -- row index too low",
00050         "ivector& i3_array::operator() (int k, int i)",
00051         slicemin(), slicemax(), k);
00052       }
00053       if (k > slicemax())
00054       {
00055         ADMB_ARRAY_BOUNDS_ERROR("matrix bound exceeded -- row index too high",
00056         "ivector& i3_array::operator() (int k, int i)",
00057         slicemin(), slicemax(), k);
00058       }
00059       #endif
00060       return ( (elem(k))(i) );
00061     }
00062 
00067  imatrix& i3_array::operator[] (int i)
00068  {
00069    #ifdef SAFE_ARRAYS
00070    if (i < slicemin())
00071    {
00072      ADMB_ARRAY_BOUNDS_ERROR("matrix bound exceeded -- row index too low",
00073      "imatrix& i3_array::operator[] (int i)", slicemin(), slicemax(), i);
00074    }
00075    if (i > slicemax())
00076    {
00077      ADMB_ARRAY_BOUNDS_ERROR("matrix bound exceeded -- row index too high",
00078      "imatrix& i3_array::operator[] (int i)", slicemin(), slicemax(), i);
00079    }
00080    #endif
00081    return(t[i]);
00082  }
00083 
00088  imatrix& i3_array::operator() (int i)
00089  {
00090    #ifdef SAFE_ARRAYS
00091    if (i < slicemin())
00092    {
00093      ADMB_ARRAY_BOUNDS_ERROR("matrix bound exceeded -- row index too low",
00094      "imatrix& i3_array::operator() (int i)", slicemin(), slicemax(), i);
00095    }
00096    if (i > slicemax())
00097    {
00098      ADMB_ARRAY_BOUNDS_ERROR("matrix bound exceeded -- row index too high",
00099      "imatrix& i3_array::operator() (int i)", slicemin(), slicemax(), i);
00100    }
00101    #endif
00102    return(t[i]);
00103  }
00104 #endif