10 #include <io/AiresWrapper.h>
12 #include <utl/ErrorLogger.h>
22 namespace AiresF77Mapping {
30 void ciorinit_(
int *inilevel,
int *codsys,
int *vrb,
int *irc);
35 int *vrb,
int *datype,
int *irc);
36 void crofileinfo_(
int *channel,
int *ouflag,
int *vrb,
int *irc);
38 bool crogotorec_(
int *channel,
int *recnumber,
int *vrb,
int *irc);
52 bool crorecfind_(
int *channel,
int *intype,
int *vrb,
53 int *infield1,
int *rectype);
54 void crorecninfo_(
int *channel,
int *poskey,
int *ouflag,
57 void crorewind_(
int *channel,
int *vrb,
int *irc);
59 void crotaskidc(
char *taskname,
int *namelen,
int *taskversion,
61 void fitghf_(
int *bodata0,
int *eodata0,
65 int *ws,
double *minnmax,
double *nminratio,
66 int *bodataeff,
int *eodataeff,
double *nmax,
67 double *xmax,
double *x0,
double *lambda,
68 double *sqsum,
int *irc);
85 double *groundz,
double *injz,
86 double *zenith,
double *azimuth,
94 void olcrossed_(
int *olkey,
int *updown,
int *firstol,
int *lastol);
95 void olcrossedu_(
int *olkey,
double *ux,
double *uy,
double *uz,
96 int *firstol,
int *lastol);
100 double *Xv0,
int *zendis,
101 double *zen1,
double *zen2,
double *groundz,
106 int *logbase,
int *vrb,
int *channel,
int *irc);
111 bool *altrec,
int *vrb,
int *irc);
112 void sp1stint_(
int *csys,
double *x1,
double *y1,
double *z1,
int *irc);
113 void spaddnull_(
double *pener,
double *pwt,
int *irc);
114 void spaddp0_(
int *pcode,
double *pener,
int *csys,
115 double *ux,
double *uy,
double *uz,
double *pwt,
int *irc);
124 void speigetmodnamec(
char *mn,
int *mnlen,
char *mnfull,
int *mnfullen);
126 void speimv_(
int *mvnew,
int *mvold);
127 void spinjpoint_(
int *csys,
double *x0,
double *y0,
double *z0,
128 int *tsw,
double *t0beta,
int *irc);
129 void speistart_(
int *showerno,
double *primener,
132 double *zground,
double *xvground,
double *dgroundinj,
134 void speitaskc(
char *taskn,
int *tasklen,
int *tver);
135 void spnshowers_(
int *totsh,
int *firstsh,
int *lastsh);
139 double xslant_(
double *Xvert,
double *Xv0,
140 double *cozenith,
double *zground);
149 bool AiresWrapper::fInitialised =
false;
150 unsigned int AiresWrapper::fNumberOfOpenFiles = 0;
156 void AiresWrapper::ciorinit(
int *inilevel,
int *codsys,
int *vrb,
int *irc) {
158 assert(inilevel != 0 && codsys != 0 && vrb != 0 && irc != 0);
160 if (!AiresWrapper::fInitialised) {
164 AiresWrapper::fInitialised =
true;
170 void AiresWrapper::ciorshutdown() {
172 if (AiresWrapper::fNumberOfOpenFiles == 0)
177 void AiresWrapper::cioclose() {
181 AiresWrapper::fNumberOfOpenFiles = 0;
185 void AiresWrapper::cioclose1(
int *channel) {
187 assert(channel != 0);
191 if (AiresWrapper::fNumberOfOpenFiles > 0)
192 AiresWrapper::fNumberOfOpenFiles--;
196 int AiresWrapper::crofieldindex(
int *channel,
int *rectype,
const char* fieldname,
197 int *vrb,
int *datype,
int *irc) {
199 assert(channel != 0 && rectype != 0 && fieldname != 0 &&
200 vrb != 0 && datype != 0 && irc != 0);
207 void AiresWrapper::crofileinfo(
int *channel,
int *ouflag,
int *vrb,
int *irc) {
209 assert(channel != 0 && ouflag != 0 && vrb != 0 && irc != 0);
215 int AiresWrapper::crofileversion(
int *channel) {
217 assert(channel != 0);
223 bool AiresWrapper::crogotorec(
int *channel,
int *recnumber,
224 int *vrb,
int *irc) {
226 assert(channel != 0 && recnumber != 0 && vrb != 0 && irc != 0);
232 void AiresWrapper::croheader1info(
int *ouflag) {
240 void AiresWrapper::croheaderinfo(
int *ouflag,
int *vrb,
int *irc) {
242 assert(ouflag != 0 && vrb != 0 && irc != 0);
248 void AiresWrapper::croinputdata0(
int *intdata,
double *realdata,
249 int *shprimcode,
double *shprimwt) {
251 assert(intdata != 0 && realdata != 0 &&
252 shprimcode != 0 && shprimwt != 0);
258 void AiresWrapper::crooldata(
int *vrb,
int *nobslev,
double *olzv,
259 double *oldepth,
int *irc) {
261 assert(vrb != 0 && nobslev != 0 && olzv != 0 &&
262 oldepth != 0 && irc != 0);
268 void AiresWrapper::croreccount(
int *channel,
int *vrb,
int *nrtype,
269 int *nrec,
int *irc) {
271 assert(channel != 0 && vrb != 0 && nrtype != 0 &&
272 nrec != 0 && irc != 0);
278 bool AiresWrapper::crorecfind(
int *channel,
int *intype,
int *vrb,
279 int *infield1,
int *rectype) {
281 assert(channel != 0 && intype != 0 && vrb != 0 &&
282 infield1 != 0 && rectype != 0);
288 void AiresWrapper::crorecninfo(
int *channel,
int *poskey,
int *ouflag,
289 int *vrb,
int *irc) {
291 assert(channel != 0 && poskey != 0 && ouflag != 0 &&
292 vrb != 0 && irc != 0);
298 int AiresWrapper::crorecnumber(
int *channel,
int *vrb,
int *irc) {
300 assert(channel != 0 && vrb != 0 && irc != 0);
306 void AiresWrapper::crorewind(
int *channel,
int *vrb,
int *irc) {
308 assert(channel != 0 && vrb != 0 && irc != 0);
314 bool AiresWrapper::crospcode(
int *pcode,
int *splabel) {
316 assert(pcode != 0 && splabel != 0);
323 char startdate[20]) {
325 assert(taskname != 0 && namelen != 0 && taskversion != 0 &&
332 void AiresWrapper::fitghf(
int *bodata0,
int *eodata0,
double *depths,
333 double *nallch,
double *weights,
int *ws,
334 double *minnmax,
double *nminratio,
335 int *bodataeff,
int *eodataeff,
double *nmax,
336 double *xmax,
double *x0,
double *lambda,
337 double *sqsum,
int *irc) {
339 assert(bodata0 != 0 && eodata0 != 0 && depths != 0 &&
340 nallch != 0 && weights != 0 && ws != 0 &&
341 minnmax != 0 && nminratio != 0 && bodataeff != 0 &&
342 eodataeff != 0 && nmax != 0 && xmax != 0 &&
343 x0 != 0 && lambda != 0 && sqsum != 0 && irc != 0);
346 ws, minnmax, nminratio, bodataeff, eodataeff,
347 nmax, xmax, x0, lambda, sqsum, irc);
351 bool AiresWrapper::getcrorecord(
int *channel,
int *intfields,
352 double *realfields,
bool *altrec,
353 int *vrb,
int *irc) {
355 assert(channel != 0 && intfields != 0 &&
356 realfields != 0 && altrec != 0 && vrb != 0 && irc != 0);
363 bool AiresWrapper::getcrorectype(
int *channel,
int *vrb,
int *infield1,
366 assert(channel != 0 && vrb != 0 && infield1 != 0 &&
375 assert(dirname != 0);
383 assert(dirname != 0);
391 assert(dirname != 0 && value != 0 && slen != 0);
399 assert(dirname != 0);
405 double AiresWrapper::grandom() {
411 int AiresWrapper::nuclcode(
int *z,
int *n,
int *irc) {
413 assert(z != 0 && n != 0 && irc != 0);
419 void AiresWrapper::nucldecode(
int *ncode,
int *z,
int *n,
int *
a) {
421 assert(ncode != 0 && z != 0 && n != 0 && a != 0);
427 void AiresWrapper::olcoord(
int *nobslev,
double *olzv,
double *groundz,
428 double *injz,
double *zenith,
double *azimuth,
429 double *xaxis,
double *yaxis,
double *zaxis,
430 double *tshift,
double *mx,
double *my,
int *irc) {
432 assert(nobslev != 0 && olzv != 0 && groundz != 0 &&
433 injz != 0 && zenith != 0 && azimuth != 0 &&
434 xaxis != 0 && yaxis != 0 && zaxis != 0 &&
435 tshift != 0 && mx != 0 && my != 0 && irc != 0);
438 xaxis, yaxis, zaxis, tshift, mx, my, irc);
442 void AiresWrapper::olcrossed(
int *olkey,
int *updown,
443 int *firstol,
int *lastol) {
445 assert(olkey != 0 && updown != 0 && firstol != 0 && lastol != 0);
451 void AiresWrapper::olcrossedu(
int *olkey,
double *ux,
double *uy,
double *uz,
452 int *firstol,
int *lastol) {
454 assert(olkey != 0 && ux != 0 && uy != 0 &&
455 uz != 0 && firstol != 0 && lastol != 0);
461 bool AiresWrapper::olsavemarked(
int *obslev,
int *vrb,
int *irc) {
463 assert(obslev != 0 && vrb != 0 && irc != 0);
469 void AiresWrapper::olv2slant(
int *nobslev,
double *olxv,
double *Xv0,
470 int *zendis,
double *zen1,
double *zen2,
471 double *groundz,
double *olxs) {
473 assert(nobslev != 0 && olxv != 0 && Xv0 != 0 && zendis != 0 &&
474 zen1 != 0 && zen2 != 0 && groundz != 0 && olxs != 0);
482 int *header1,
int *logbase,
int *vrb,
483 int *channel,
int *irc) {
485 assert(wdir != 0 && filename != 0 && header1 != 0 &&
486 logbase != 0 && vrb != 0 && channel != 0 && irc != 0);
495 info <<
"Error in opening AIRES file. Return code " << *irc;
501 AiresWrapper::fNumberOfOpenFiles++;
505 void AiresWrapper::raninit(
double *seed) {
513 bool AiresWrapper::regetcrorecord(
int *channel,
int *intfields,
514 double *realfields,
bool *altrec,
515 int *vrb,
int *irc) {
517 assert(channel != 0 && intfields != 0 && realfields != 0 &&
518 altrec != 0 && vrb != 0 && irc != 0);
525 void AiresWrapper::sp1stint(
int *csys,
double *x1,
double *y1,
double *z1,
528 assert(csys != 0 && x1 != 0 && y1 != 0 && z1 != 0 &&
535 void AiresWrapper::spaddnull(
double *pener,
double *pwt,
int *irc) {
537 assert(pener != 0 && pwt != 0 && irc != 0);
543 void AiresWrapper::spaddp0(
int *pcode,
double *pener,
int *csys,
544 double *ux,
double *uy,
double *uz,
double *pwt,
547 assert(pcode != 0 && pener != 0 && csys != 0 &&
548 ux != 0 && uy != 0 && uz != 0 && pwt != 0 &&
555 void AiresWrapper::spaddpn(
int *n,
int *pcode,
double *pener,
int *csys,
556 int *ldu,
double **uxyz,
double *pwt,
int *irc) {
558 assert(n != 0 && pcode != 0 && pener != 0 && csys != 0 &&
559 ldu != 0 && uxyz != 0 && pwt != 0 && irc != 0);
565 void AiresWrapper::speiend(
int *retcode) {
567 assert(retcode != 0);
576 assert(mn != 0 && mnlen != 0 && mnfull != 0 && mnfullen != 0);
584 assert(parstring != 0 && pstrlen != 0);
590 void AiresWrapper::speimv(
int *mvnew,
int *mvold) {
592 assert(mvnew != 0 && mvold != 0);
598 void AiresWrapper::spinjpoint(
int *csys,
double *x0,
double *y0,
double *z0,
599 int *tsw,
double *t0beta,
int *irc) {
601 assert(csys != 0 && x0 != 0 && y0 != 0 && z0 != 0 &&
602 tsw != 0 && t0beta != 0 && irc != 0);
608 void AiresWrapper::speistart(
int *showerno,
double *primener,
609 double *injpos,
double *xvinj,
610 double *zground,
double *xvground,
611 double *dgroundinj,
double *uprim) {
613 assert(showerno != 0 && primener != 0 && injpos != 0 &&
614 xvinj != 0 && zground != 0 && xvground != 0 &&
615 dgroundinj != 0 && uprim != 0);
618 xvground, dgroundinj, uprim);
624 assert(taskn != 0 && tasklen != 0 && tver != 0);
630 void AiresWrapper::spnshowers(
int *totsh,
int *firstsh,
int *lastsh) {
632 assert(totsh != 0 && firstsh != 0 && lastsh != 0);
638 void AiresWrapper::sprimname(
char *pname,
int *pnamelen) {
640 assert(pname != 0 && pnamelen != 0);
646 int AiresWrapper::thisairesversion() {
652 double AiresWrapper::urandom() {
658 double AiresWrapper::xslant(
double *Xvert,
double *Xv0,
659 double *cozenith,
double *zground) {
661 assert(Xvert != 0 && Xv0 != 0 && cozenith != 0 && zground != 0);
int crorecnumber_(int *channel, int *vrb, int *irc)
void spaddnull_(double *pener, double *pwt, int *irc)
void fitghf_(int *bodata0, int *eodata0, double *depths, double *nallch, double *weights, int *ws, double *minnmax, double *nminratio, int *bodataeff, int *eodataeff, double *nmax, double *xmax, double *x0, double *lambda, double *sqsum, int *irc)
void spaddpn_(int *n, int *pcode, double *pener, int *csys, int *ldu, double **uxyz, double *pwt, int *irc)
bool regetcrorecord_(int *channel, int *intfields, double *realfields, bool *altrec, int *vrb, int *irc)
void speiend_(int *retcode)
bool crorecfind_(int *channel, int *intype, int *vrb, int *infield1, int *rectype)
void crotaskidc(char *taskname, int *namelen, int *taskversion, char *startdate)
void croinputdata0_(int *intdata, double *realdata, int *shprimcode, double *shprimwt)
void olcrossed_(int *olkey, int *updown, int *firstol, int *lastol)
bool crospcode_(int *pcode, int *splabel)
void olcoord_(int *nobslev, double *olzv, double *groundz, double *injz, double *zenith, double *azimuth, double *xaxis, double *yaxis, double *zaxis, double *tshift, double *mx, double *my, int *irc)
void spnshowers_(int *totsh, int *firstsh, int *lastsh)
int crofileversion_(int *channel)
void croreccount_(int *channel, int *vrb, int *nrtype, int *nrec, int *irc)
double xslant_(double *Xvert, double *Xv0, double *cozenith, double *zground)
void crooldata_(int *vrb, int *nobslev, double *olzv, double *oldepth, int *irc)
void nucldecode_(int *ncode, int *z, int *n, int *a)
void speitaskc(char *taskn, int *tasklen, int *tver)
void speimv_(int *mvnew, int *mvold)
void crofileinfo_(int *channel, int *ouflag, int *vrb, int *irc)
bool getcrorecord_(int *channel, int *intfields, double *realfields, bool *altrec, int *vrb, int *irc)
void speigetparsc(char *parstring, int *pstrlen)
void sp1stint_(int *csys, double *x1, double *y1, double *z1, int *irc)
void crorewind_(int *channel, int *vrb, int *irc)
int nuclcode_(int *z, int *n, int *irc)
void olv2slant_(int *nobslev, double *olxv, double *Xv0, int *zendis, double *zen1, double *zen2, double *groundz, double *olxs)
bool getcrorectype_(int *channel, int *vrb, int *infield1, int *rectype)
bool olsavemarked_(int *obslev, int *vrb, int *irc)
void spinjpoint_(int *csys, double *x0, double *y0, double *z0, int *tsw, double *t0beta, int *irc)
void getinpstringc(char *dirname, char *value, int *slen)
double getinprealc(char *dirname)
void crorecninfo_(int *channel, int *poskey, int *ouflag, int *vrb, int *irc)
void speigetmodnamec(char *mn, int *mnlen, char *mnfull, int *mnfullen)
bool crogotorec_(int *channel, int *recnumber, int *vrb, int *irc)
bool getinpswitchc(char *dirname)
void croheader1info_(int *ouflag)
void raninit_(double *seed)
int getinpintc(char *dirname)
void opencrofilec(const char *wdir, const char *filename, int *header1, int *logbase, int *vrb, int *channel, int *irc)
void cioclose1_(int *channel)
#define ERROR(message)
Macro for logging error messages.
void croheaderinfo_(int *ouflag, int *vrb, int *irc)
void olcrossedu_(int *olkey, double *ux, double *uy, double *uz, int *firstol, int *lastol)
void ciorinit_(int *inilevel, int *codsys, int *vrb, int *irc)
int crofieldindexc(int *channel, int *rectype, char *fieldname, int *vrb, int *datype, int *irc)
void sprimname_(char *pname, int *pnamelen)
void speistart_(int *showerno, double *primener, double *injpos, double *xvinj, double *zground, double *xvground, double *dgroundinj, double *uprim)
void spaddp0_(int *pcode, double *pener, int *csys, double *ux, double *uy, double *uz, double *pwt, int *irc)