TF++, Miscellaneous classes and modules in C++:
hack_blitztotable.h
Go to the documentation of this file.
1 
35 // include guard
36 #ifndef TF_HACK_BLITZTOTABLE_H_VERSION
37 
38 #define TF_HACK_BLITZTOTABLE_H_VERSION \
39  "TF_HACK_BLITZTOTABLE_H V1.0 "
40 
41 #include<fstream>
42 #include<cmath>
43 #include<blitz/array.h>
44 
45 namespace tfxx {
46 namespace hacks {
47 
54 template<class T>
55 void write_blitztable(const blitz::Array<T, 1>& array,
56  const char* filename,
57  const double& dx=1.)
58 {
59  std::ofstream os(filename);
60  for (int i=array.lbound(blitz::firstDim);
61  i<=array.ubound(blitz::secondDim); i++)
62  {
63  os << dx*(i-1) << " "
64  << array(i) << " "
65  << std::abs(array(i)) << std::endl;
66  }
67 }
68 
69 } // namespace hacks
70 } // namespace tfxx
71 
72 #endif // TF_HACK_BLITZTOTABLE_H_VERSION (includeguard)
73 
74 /* ----- END OF hack_blitztotable.h ----- */
void write_blitztable(const blitz::Array< T, 1 > &array, const char *filename, const double &dx=1.)
create grepg file from complex array
Namespace containing all code of library libtfxx.