ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
doublind.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  */
11 #include <admodel.h>
12 
18  {
19  p=pit.p;
20  (*(p->ncopies))++;
21  }
22 
23  ad_double::ad_double(const double_index_type& it) : d(it.ddouble()) {}
24 
30  {
31  return new dvector_index(dmatrix::operator [](i));
32  }
33 
38  double double_index_type::ddouble(void) const
39  {
40  return double(*p);
41  }
42 
43 /*
44 index_type::index_type(const data_int& x)
45 {
46  p = new number_index(x);
47 }
48 */
49 
55  {
56  p = new double_index(x);
57  }
58 
64  {
65  p = new dvector_index((const dvector&)(x));
66  }
67 
73  {
74  p = new dmatrix_index((const dmatrix&)(x));
75  }
76 
81 {
82  //DoesNothing
83 }
84 
90  {
91  p = new d3_index((d3_array&)(x));
92  }
93 
99  {
100  p = (*(*(pit.a)).p)[pit.i];
101  // Dave uncommented this august 1998 because program crashed
102  // (*p->ncopies)++;
103  }
104 
110  {
111  return pre_double_index_type(this,i);
112  }
113 
119  {
120  return pre_double_index_type(this,i);
121  }
122 
128  {
129  return pre_double_index_type(this,i);
130  }
131 
137  {
138  return pre_double_index_type(this,i);
139  }
140 
145 {
146  //DoesNothing
147 }
148 
154  {
155  if (!p)
156  {
157  cerr << "trying to delete a NULL optr in ~double_index_type()" << endl;
158  }
159  else
160  {
161  if (!(*(p->ncopies)))
162  {
163  delete p;
164  p = NULL;
165  }
166  else
167  {
168  (*(p->ncopies))--;
169  }
170  }
171  }
172 
178 {
179  if (!(*ncopies))
180  {
181  delete ncopies;
182  ncopies=NULL;
183  }
184 }
185 
191 {
192 }
193 
199 {
200  ncopies = new int;
201  *ncopies=0;
202 }
203 
209 {
210  ncopies = ig.ncopies;
211  (*ncopies)++;
212 }
213 
219 {
220  return new double_index(double(*this));
221 }
double_index_type(double x)
Description not yet available.
Definition: doublind.cpp:54
Description not yet available.
Definition: fvar.hpp:8485
virtual double_index_guts * operator[](int i)
Description not yet available.
Definition: doublind.cpp:29
Description not yet available.
Definition: fvar.hpp:8688
double_index_guts * p
Definition: fvar.hpp:8566
#define x
~double_index_type()
Description not yet available.
Definition: doublind.cpp:153
Vector of double precision numbers.
Definition: dvector.h:50
double_index_guts()
Description not yet available.
Definition: doublind.cpp:198
virtual ~dmatrix_index()
Destructor.
Definition: doublind.cpp:80
const double_index_type * a
Definition: fvar.hpp:8487
Description not yet available.
Definition: fvar.hpp:8636
prnstream & endl(prnstream &)
double_index(double i)
Definition: fvar.hpp:8621
virtual ~double_index_guts()
Description not yet available.
Definition: doublind.cpp:177
ad_double()=delete
Description not yet available.
Description not yet available.
Definition: fvar.hpp:2819
dvector_index(const dvector &v)
Description not yet available.
Definition: doublind.cpp:190
double_index_type operator()(int i)
Description not yet available.
Definition: doublind.cpp:136
double_index_type operator[](int i)
Description not yet available.
Definition: doublind.cpp:127
virtual double_index_guts * operator[](int i)
Description not yet available.
Definition: doublind.cpp:218
Description not yet available.
Definition: fvar.hpp:8534
Description not yet available.
Definition: fvar.hpp:3727
Description not yet available.
Definition: fvar.hpp:8661
Description not yet available.
Definition: fvar.hpp:8601
virtual ~dvector_index()
Destructor.
Definition: doublind.cpp:144
Description not yet available.
Definition: fvar.hpp:8564
double ddouble(void) const
Description not yet available.
Definition: doublind.cpp:38