34 #define BLITZTEST_VERSION \ 35 "BLITZTEST V1.0 test all blitz support modules" 38 #include <blitz/array.h> 39 #include <tfxx/error.h> 40 #include <tfxx/commandline.h> 41 #include <tfxx/blitzutil.h> 42 #include <tfxx/blitzfortranio.h> 57 int main(
int iargc,
char* argv[])
64 "usage: blitztest [-v] [-if file] [-of file]" "\n" 65 " or: blitztest --help|-h" "\n" 72 "-of file write output to \"file\"" "\n" 73 "-if file read input from \"file\"" "\n" 95 cerr << usage_text << endl;
105 cerr << usage_text << endl;
106 cerr << help_text << endl;
110 bool verbose=cmdline.
optset(1);
117 <<
"Creating arrays:" << endl;
120 blitz::Array<float, 2>
A(blitz::Range(3,6),blitz::Range(1,3),
121 blitz::fortranArray);
122 blitz::Array<float, 2> B(blitz::Range(3,6),blitz::Range(1,3));
126 blitz::secondIndex j;
131 cout << endl <<
"Fortran array: " << endl
132 <<
"==============" << endl <<
A << endl;
133 A.dumpStructureInformation();
135 cout << endl <<
"C array: " << endl
136 <<
"========" << endl << B << endl;
137 B.dumpStructureInformation();
139 if (verbose) cout << endl <<
"writing to " << outfile <<
"..." << endl;
141 std::ofstream os(outfile.c_str());
146 blitz::Array<float, 2> C,D,E(blitz::fortranArray),F(blitz::fortranArray);
148 if (verbose) cout << endl <<
"reading from " << infile
149 <<
" into C arrays..." << endl;
152 std::ifstream is(infile.c_str());
162 if (verbose) cout << endl <<
"reading from " << infile
163 <<
" into Fortran arrays..." << endl;
165 std::ifstream is(infile.c_str());
170 cout << endl <<
"C array from Fortran array:" << endl
171 <<
"===========================" << endl << C << endl;
172 C.dumpStructureInformation();
174 cout << endl <<
"C array from C array:" << endl
175 <<
"=====================" << endl << D << endl;
176 D.dumpStructureInformation();
178 cout << endl <<
"Fortran array from Fortran array:" << endl
179 <<
"=================================" << endl << E << endl;
180 E.dumpStructureInformation();
182 cout << endl <<
"Fortran array from C array:" << endl
183 <<
"===========================" << endl << F << endl;
184 F.dumpStructureInformation();
188 cout << endl <<
"Test shape copy function" << endl
189 <<
"========================" << endl;
191 blitz::Array<int,3> G(blitz::Range(3,4),
194 blitz::fortranArray);
197 blitz::secondIndex j;
202 cout << endl <<
"Fortran array for type int:" << endl
203 <<
"---------------------------" << endl << G << endl;
204 G.dumpStructureInformation();
206 blitz::Array<std::complex<double>,3> H;
209 cout << endl <<
"Array of same domain and type complex<double>:" << endl
210 <<
"----------------------------------------------" 211 << endl << H << endl;
212 H.dumpStructureInformation();
215 "setToSameDomain failed!");
write FORTRAN binary data ,This class writes FORTRAN binary data. FORTRAN binary data is always writt...
#define TFXX_assert(C, M)
Check an assertion and report by throwing an exception.
bool sameDomain(const blitz::Array< T1, N1 > &a1, const blitz::Array< T2, N2 > &a2)
test for conforming domains
option requires an argument
bool optset(const int &iopt) const
true if option # iopt was set on commandline
#define BLITZTEST_VERSION
Namespace containing all components of module commandline. ,.
void setToSameDomain(blitz::Array< T, N > &array, const blitz::RectDomain< N > &domain, const blitz::GeneralArrayStorage< N > &storage=blitz::fortranArray)
create a second array spanning the same domain
Evaluates commandline by calling long_getopt. ,You may instantiate a Commandline object by passing th...
int main(int iargc, char *argv[])
test blitz binary I/O operators
struct to define options ,This struct is used to define a list of options. An example is: ...
Base class for exceptions.
std::string string_arg(const int &iopt) const
return argument of option # iopt as string value
#define TFXX_abort(M)
Abort and give a message.