36 #ifndef TF_BLITZFORTRANIO_H_VERSION 38 #define TF_BLITZFORTRANIO_H_VERSION \ 39 "TF_BLITZFORTRANIO_H V1.0 " 42 #include<blitz/array.h> 43 #include<tfxx/fortranio.h> 45 #include<tfxx/error.h> 61 template<
class T,
int N>
67 #ifndef DOXYGEN_MUST_SKIP_THIS 68 template<>
struct blitz_magic<float, 2> {
static const char magic[]=
"ZZf2"; };
69 template<>
struct blitz_magic<float, 3> {
static const char magic[]=
"ZZf3"; };
70 template<>
struct blitz_magic<float, 4> {
static const char magic[]=
"ZZf4"; };
71 template<>
struct blitz_magic<float, 5> {
static const char magic[]=
"ZZf5"; };
72 template<>
struct blitz_magic<double, 1> {
static const char magic[]=
"ZZd1"; };
73 template<>
struct blitz_magic<double, 2> {
static const char magic[]=
"ZZd2"; };
74 template<>
struct blitz_magic<double, 3> {
static const char magic[]=
"ZZd3"; };
75 template<>
struct blitz_magic<double, 4> {
static const char magic[]=
"ZZd4"; };
76 template<>
struct blitz_magic<double, 5> {
static const char magic[]=
"ZZd5"; };
77 template<>
struct blitz_magic<int, 1> {
static const char magic[]=
"ZZi1"; };
78 template<>
struct blitz_magic<int, 2> {
static const char magic[]=
"ZZi2"; };
79 template<>
struct blitz_magic<int, 3> {
static const char magic[]=
"ZZi3"; };
80 template<>
struct blitz_magic<int, 4> {
static const char magic[]=
"ZZi4"; };
81 template<>
struct blitz_magic<int, 5> {
static const char magic[]=
"ZZi5"; };
82 #ifdef TF_COMPLEX_ARRAY 84 template<>
struct blitz_magic<
std::complex<float>, 1>
85 {
static const char magic[]=
"ZZc1"; };
86 template<>
struct blitz_magic<
std::complex<float>, 2>
87 {
static const char magic[]=
"ZZc2"; };
88 template<>
struct blitz_magic<
std::complex<float>, 3>
89 {
static const char magic[]=
"ZZc3"; };
90 template<>
struct blitz_magic<
std::complex<float>, 4>
91 {
static const char magic[]=
"ZZc4"; };
92 template<>
struct blitz_magic<
std::complex<float>, 5>
93 {
static const char magic[]=
"ZZc5"; };
94 template<>
struct blitz_magic<
std::complex<double>, 1>
95 {
static const char magic[]=
"ZZz1"; };
96 template<>
struct blitz_magic<
std::complex<double>, 2>
97 {
static const char magic[]=
"ZZz2"; };
98 template<>
struct blitz_magic<
std::complex<double>, 3>
99 {
static const char magic[]=
"ZZz3"; };
100 template<>
struct blitz_magic<
std::complex<double>, 4>
101 {
static const char magic[]=
"ZZz4"; };
102 template<>
struct blitz_magic<
std::complex<double>, 5>
103 {
static const char magic[]=
"ZZz5"; };
118 template<
class T,
int N>
121 const blitz::Array<T, N>& a)
126 for (
int i=0; i<N; i++) fo.
put(a.lbound(i));
128 for (
int i=0; i<N; i++) fo.
put(a.extent(i));
130 for (blitz::Array<T, N>::const_iterator i=a.begin(); i!=a.end(); ++i)
147 template<
class T,
int N>
150 blitz::Array<T, N>& a)
153 "ERROR (blitz array operator>>): input has no matching magic number!");
156 TFXX_assert((N==n),
"ERROR (blitz array operator>>): illegal rank!");
157 blitz::TinyVector<int, N> lbound, extent;
158 for (
int i=0; i<N; i++) fi.
get(lbound[i]);
159 for (
int i=0; i<N; i++) fi.
get(extent[i]);
160 blitz::Array<T, N> result(lbound, extent, blitz::fortranArray);
161 for (blitz::Array<T, N>::iterator i=result.begin(); i!=result.end(); ++i)
171 #endif // TF_BLITZFORTRANIO_H_VERSION (includeguard) 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.
magic numbers for blitz array I/OPlease define TF_COMPLEX_ARRAY to activate I/O for arrays of complex...
int magic(const char *const cmagic)
Create a magic number from a character string. ,If represents the input character sequence cmagic an...
void end_block()
finish data block
tfxx::fortranio::FortranBinOutput & operator<<(tfxx::fortranio::FortranBinOutput &fo, const blitz::Array< T, N > &a)
Output operator template for class FortranBinOutput and blitz.
tfxx::fortranio::FortranBinInput & operator>>(tfxx::fortranio::FortranBinInput &fi, blitz::Array< T, N > &a)
Input operator template for class FortranBinInput and blitz.
void write_magic(const char *cmagic)
write magic number (to separate block)
void put(const T &value)
put a value to the output
Namespace containing all code of library libtfxx.