FixVec.cc 733 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
#include <stdarg.h>
#include "FixVec.h"

namespace AMDiS {

  VectorOfFixVecs<DimVec<double> > *createAndInit(int dim, int size, ...)
  {
    va_list arg;
    va_start(arg, size);
    VectorOfFixVecs<DimVec<double> > *result = 
Thomas Witkowski's avatar
Thomas Witkowski committed
11
      new VectorOfFixVecs<DimVec<double> >(dim, size, NO_INIT);
12
13
    for (int i = 0; i < size; i++) {
      for (int j = 0; j < dim + 1; j++) {
14
15
16
17
18
19
20
21
22
23
24
25
26
	(*result)[i][j] = va_arg(arg, double);
      }
    }
    va_end(arg);
    return result;
  };

  double* createAndInitArray(int size, ...)
  {
    va_list arg;
    va_start(arg, size);
    double *result = GET_MEMORY(double, size);
  
27
    for (int i = 0; i < size; i++) {
28
29
30
31
32
33
34
35
      result[i] = va_arg(arg, double);
    }

    va_end(arg);
    return result;
  }

}