ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
model43.cpp
Go to the documentation of this file.
1 
5 #include <admodel.h>
6 
12  const double_index_type& initial_value)
13 {
14  it = new double_index_type(initial_value);
15 }
20  v(NULL),
21  index_min(0),
22  index_max(-1),
23  it(NULL)
24 {
25 }
37  int min1,
38  int max1,
39  const index_type& min,
40  const index_type& max,
41  const char* s)
42 {
43  allocate(min1, max1, min, max, 1, s);
44 }
57  int min1,
58  int max1,
59  const index_type& min,
60  const index_type& max,
61  const index_type& phase_start,
62  const char* s)
63 {
64  if (max1 >= min1)
65  {
66  unsigned int size = static_cast<unsigned int>(max1 - min1 + 1);
67  v = new param_init_vector[size];
68  if (!v)
69  {
70  cerr << " error trying to allocate memory in "
71  "param_init_vector_vector " << endl;
72  ad_exit(1);
73  }
74  index_min = min1;
75  index_max = max1;
76  v -= indexmin();
77  for (int i = indexmin(); i <= indexmax(); ++i)
78  {
79  if (it) v[i].set_initial_value(ad_double((*it)[i]));
80  adstring ss = s + adstring("[") + str(i) + adstring("]");
81  v[i].allocate(min[i], max[i], phase_start[i], (char*)(ss));
82  }
83  }
84 }
97  const ad_integer& imin,
98  const ad_integer& imax,
99  const ad_integer& _phase_start,
100  const char* s)
101 {
102  named_dvar_vector::allocate(imin, imax, s);
103  if (!(!(*this)))
104  {
105  initial_params::allocate(_phase_start);
107  {
109  }
110  else if (ad_comm::global_parfile)
111  {
113  }
114  else
115  {
117  }
118  }
119  else
120  {
122  }
123 }
128 {
129  deallocate();
130 }
135 {
136  if (it)
137  {
138  delete it;
139  it = NULL;
140  }
141  if (v)
142  {
143  v += indexmin();
144  delete [] v;
145  v = NULL;
146  }
147 }
dvar_vector()
Default constructor.
Definition: fvar_arr.cpp:150
void allocate(int imin, int imax, int phasestart=1, const char *s="UNNAMED")
Allocate variable vector of parameters, then reads values from input data.
Definition: model.cpp:766
Uses polymorphism to get index information from various data types to be used in constructing and all...
Definition: fvar.hpp:7731
void allocate(void)
Does not allocate, but initializes dvar_vector to empty.
Definition: fvar_arr.cpp:216
static uistream * global_bparfile
Definition: fvar.hpp:8859
Stores double value.
Definition: fvar.hpp:8499
exitptr ad_exit
Definition: gradstrc.cpp:53
~param_init_vector_vector()
Destructor.
Definition: model43.cpp:127
void set_initial_value(double x)
Definition: model.cpp:90
double_index_type * it
Definition: admodel.h:2680
Description not yet available.
Definition: admodel.h:968
param_init_vector_vector()
Default constructor.
Definition: model43.cpp:19
void set_initial_value(const double_index_type &it)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: model43.cpp:11
prnstream & endl(prnstream &)
#define min(a, b)
Definition: cbivnorm.cpp:188
Description not yet available.
adstring str(double x, int minwidth=17, int decplaces=-1)
Convert x to adstring with minimum width and total number of decimal places.
Definition: str.cpp:25
void deallocate(void)
Free member allocated memory.
Definition: model43.cpp:134
void allocate(int _phase_start)
Definition: model.cpp:117
double initial_value
Definition: admodel.h:823
dvar_vector & operator=(const dvar_vector &t)
Assign values from other t to dvar_vector.
Definition: fvar_a20.cpp:31
Stores integer.
Definition: fvar.hpp:7654
static cifstream * global_parfile
Definition: fvar.hpp:8857
void allocate(int min1, int max1, const index_type &min, const index_type &max, const index_type &phase_start, const char *s)
Allocate vector min1 to max2 of param_init_vector with dimensions min to max using specified phase_st...
Definition: model43.cpp:56
#define max(a, b)
Definition: cbivnorm.cpp:189
param_init_vector * v
Definition: admodel.h:2677
Description not yet available.
Definition: fvar.hpp:8564