TF++, Miscellaneous classes and modules in C++:

◆ write_grepg_c()

void tfxx::hacks::write_grepg_c ( const blitz::Array< std::complex< float >, 2 > &  array,
const char *  filename,
const double &  dx = 1.,
const double &  dy = 1. 
)

create grepg file from complex array

Parameters
array2D complex float blitz array
filenamename of file to write to
dxx-sampling to simulate
dyy-sampling to simulate

Definition at line 48 of file hack_blitztogrepg.cc.

References tfxx::fortranio::FortranBinOutput::end_block(), and tfxx::ioswap::file_magic_write().

Referenced by write_grepg(), and write_grepg_f().

51 {
52  std::ofstream os(filename);
53  tfxx::ioswap::file_magic_write(os, "1234", true);
55  int nom=array.extent(blitz::firstDim);
56  int fom=array.lbound(blitz::firstDim);
57  int nslo=array.extent(blitz::secondDim);
58  int fslo=array.lbound(blitz::secondDim);
59  fos << nom << nslo;
60  fos.end_block();
61  for (int i=0; i<nom; i++)
62  { fos << float(3.14159265358979311*2.*(i+fom-1)*dx); }
63  for (int i=0; i<nslo; i++) { fos << float(1.e-3*(i+fslo-1)*dy); }
64  fos.end_block();
65  for (int i=0; i<nslo; i++)
66  {
67  for (int j=0; j<nom; j++)
68  {
69  fos << array(j+fom,i+fslo);
70  }
71  }
72  fos.end_block();
73 }
write FORTRAN binary data ,This class writes FORTRAN binary data. FORTRAN binary data is always writt...
Definition: fortranio.h:200
void file_magic_write(std::ostream &os, const char *const cmagic, const bool &fortranmode=false)
Write magic number to file. ,.
Definition: ioswap.cc:135
Here is the call graph for this function:
Here is the caller graph for this function: