ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
f3arr3.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include "fvar.hpp"
00012 
00017 d3_array value(const dvar3_array& ar)
00018  {
00019    d3_array tmp;
00020    tmp.allocate(ar);
00021    for (int i=tmp.slicemin(); i<=tmp.slicemax(); i++)
00022    {
00023      tmp[i]=value(ar(i));
00024    }
00025    return tmp;
00026  }
00027 
00032 void d3_array::allocate(const dvar3_array& d3v)
00033  {
00034    int sl=d3v.slicemin();
00035    int sh=d3v.slicemax();
00036    //int nrl=d3v.rowmin();
00037    //int nrh=d3v.rowmax();
00038    //int ncl=d3v.colmin();
00039    //int nch=d3v.colmax();
00040    if ( (shape=new three_array_shape(sl,sh)) == 0)
00041    {
00042      cerr << " Error allocating memory in d3_array contructor\n";
00043    }
00044    int ss=slicesize();
00045    if ( (t = new dmatrix[ss]) == 0)
00046    {
00047      cerr << " Error allocating memory in d3_array contructor\n";
00048      ad_exit(21);
00049    }
00050    t -= slicemin();
00051    for (int i=sl; i<=sh; i++)
00052    {
00053      t[i].allocate(d3v(i));
00054    }
00055  }