Fortran SFF API to data I/O streams in C++
fapid_sff_wtracefi.cc
Go to the documentation of this file.
1 
35 #define TF_FAPID_SFF_WTRACEFI_CC_VERSION \
36  "TF_FAPID_SFF_WTRACEFI_CC V1.0 "
37 
38 #include <fapidxx/fapidsff.h>
39 #include <fapidxx/fileunit.h>
40 #include <fapidxx/helper.h>
41 #include <fapidxx/wid2container.h>
42 #include <fapidxx/error.h>
43 
44 using namespace fapidxx;
45 
90 int sff_wtracefi__(integer *lu, char *wid2line, integer *nsamp, real *fdata,
91  integer *idata, logical *last, integer *nline, char *lines,
92  char *cs, real *c1, real *c2, real *c3, integer *nstack,
93  integer *ierr, ftnlen wid2line_len,
94  ftnlen lines_len, ftnlen cs_len)
95 {
96  int retval=0;
97  *ierr=0;
98  try {
99  datrw::oanystream &os=ostreammanager(static_cast<int>(*lu));
100  WID2container wid2c(wid2line, wid2line_len);
101  unsigned int nsamples=static_cast<unsigned int>(*nsamp);
102  os << wid2c.wid2;
103  if (os.handlesinfo())
104  {
105  sff::INFO info;
106  info.cs=sff::coosysID(*cs);
107  info.cx=static_cast<double>(*c1);
108  info.cy=static_cast<double>(*c2);
109  info.cz=static_cast<double>(*c3);
110  info.nstacks=static_cast<int>(*nstack);
111  os << info;
112  }
113  if (os.handlestracefree())
114  {
115  sff::FREE tracefree=freeblock(nline, lines, lines_len);
116  os << tracefree;
117  }
118  aff::LinearShape shape(0, nsamples-1, 0);
119  datrw::Tfseries series(shape, aff::SharedHeap<real>(fdata, *nsamp));
120  os << series;
121  if (*last) ostreammanager.close(static_cast<int>(*lu));
122  }
123  catch (...) {
124  *ierr=1;
125  }
126  return(retval);
127 } // int sff_wtracefi__
128 
129 /* ----- END OF fapid_sff_wtracefi.cc ----- */
This is the interface usually expected by Fortran programs linking to libsff.a (prototypes) ...
Definition: error.cc:44
sff::FREE freeblock(integer *nline, char *lines, ftnlen lines_len)
create C++ FREE block from Fortran FREE lines
Definition: helper.cc:150
long int integer
Fortran integer type.
Definition: fapidsff.h:66
sff::WID2 wid2
WID2 data.
This struct is used to pass WID2 line data within libfapidxx.
Definition: wid2container.h:62
container for WID2 data (prototypes)
exceptions and error handling macros (prototypes)
float real
Fortran real type (single precision)
Definition: fapidsff.h:73
long int logical
Fortran logical type.
Definition: fapidsff.h:68
::fapidxx::OFileUnits ostreammanager
the global ostream manager
Definition: fileunit.cc:51
long int ftnlen
Fortran string size type.
Definition: fapidsff.h:70
a file unit interface to libdatrwxx (prototypes)
void close(const int &unit)
close the file associated with this file unit
Definition: fileunit.cc:162
int sff_wtracefi__(integer *lu, char *wid2line, integer *nsamp, real *fdata, integer *idata, logical *last, integer *nline, char *lines, char *cs, real *c1, real *c2, real *c3, integer *nstack, integer *ierr, ftnlen wid2line_len, ftnlen lines_len, ftnlen cs_len)
Write one trace of data with FREE block and INFO line.
some helper functions (prototypes)