1 | // We create a integer array SizeX=7, SizeY=5
|
---|
2 | TArray<int_4> ia(7,5);
|
---|
3 | // We fill it with a sequence of numbers starting at 10., with step = 2.
|
---|
4 | ia = RegularSequence(10., 2.);
|
---|
5 | cout << " ----- Array IA = \n " << ia << endl;
|
---|
6 | TArray<int_4> ib = ia(Range(0,3), Range(3,4), Range(0));
|
---|
7 | cout << " ----- Array IB IA(Range(0,3), Range(3,2)) = \n" << ib << endl;
|
---|
8 | // sub array extraction, Range(2,4) : starting position=2 , End=4
|
---|
9 | TArray<int_4> ic = ia(Range(2,3),Range(1,3),Range(0));
|
---|
10 | cout << " ----- Array IC IA(Range(2,3),Range(1,3)) = \n " << ic << endl;
|
---|
11 | // we set the sub-array to zero, this should reflect in the original array
|
---|
12 | // sub-arrays share their data with parent array
|
---|
13 | ic = 0;
|
---|
14 | cout << " ----- Array IC Apres (=0) = \n " << ic << endl;
|
---|
15 | cout << " ----- Array IB Apres IC=0 = \n " << ib << endl;
|
---|
16 | cout << " ----- Array IA Apres IC=0 = \n " << ia << endl;
|
---|
17 | cout << " >>>>>> Writing in arrt.ppf <<<<<<< " << endl;
|
---|
18 | POutPersist pos("arrt.ppf");
|
---|
19 | // We write the three arrays in the stream
|
---|
20 | pos << ia << ib << ic;
|
---|
21 |
|
---|