ADMB Documentation  11.1.1913
 All Classes Files Functions Variables Typedefs Friends Defines
d3arr1.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: d3arr1.cpp 1712 2014-02-28 23:52:33Z 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 
00014 #ifndef OPT_LIB
00015 
00019     double& d3_array::operator () (int k, int i, int j)
00020     {
00021       #ifdef SAFE_ARRAYS
00022         if (k<slicemin())
00023         {
00024          ADMB_ARRAY_BOUNDS_ERROR("array bound exceeded -- slice index too low",
00025          "dmatrix& d3_array::operator() (int k, int i, int j)",
00026          slicemin(), slicemax(), k);
00027         }
00028         if (k>slicemax())
00029         {
00030         ADMB_ARRAY_BOUNDS_ERROR("array bound exceeded -- slice index too high",
00031         "dmatrix& d3_array::operator() (int k, int i, int j)",
00032         slicemin(), slicemax(), k);
00033         }
00034       #endif
00035       return ( (elem(k))(i,j) );
00036     }
00037 
00042     dvector& d3_array::operator () (int k, int i)
00043     {
00044       #ifdef SAFE_ARRAYS
00045         if (k<slicemin())
00046         {
00047          ADMB_ARRAY_BOUNDS_ERROR("array bound exceeded -- slice index too low",
00048          "dmatrix& d3_array::operator() (int k, int i)",
00049          slicemin(), slicemax(), k);
00050         }
00051         if (k>slicemax())
00052         {
00053          ADMB_ARRAY_BOUNDS_ERROR("array bound exceeded -- slice index too high",
00054          "dmatrix& d3_array::operator() (int k, int i)",
00055          slicemin(), slicemax(), k);
00056         }
00057       #endif
00058       return ( (elem(k))(i) );
00059     }
00060 
00065  dmatrix& d3_array::operator[] (int i)
00066  {
00067    #ifdef SAFE_ARRAYS
00068      if (i<slicemin())
00069      {
00070        ADMB_ARRAY_BOUNDS_ERROR("matrix bound exceeded -- row index too low",
00071        "dmatrix& d3_array::operator[] (int i)", indexmin(), indexmax(), i);
00072      }
00073      if (i>slicemax())
00074      {
00075        ADMB_ARRAY_BOUNDS_ERROR("matrix bound exceeded -- row index too high",
00076        "dmatrix& d3_array::operator[] (int i)", indexmin(), indexmax(), i);
00077      }
00078    #endif
00079    return(t[i]);
00080  }
00081 
00086  dmatrix& d3_array::operator() (int i)
00087  {
00088    #ifdef SAFE_ARRAYS
00089      if (i<slicemin())
00090      {
00091        ADMB_ARRAY_BOUNDS_ERROR("matrix bound exceeded -- row index too low",
00092        "dmatrix& d3_array::operator() (int i)", indexmin(), indexmax(), i);
00093      }
00094      if (i>slicemax())
00095      {
00096        ADMB_ARRAY_BOUNDS_ERROR("matrix bound exceeded -- row index too high",
00097        "dmatrix& d3_array::operator() (int i)", indexmin(), indexmax(), i);
00098      }
00099    #endif
00100    return(t[i]);
00101  }
00102 #endif