116 cout <<
"fs1.offset(): " << fs1.offset() << endl;
121 CODE(subshape.shrink(0,2).shrink(1,3,5).shrink(3,10,20));
122 CODE(subshape.collapse(2,15));
129 cout <<
"fs2.offset(): " << fs2.offset() << endl;
134 section(
"Pass array to Fortran via subroutine arguments:",
'=');
151 section(
"Access to common block:",
'=');
156 CODE(
for(
int i=v1.f(0); i<=v1.l(0); i++) { v1(i)=2.*i; });
157 CODE(
for(
int i=v2.f(0); i<=v2.l(0); i++) { v2(i)=.5*i; });
175 section(
"Size-checked casts:",
'=');
177 CODE(
typedef std::complex<int> Ticvalue);
178 CODE(
typedef std::complex<float> Tcvalue);
183 CODE(v1(1)=Ticvalue(3,7));
184 CODE(cout << v1(1) <<
", " << v2(1) << endl);
185 CODE(Ticvalue *icp=fv1.castedpointer<Ticvalue>());
186 CODE(*icp=Ticvalue(35,60));
187 CODE(cout << v1(1) <<
", " << v2(1) << endl);
188 CODE(
const Ticvalue *cicp1=fv1.castedpointer<
const Ticvalue>());
189 CODE(
const Ticvalue *cicp2=fv2.castedpointer<
const Ticvalue>());
190 CODE(cout << *cicp1 <<
", " << *cicp2 << endl);
191 section(
"That's dangerous:",
' ');
192 CODE(Tcvalue *cp=fv1.castedpointer<Tcvalue>());
193 CODE(*cp=Ticvalue(35,60));
194 CODE(cout << v1(1) <<
", " << v2(1) << endl);
195 CODE(
double *dp=fv1.castedpointer<
double>());
197 CODE(cout << v1(1) <<
", " << v2(1) << endl);
199 section(
"Test illegal usage (only if activated through macro-definition):",
206 CODE(cout << iv1(1) <<
", " << iv2(1) << endl);
207 CODE(
int *iv1p=fiv1.pointer());
208 CODE(
const int *iv2p=fiv2.pointer());
209 CODE(cout << *iv1p <<
", " << *iv2p << endl);
211 #warning intentionally compiling illegal code: 212 #warning direct discard of const qualifier in conversion from non-const 213 CODE(
int *ip1=fiv1.castedpointer<
const int>());
216 #warning intentionally compiling illegal code: 217 #warning direct discard of const qualifier in conversion from const array 218 CODE(
int *ip2=fiv2.castedpointer<
const int>());
221 #warning intentionally compiling illegal code: 222 #warning discards const in conversion (reinterpret_cast) 223 CODE(
int *ip3=fiv2.castedpointer<
int>());
226 #warning intentionally compiling illegal code: 227 #warning direct type mismatch 228 CODE(
float *ip4=fiv1.castedpointer<
int>());
231 #warning intentionally compiling illegal code: 232 #warning wrong type size in conversion through reinterpret_cast 233 CODE(
double *ip5=fiv1.castedpointer<
double>());
Shape for a rectangular array layout.
aff::util::Slice< C > slice(const C &c)
Wrapper function to select correct type.
#define DUMP(A)
Dump any object through its dump function.
aff::util::Subarray< C > subarray(const C &c)
Wrapper function to select correct type.
int fillarray(const aff::Array< float > &v1, const aff::Array< float > &v2)
fill common block through Fortran subroutine
#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.
Full multi-dimensional array functionality.This is the full array class template. It adds no addition...
#define AFF_F77TEST_CC_VERSION
Tzarray viewcommon()
create view from common
Class to provide Fortran interface values.
find appropriate leading dimensions
Shaper class for Fortran layout.
void section(const char *s, const char l='-')
print headline
int fill(const aff::Array< int > &a)
interface function to Fortran77 subroutine fill
Array base classThis is a multidimensional (array) container that uses a strided memory layout (Fortr...
Tcarray sums()
read from common block through Fortran subroutine