Revision 1580

trunk/src/linad99/lvector.cpp (revision 1580)
28 28
*/
29 29
lvector::~lvector()
30 30
{
31
   if (shape)
32
   {
33
     if (shape->ncopies)
34
     {
35
       (shape->ncopies)--;
36
     }
37
     else
38
     {
39
       if ( v == NULL)
40
       {
41
         cerr << " Trying to delete NULL pointer in ~lvector\n";
42
         ad_exit(21);
43
       }
44
       v += indexmin();
45
       delete []v;
46
       v=NULL;
31
  if (shape)
32
  {
33
    if (shape->ncopies)
34
    {
35
      (shape->ncopies)--;
36
    }
37
    else
38
    {
39
      if (v == NULL)
40
      {
41
        cerr << " Trying to delete NULL pointer in ~lvector\n";
42
        ad_exit(21);
43
      }
44
      v += indexmin();
45
      delete [] v;
46
      v = NULL;
47 47

  
48
       delete  shape;
49
       shape = NULL;
50
     }
51
   }
52
   else
53
   {
54
     cerr << "Trying to delete an unallocated lvector" << endl;
55
   }
48
      delete shape;
49
      shape = NULL;
50
    }
51
  }
52
  else
53
  {
54
    cerr << "Trying to delete an unallocated lvector" << endl;
55
  }
56 56
}
57 57
/**
58 58
Copy constructor
......
141 141
     v[i] = x[i];
142 142
   }
143 143
 }
144

  
145 144
/**
146 145
 * Description not yet available.
147 146
 * \param
148 147
 */
149
 void lvector::allocate(const lvector& lv)
150
 {
151
   allocate(lv.indexmin(),lv.indexmax());
152
 }
153

  
148
void lvector::allocate(const lvector& lv)
149
{
150
  allocate(lv.indexmin(),lv.indexmax());
151
}
154 152
/**
155
 * Description not yet available.
156
 * \param
157
 */
158
 void lvector::allocate(int ncl,int nch)
159
 {
160
   if ( (shape=new vector_shape(ncl,nch))==0 )
161
   {
162
     cerr << " Error trying to allocate memory for lvector\n";
163
   }
164
   v = new AD_LONG_INT [(size_t) (nch-ncl+1)];
165
   if (v ==0)
166
   {
167
     cerr << " Error trying to allocate memory for lvector\n";
168
     ad_exit(21);
169
   }
153
Allocate vector of AD_LONG_INT.
170 154

  
171
   v -= indexmin();
172
   #ifdef SAFE_ARRAYS
173
     for ( int i=indexmin(); i<=indexmax(); i++)
174
     {
175
       v[i]=0.;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff