118 section(
"Preparing test array");
122 section(
"Tests for class Iterator",
'=');
132 { cout << i <<
", " << *I << endl; i++; });
139 section(
"Tests for class Subarray",
'=');
141 section(
"First mode: Use a Subarray object just for initialization",
'.');
150 section(
"Tests of subarray function",
'-');
152 CODE( A.copyin(OrigA) );
153 section(
"First mode: Use a Subarray object just for initialization",
'.');
158 section(
"Second mode: Create a Subarray object to which you can assign",
167 section(
"Test for subarray of ConstArray",
'-');
178 section(
"Tests for class Slice",
'=');
180 CODE( A.copyin(OrigA) );
181 section(
"First mode: Use a Slice object just for initialization",
'.');
190 section(
"Test slice function",
'-');
192 CODE( A.copyin(OrigA) );
193 section(
"First mode: Use a Slice object just for initialization",
'.');
198 section(
"Second mode: Create a Slice object to which you can assign",
207 section(
"Test slice of ConstArray",
'-');
220 section(
"Iterator on a Subarray");
229 section(
"Iterator on a Slice");
238 section(
"Extract copy of subarray");
248 section(
"Test external access interfaces",
'=');
250 section(
"Test interface to raw memory array: aff::CArray");
254 for(
int i=A.f(0); i<=A.l(0); i++)
256 for(
int j=A.f(1); j<=A.l(1); j++)
258 for(
int k=A.f(2); k<=A.l(2); k++)
260 for(
int l=A.f(3); l<=A.l(3); l++)
262 A(i,j,k,l)=(i-A.f(0)+1)+(j-A.f(1)+1)*10
263 +(k-A.f(2)+1)*100+(l-A.f(3)+1)*1000;
273 CODE(
int* p=C.pointer(); )
275 for (
unsigned i=0; i<C.size(0); ++i)
277 for (
unsigned j=0; j<C.size(1); ++j)
279 p[i*C.stride(0)+j*C.stride(1)]=i+10*j;
289 section(
"Test interface to raw memory array: aff::CSeries");
292 CODE(
for (
int i=A.f(); i<=A.l(); ++i) { A(i)=i; })
295 CODE(
int* p=CS.pointer(); )
296 CODE(
for (
int i=0; i<CS.size(); ++i) { p[i]=i; })
304 section(
"Test converters",
'=');
306 section(
"Test conversion from Array to Series");
310 for(
int i=A.f(0); i<=A.l(0); i++)
312 for(
int j=A.f(1); j<=A.l(1); j++)
314 for(
int k=A.f(2); k<=A.l(2); k++)
316 for(
int l=A.f(3); l<=A.l(3); l++)
318 A(i,j,k,l)=(i-A.f(0)+1)+(j-A.f(1)+1)*10
319 +(k-A.f(2)+1)*100+(l-A.f(3)+1)*1000;
Array< T > copyout() const
create an identical copy (deep copy) of this array
Interface class to raw memory (C style array)
aff::util::Slice< C > slice(const C &c)
Wrapper function to select correct type.
#define AFF_HELPERTEST_CC_VERSION
void dump(const Strided &shape, std::ostream &os)
dump shape
void printarray(const ConstArray< T > &array)
test for passing subarrays and slices
access Series contents through raw memory
aff::util::Subarray< C > subarray(const C &c)
Wrapper function to select correct type.
aff::Series< T > series_from_raw_memory(T *pointer, const unsigned int size)
create a series class from raw memory.
#define CODE(C)
Dump code and execute (works like echo)
void dump_array(const ConstArray< T > &array, const Tdim &i=(Strided::Mmax_dimen-1), std::ostream &os=std::cout)
Dump array values.
aff::Series< T > series_from_array(const aff::Array< T > &array)
create a series container from an array container.
Full multi-dimensional array functionality.This is the full array class template. It adds no addition...
A base class for time series and spectra.
void section(const char *s, const char l='-')
print headline
Shaper class for Fortran layout.
Array base classThis is a multidimensional (array) container that uses a strided memory layout (Fortr...