Revision 752 branches/threaded2/src/linad99/fvar_arr.cpp

fvar_arr.cpp (revision 752)
15 15
#endif
16 16

  
17 17
#include <stdlib.h>
18
#include <cassert>
18 19

  
19 20
//extern double * NULL_ADDRESS;
20 21
//extern grad_stack  * GRAD_STACK1; //js
......
41 42
 * Description not yet available.
42 43
 * \param
43 44
 */
44
 dvar_vector::dvar_vector(const independent_variables& t)
45
 {
46
   int i;
47
   allocate(t.indexmin(),t.indexmax());
45
dvar_vector::dvar_vector(const independent_variables& t)
46
{
47
  allocate(t.indexmin(), t.indexmax());
48
  for (int i = indexmin(); i <= indexmax(); i++)
49
  {
50
    va[i].x=(t.v)[i];
51
  }
52
  make_indvar_list(*this);
53
}
48 54

  
49
   for ( i=indexmin(); i<=indexmax(); i++)
50
   {
51
     va[i].x=(t.v)[i];
52
   }
53

  
54
   make_indvar_list(*this);
55
 }
56

  
57 55
/**
58 56
 * Description not yet available.
59 57
 * \param
......
204 202
 * Description not yet available.
205 203
 * \param
206 204
 */
207
   void dvar_vector::allocate(void)
208
   {
209
     shape=NULL;
210
     va=NULL;
211
   }
205
void dvar_vector::allocate(void)
206
{
207
  shape = nullptr;
208
  va = nullptr;
209
}
212 210
 
213 211
/**
214 212
 * Description not yet available.
......
260 258
 * Description not yet available.
261 259
 * \param
262 260
 */
263
   void dvar_vector::allocate(int ncl,int nch)
264
   {
265
     if (ncl>nch)
266
       allocate();
267
     else
268
     {  
269
       index_min=ncl;
270
       index_max=nch;
271
       int itemp=nch-ncl+1;
272
       if (itemp<=0)
273
       {
274
         cerr << "Error in dvar_vector constructor max index must be"
275
                 " >= minindex\n"
276
            << "minindex = " << ncl << " maxindex = " << nch <<endl;
277
         ad_exit(1);
278
       }
279
       if ( (va = arr_new(itemp)) ==0)
280
       {
281
         cerr << " Error trying to allocate memory for dvar_vector\n";
282
         ad_exit(1);
283
       }
284
  
285
       if ( (shape=new vector_shapex(ncl,nch,va)) == NULL)
286
       {
287
         cerr << "Error trying to allocate memory for dvar_vector\n";
288
         ad_exit(1);
289
       }
290
  
291
       link_ptr=* (arr_link **) va;
292
       va -= indexmin();
293
       // if ( ((int)va) %8) cerr << "Array is not QWORD alligned" << endl;
261
void dvar_vector::allocate(int ncl, int nch)
262
{
263
  if (ncl > nch)
264
    allocate();
265
  else
266
  {  
267
    index_min = ncl;
268
    index_max = nch;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff