Fortran SFF API to data I/O streams in C++
fapid_sff_wtracei.cc
Go to the documentation of this file.
1 
34 #define TF_FAPID_SFF_WTRACEI_CC_VERSION \
35  "TF_FAPID_SFF_WTRACEI_CC V1.0 "
36 
37 #include <fapidxx/fapidsff.h>
38 #include <fapidxx/fileunit.h>
39 #include <fapidxx/helper.h>
40 #include <fapidxx/wid2container.h>
41 #include <fapidxx/error.h>
42 
43 using namespace fapidxx;
44 
81 int sff_wtracei__(integer *lu, char *wid2line, integer *nsamp, real *fdata,
82  integer *idata, logical *last, char *cs, real *c1, real *c2,
83  real *c3, integer *nstack, integer *ierr, ftnlen
84  wid2line_len, ftnlen cs_len)
85 {
86  int retval=0;
87  *ierr=0;
88  try {
89  datrw::oanystream &os=ostreammanager(static_cast<int>(*lu));
90  WID2container wid2c(wid2line, wid2line_len);
91  unsigned int nsamples=static_cast<unsigned int>(*nsamp);
92  os << wid2c.wid2;
93  if (os.handlesinfo())
94  {
95  sff::INFO info;
96  info.cs=sff::coosysID(*cs);
97  info.cx=static_cast<double>(*c1);
98  info.cy=static_cast<double>(*c2);
99  info.cz=static_cast<double>(*c3);
100  info.nstacks=static_cast<int>(*nstack);
101  os << info;
102  }
103  aff::LinearShape shape(0, nsamples-1, 0);
104  datrw::Tfseries series(shape, aff::SharedHeap<real>(fdata, *nsamp));
105  os << series;
106  if (*last) ostreammanager.close(static_cast<int>(*lu));
107  }
108  catch (...) {
109  *ierr=1;
110  }
111  return(retval);
112 } // int sff_wtracei__
113 
114 /* ----- END OF fapid_sff_wtracei.cc ----- */
This is the interface usually expected by Fortran programs linking to libsff.a (prototypes) ...
Definition: error.cc:44
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)
int sff_wtracei__(integer *lu, char *wid2line, integer *nsamp, real *fdata, integer *idata, logical *last, char *cs, real *c1, real *c2, real *c3, integer *nstack, integer *ierr, ftnlen wid2line_len, ftnlen cs_len)
Write one trace of data with INFO line.
void close(const int &unit)
close the file associated with this file unit
Definition: fileunit.cc:162
some helper functions (prototypes)