ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
model35.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  */
7 #include <admodel.h>
8 
10 {
11  if (d && allocated(*this))
12  {
13  double * tmp=d;
14  int rmin=rowmin();
15  int rmax=rowmax();
16  int cmin=colmin();
17  int cmax=colmax();
18  int hmin=indexmin();
19  int hmax=indexmax();
20  for (int j=cmin;j<=cmax;j++)
21  {
22  for (int i=rmin;i<=rmax;i++)
23  {
24  for (int k=hmin;k<=hmax;k++)
25  {
26  *tmp++=(*this)(k,i,j);
27  }
28  }
29  }
30  }
31 }
32 
34 {
35  if (d && allocated(*this))
36  {
37  double * tmp=d;
38  int rmin=rowmin();
39  int rmax=rowmax();
40  int cmin=colmin();
41  int cmax=colmax();
42  int hmin=indexmin();
43  int hmax=indexmax();
44  for (int j=cmin;j<=cmax;j++)
45  {
46  for (int i=rmin;i<=rmax;i++)
47  {
48  for (int k=hmin;k<=hmax;k++)
49  {
50  *tmp++=::value((*this)(k,i,j));
51  }
52  }
53  }
54  }
55 }
56 
57 void dll_param_d3array::allocate(double * _d,int hmin,int hmax,
58  int rmin,int rmax, int cmin,int cmax,const char * _s)
59 {
60  d=_d;
61  named_dvar3_array::allocate(hmin,hmax,rmin,rmax,cmin,cmax,_s);
62  double * tmp=_d;
63  if (d && allocated(*this))
64  {
65  for (int j=cmin;j<=cmax;j++)
66  {
67  for (int i=rmin;i<=rmax;i++)
68  {
69  for (int k=hmin;k<=hmax;k++)
70  {
71  (*this)(k,i,j)=*tmp++;
72  }
73  }
74  }
75  }
76 }
77 
78 
79 void dll_data_3array::allocate(double * _d,int hmin,int hmax,
80  int rmin,int rmax, int cmin,int cmax,const char * _s)
81 {
82  d=_d;
83  named_d3_array::allocate(hmin,hmax,rmin,rmax,cmin,cmax,_s);
84  if (d && allocated(*this))
85  {
86  double * tmp=_d;
87  for (int j=cmin;j<=cmax;j++)
88  {
89  for (int i=rmin;i<=rmax;i++)
90  {
91  for (int k=hmin;k<=hmax;k++)
92  {
93  (*this)(k,i,j)=*tmp++;
94  }
95  }
96  }
97  }
98 }
99 
100 
102 {
103  double * tmp=d;
104  if (d && allocated(*this))
105  {
106  int hmin=indexmin();
107  int hmax=indexmax();
108  int rmin=rowmin();
109  int rmax=rowmax();
110  int cmin=colmin();
111  int cmax=colmax();
112  for (int j=cmin;j<=cmax;j++)
113  {
114  for (int i=rmin;i<=rmax;i++)
115  {
116  for (int k=hmin;k<=hmax;k++)
117  {
118  *tmp++=::value((*this)(k,i,j));
119  }
120  }
121  }
122  }
123 }
124 
125 
126 void dll_param_init_d3array::allocate(double* _d,int hmin,int hmax,
127  int rmin,int rmax,int cmin,int cmax,int _phase_start,const char *_s )
128 {
129  d=_d;
130  named_dvar3_array::allocate(hmin,hmax,rmin,rmax,cmin,cmax,_s);
131  initial_params::allocate(_phase_start);
132  if (d && allocated(*this))
133  {
134  double * tmp=_d;
135  for (int j=cmin;j<=cmax;j++)
136  {
137  for (int i=rmin;i<=rmax;i++)
138  {
139  for (int k=hmin;k<=hmax;k++)
140  {
141  (*this)(k,i,j)=*tmp++;
142  }
143  }
144  }
145  }
146 }
147 
148 void dll_param_init_d3array::allocate(double* _d,int hmin,int hmax,
149  int rmin,int rmax,int cmin,int cmax,const char *_s )
150 {
151  dll_param_init_d3array::allocate(_d,hmin,hmax,rmin,rmax,
152  cmin,cmax,1,_s);
153 }
154 
156 {
158  return *this;
159 }
160 
162 {
164  return *this;
165 }
166 
168 {
170  return *this;
171 }
172 
174 {
176  return *this;
177 }
178 
179 
181 {
183  return *this;
184 }
int colmax(void) const
Definition: fvar.hpp:4287
void allocate(void)
Does NOT allocate, but initializes empty d3_array.
Definition: d3arr10.cpp:11
int rowmax(void) const
Definition: fvar.hpp:3847
int colmax(void) const
Definition: fvar.hpp:3839
dll_param_init_d3array & operator=(const d3_array &)
Definition: model35.cpp:180
int indexmax() const
Definition: fvar.hpp:3822
int allocated(const ivector &v)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: fvar_a59.cpp:13
int rowmin(void) const
Definition: fvar.hpp:3843
virtual ~dll_data_3array()
Definition: model35.cpp:9
d3_array value(const dvar3_array &)
Description not yet available.
Definition: admodel.h:1661
int colmin() const
Definition: fvar.hpp:4283
Description not yet available.
Definition: admodel.h:2556
int indexmax() const
Definition: fvar.hpp:4273
int colmin(void) const
Definition: fvar.hpp:3835
d3_array & operator=(const d3_array &m1)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr8.cpp:82
dvar3_array & operator=(const d3_array &m1)
Assign element values from scalar arr3 to dvar3_array.
Definition: f3arr13.cpp:19
virtual ~dll_param_init_d3array()
Definition: model35.cpp:101
Description not yet available.
Description not yet available.
Definition: fvar.hpp:4197
double * d
Definition: admodel.h:1663
void allocate(int _phase_start)
Definition: model.cpp:117
int rowmax(void) const
Definition: fvar.hpp:4295
void allocate(void)
Does not allocte, but initialize class members.
Definition: f3arr17.cpp:18
dll_param_d3array & operator=(const d3_array &)
Definition: model35.cpp:167
Description not yet available.
Definition: admodel.h:2537
int indexmin() const
Definition: fvar.hpp:3818
dll_data_3array & operator=(const d3_array &)
Definition: model35.cpp:155
Description not yet available.
Definition: fvar.hpp:3727
virtual ~dll_param_d3array()
Definition: model35.cpp:33
int indexmin() const
Definition: fvar.hpp:4272
int rowmin(void) const
Definition: fvar.hpp:4291