ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar2.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 // file fvar.cpp
12 // constructors, destructors and misc functions involving class prevariable
13 #include "fvar.hpp"
14 
15 #ifdef __TURBOC__
16  #pragma hdrstop
17  #include <iostream.h>
18 #endif
19 
20 #ifdef __ZTC__
21  #include <iostream.hpp>
22 #endif
23 
24 #include <stdio.h>
25 #ifndef __SUN__
26 #endif
27 #include <math.h>
28 #if !defined(OPT_LIB)
29 #include <cassert>
30 #endif
31 
37 {
38 #if !defined(OPT_LIB)
40  {
41  cerr << "Error -- you are trying to create a dvariable object"
42  " when there is " << endl << "no object of type"
43  " gradient_structure in scope " << endl;
44  ad_exit(1);
45  }
46 #endif
48 }
49 
51 {
52  dlink* tmp = last_remove();
53  if (!tmp)
54  {
55  tmp = create();
56  }
57  // cout << "In gradnew the address of the double * ptr is "
58  // << _farptr_tolong(tmp) << "\n";
59  return (double_and_int*)tmp;
60 }
65 void gradfree(dlink* v)
66 {
68  {
69  //delete (double_and_int*)v;
70  v = NULL;
71  return;
72  }
74 }
75 //prevariable::prevariable(const prevariable& t)
76 // {
77 // v=t.v;
78 // (*v).nc++;
79 // }
80 
double_and_int * gradnew()
Definition: fvar2.cpp:50
dlink * append(dlink *link)
Append link to list.
Definition: ddlist.cpp:117
exitptr ad_exit
Definition: gradstrc.cpp:53
dlink * last_remove()
If list is not empty, pop and return last node.
Definition: ddlist.cpp:102
Holds the data for the prevariable class.
Definition: fvar.hpp:191
prnstream & endl(prnstream &)
void gradfree(dlink *v)
Description not yet available.
Definition: fvar2.cpp:65
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
static _THREAD gradient_structure * _instance
dlink * create()
Return new unlinked node.
Definition: ddlist.cpp:75
double_and_int * gradnew()
Creates an entry in the gradient structure linked list.
Definition: fvar2.cpp:36