Revision 1585

trunk/src/linad99/lvector.cpp (revision 1585)
8 8
 * \file
9 9
 * Description not yet available.
10 10
 */
11
#include "fvar.hpp"
12

  
13 11
#ifdef __TURBOC__
14 12
  #pragma hdrstop
15 13
  #include <iostream.h>
......
20 18
#endif
21 19

  
22 20
#include <stdlib.h>
21
#include "fvar.hpp"
23 22

  
24 23
void denormalize_ptr(void * ptr, unsigned int byte_offset);
25 24

  
26 25
/**
26
Default constructor
27
*/
28
lvector::lvector(void)
29
{
30
  allocate();
31
}
32
/**
33
Copy constructor
34
*/
35
lvector::lvector(const lvector& t)
36
{
37
  shape=t.shape;
38
  (shape->ncopies)++;
39
  v = t.v;
40
}
41
/**
27 42
Destructor
28 43
*/
29 44
lvector::~lvector()
......
36 51
    }
37 52
    else
38 53
    {
39
      if (v == NULL)
54
      if (v)
40 55
      {
41
        cerr << " Trying to delete NULL pointer in ~lvector\n";
42
        ad_exit(21);
56
        v += indexmin();
57
        delete [] v;
58
        v = NULL;
43 59
      }
44
      v += indexmin();
45
      delete [] v;
46
      v = NULL;
47

  
48 60
      delete shape;
49 61
      shape = NULL;
50 62
    }
51 63
  }
52
  else
53
  {
54
    cerr << "Trying to delete an unallocated lvector" << endl;
55
  }
56 64
}
57 65
/**
58
Copy constructor
59
*/
60
lvector::lvector(const lvector& t)
61
{
62
  shape=t.shape;
63
  (shape->ncopies)++;
64
  v = t.v;
65
}
66
/**
67
Default constructor
68
*/
69
lvector::lvector(void)
70
{
71
  allocate();
72
}
73
/**
74 66
 * Description not yet available.
75 67
 * \param
76 68
 */
......
88 80
   }
89 81

  
90 82
   v -= indexmin();
91
   for ( int i=indexmin(); i<=indexmax(); i++)
83
   for (int i=indexmin(); i<=indexmax(); i++)
92 84
   {
93 85
   #if !defined(USE_DDOUBLE)
94 86
     v[i]= (AD_LONG_INT) u.elem(i);
......
196 188
 */
197 189
lvector::lvector(const ivector& u)
198 190
 {
199
   if ( (shape=new vector_shape(u.indexmin(),u.indexmax()))==0 )
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff