/** * Description not yet available. * \param */ int sub_unallocated(const dvar3_array& m) { int iflag=0; int mmin=m.indexmin(); int mmax=m.indexmax(); if (!allocated(m)) { iflag=1; return iflag; } if (!allocated(m)) { iflag=1; return iflag; } for (int i=mmin;i<=mmax;i++) { if (sub_unallocated(m(i))) { iflag=1; break; } } return iflag; }
/** Allocate dvar3_array with same dimensions as m1. */ void dvar3_array::allocate(const dvar3_array& m1) { #ifdef DIAG myheapcheck("Entering dvar3_array matrix(const d3_array& m1)" ); #endif if ((shape = new three_array_shape(m1.slicemin(), m1.slicemax())) == 0) { cerr << " Error allocating memory in dvar3_array contructor" << endl; } if ((t = new dvar_matrix[slicesize()]) == 0) { cerr << " Error allocating memory in dvar3_array contructor" << endl; ad_exit(21); } t -= slicemin(); for (int i = slicemin(); i <= slicemax(); ++i) { t[i].allocate(m1[i]); } }
/** Allocate d3_array with same dimensions as d3v. \param d3v a dvar3_array */ void d3_array::allocate(const dvar3_array& d3v) { int sl = d3v.slicemin(); int sh = d3v.slicemax(); if ((shape = new three_array_shape(sl, sh)) == 0) { cerr << " Error: d3_array unable to allocate memory in " << __FILE__ << ':' << __LINE__ << '\n'; ad_exit(1); } if ((t = new dmatrix[slicesize()]) == 0) { cerr << " Error: d3_array unable to allocate memory in " << __FILE__ << ':' << __LINE__ << '\n'; ad_exit(1); } t -= slicemin(); for (int i = sl; i <= sh; ++i) { t[i].allocate(d3v(i)); } }