56 #define ARRAYEXAMPLE_VERSION \ 57 "ARRAYEXAMPLE V1.1 Demonstrate array usage" 82 void section(
const char* s,
const char l=
'-')
84 cout << endl << s << endl;
86 while (*p) { cout << l; ++p; }
104 std::ostream& operator<<(std::ostream& os, const aff::ConstArray<T>& a)
111 cout <<
"Elements (i,j) of " << N <<
"x" << M <<
" array:" << endl;
114 const int firstwidth=6;
116 int columnwidth=(78-firstwidth)/M;
119 cout.width(firstwidth);
120 cout.setf(std::ios_base::left, std::ios_base::adjustfield);
122 for (
int j=a.first(1); j<=a.last(1); j++)
125 cout.width(columnwidth-2);
126 cout.setf(std::ios_base::left, std::ios_base::adjustfield);
133 for (
int i=a.first(0); i<=a.last(0); i++)
136 cout.width(firstwidth-2);
137 cout.setf(std::ios_base::left, std::ios_base::adjustfield);
140 for (
int j=a.first(1); j<=a.last(1); j++)
142 cout.width(columnwidth);
161 section(
"Array A after being created:");
166 section(
"Array A after all elements being set to 5.2:");
171 section(
"Demonstrate effect of shallow copy",
'=');
184 section(
"Array A after assignment to B and to A:");
189 section(
"Demonstrate effect of deep copy",
'=');
195 section(
"Array B after assignment to B:");
197 section(
"Array A after assignment to B:");
202 section(
"Demonstrate array usage with custom index range",
'=');
209 section(
"Array A after being assigned to array of different shape:");
Array< T > copyout() const
create an identical copy (deep copy) of this array
int main()
test array functionality
void section(const char *s, const char l='-')
external class to create subarrays (prototypes)
full template array class headers (prototypes)
debug helpers (prototypes)
Full multi-dimensional array functionality.This is the full array class template. It adds no addition...
Shaper class for Fortran layout.
rectangular Fortran array layout (prototypes)
#define ARRAYEXAMPLE_VERSION