Skip to content

Commit

Permalink
Many changes for 64 bit conversion and to silence minor issues reveal…
Browse files Browse the repository at this point in the history
…ed by clang
  • Loading branch information
pavlis committed Jun 21, 2015
1 parent 6f0877f commit ccd8cf4
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 93 deletions.
2 changes: 1 addition & 1 deletion lib/multiwavelet/libmultiwavelet/MWcoherence.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int MWcoherence(MWstack *stack,complex ***z,double **coherence,double *cohb)
int i,j,k;
complex **residuals;
complex cwork;
double coh,z2,r2;
double z2,r2;
double *z2b,*r2b; /* accumulated sums for beam */
/* These are copies of size variables from stack used
to make this more readable. */
Expand Down
4 changes: 2 additions & 2 deletions lib/multiwavelet/libmultiwavelet/MWsave_gather.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void MWsave_gather(
FILE *fpr,*fpi;
int i,j,k;
double *t;
char *dir;
char *dir=NULL;

allot(double *,t,nt);
for(i=0;i<nt;++i) t[i] = t0+dt*((double)i);
Expand Down Expand Up @@ -132,7 +132,7 @@ void MWsave_coherence(
FILE *fpr,*fpi;
int i,j,k;
double *t;
char *dir;
char *dir=NULL;

allot(double *,t,nt);
for(i=0;i<nt;++i) t[i] = t0+dt*((double)i);
Expand Down
2 changes: 0 additions & 2 deletions lib/multiwavelet/libmultiwavelet/MWstack.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ MWstack *MWextract_stack_window(MWstack *instack,Time_Window *win)
int tstart, tend; /* start and end values(in samples) actually used */
int nused;
int lag;
int ierr;
char *message="MWextract_stack_window: requested window is inconsistent with the stack window";

MWstack *outstack;
Expand Down Expand Up @@ -385,7 +384,6 @@ MWstack *MWrobuststack(complex ***z,
double cmag;
int iteration;
double dzmod,ctest;
complex *A;

/* We scan for the first and last number in timeweight that are nonzero.
We need to use a reduced workspace to build stack to avoid biasing statistics
Expand Down
5 changes: 2 additions & 3 deletions lib/multiwavelet/libmultiwavelet/apsubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ int compute_plane_wave_static(MWstation *s,
char *method;
TTGeometry geometry;
TTTime *atime;
TTSlow *u0,*u;
TTSlow *u0;
char refphase[TTPHASE_SIZE];
MWSlowness_vector slow;
int tresult,uresult;
Expand Down Expand Up @@ -486,7 +486,7 @@ int compute_plane_wave_static(MWstation *s,
tresult = ttcalc(method,model,phase,0,&geometry,&treturn,&hook);
if(tresult)
{
elog_complain(0,"Error computing travel time from model %s using method %d for station %s\nStatic set to zero\n",
elog_complain(0,"Error computing travel time from model %s using method %s for station %s\nStatic set to zero\n",
model, method, s->sta);
s->plane_wave_static = 0.0;
freetbl(treturn,free);
Expand Down Expand Up @@ -849,7 +849,6 @@ int estimate_slowness_vector(
int error_code=0;
int nsvused;
int iteration=0;
double dtref;
double dutest;
int info;

Expand Down
69 changes: 34 additions & 35 deletions lib/multiwavelet/libmultiwavelet/dbsubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ int MWdb_save_slowness_vector(char *phase,
double peakcm,
Dbptr db)
{
double slo, azimuth, cxx, cyy, cxy;
double slo, azimuth;
char cmeasure[2];

slo = hypot(u->ux,u->uy);
Expand All @@ -69,8 +69,8 @@ int MWdb_save_slowness_vector(char *phase,
}

if( dbaddv(db,0,"sta",array,
"evid",evid,
"bankid",bankid,
"evid",(long)evid,
"bankid",(long)bankid,
"phase", phase,
"fc",fc,
"fwin",fwin,
Expand All @@ -85,7 +85,7 @@ int MWdb_save_slowness_vector(char *phase,
"ncomp",ncomp,
"cohtype",cmeasure,
"cohmeas",peakcm,
"algorithm","mwap",0) < 0)
"algorithm","mwap",NULL) < 0)
{
elog_notify(0,
"dbaddv error for mwslow table on evid %d fc=%lf\n",
Expand Down Expand Up @@ -136,8 +136,8 @@ int MWdb_save_avgamp(char *array,
/* Note algorithm and ampcomp are frozen here. */

if( dbaddv(db,0,"sta",array,
"evid",evid,
"bankid",bankid,
"evid",(long)evid,
"bankid",(long)bankid,
"phase", phase,
"fc",fc,
"ampcomp",AMPCOMP,
Expand All @@ -146,7 +146,7 @@ int MWdb_save_avgamp(char *array,
"mwamp",mwamp,
"erramp",erramp,
"ndgf",ndgf,
"algorithm","mwap",0) < 0)
"algorithm","mwap",NULL) < 0)
{
elog_notify(0,
"dbaddv error for mwavgamp table on evid %d with fc=%lf\n",
Expand Down Expand Up @@ -252,9 +252,9 @@ int MWdb_save_statics(
if( dbaddv(dbsnr,0,
"sta",sta,
"fc",fc,
"bankid",bankid,
"bankid",(long)bankid,
"phase",phase,
"evid",evid,
"evid",(long)evid,
"nstime",snr->nstime,
"netime",snr->netime,
"sstime",snr->sstime,
Expand All @@ -263,7 +263,7 @@ int MWdb_save_statics(
"snrn",snr->ratio_n,
"snre",snr->ratio_e,
"snr3c",snr->ratio_3c,
"algorithm","mwap",0) < 0)
"algorithm","mwap",NULL) < 0)
{
elog_notify(0,"mwtstatic dbaddv error for station %s\n",sta);

Expand Down Expand Up @@ -300,9 +300,9 @@ int MWdb_save_statics(
ierr = dbaddv(dbt,0,
"sta",sta,
"fc",fc,
"bankid",bankid,
"bankid",(long)bankid,
"phase",phase,
"evid",evid,
"evid",(long)evid,
"time",time,
"twin",twin,
"wgt",s->current_weight_base,
Expand All @@ -312,17 +312,17 @@ int MWdb_save_statics(
"errstatic",mws->sigma_t,
"ndgf",mws->ndgf,
"datum",refelev,
"algorithm","mwap",0);
"algorithm","mwap",NULL);
}
else
{
resid = (*atime) - (*modtime);
ierr = dbaddv(dbt,0,
"sta",sta,
"fc",fc,
"bankid",bankid,
"bankid",(long)bankid,
"phase",phase,
"evid",evid,
"evid",(long)evid,
"time",time,
"twin",twin,
"wgt",s->current_weight_base,
Expand All @@ -333,7 +333,7 @@ int MWdb_save_statics(
"ndgf",mws->ndgf,
"datum",refelev,
"timeres",resid,
"algorithm","mwap",0);
"algorithm","mwap",NULL);
}
if(ierr<0)
{
Expand All @@ -354,16 +354,16 @@ int MWdb_save_statics(
"sta",sta,
"ampcomp",AMPCOMP,
"fc",fc,
"bankid",bankid,
"bankid",(long)bankid,
"phase",phase,
"evid",evid,
"evid",(long)evid,
"time",time,
"twin",twin,
"wgt",s->current_weight_base,
"ndgf",mws->ndgf,
"ampstatic",ampdb,
"erramp",aerrdb,
"algorithm","mwap",0) < 0)
"algorithm","mwap",NULL) < 0)
{
elog_notify(0,"mwtstatic dbaddv error for station %s\n",sta);

Expand Down Expand Up @@ -419,7 +419,6 @@ int MWdb_save_pm(
Dbptr db)
{

char *sta;
int i;
Particle_Motion_Ellipse *pm;
Particle_Motion_Error *pmerr;
Expand Down Expand Up @@ -467,10 +466,10 @@ int MWdb_save_pm(
minema = deg(scoor.theta);
if( dbaddv(db,0,
"sta",g->sta[i]->sta,
"bankid",bankid,
"bankid",(long)bankid,
"fc",fc,
"phase",phase,
"evid",evid,
"evid",(long)evid,
"time",time,
"twin",twin,
"pmtype","ss",
Expand All @@ -487,9 +486,10 @@ int MWdb_save_pm(
"majndgf",pmerr->ndgf_major,
"minndgf",pmerr->ndgf_minor,
"rectndgf",pmerr->ndgf_rect,
"algorithm","mwap",0) < 0)
"algorithm","mwap",NULL) < 0)
{
elog_notify(0,"dbaddv error in mwpm table for station %s\n",sta);
elog_notify(0,"dbaddv error in mwpm table for station %s\n",
g->sta[i]->sta);

++errcount;
}
Expand All @@ -505,10 +505,10 @@ int MWdb_save_pm(
minema = deg(scoor.theta);
if( dbaddv(db,0,
"sta",array,
"bankid",bankid,
"bankid",(long)bankid,
"fc",fc,
"phase",phase,
"evid",evid,
"evid",(long)evid,
"time",time,
"twin",twin,
"pmtype","aa",
Expand All @@ -525,7 +525,7 @@ int MWdb_save_pm(
"majndgf",pmaerr->ndgf_major,
"minndgf",pmaerr->ndgf_minor,
"rectndgf",pmaerr->ndgf_rect,
"algorithm","mwap",0) < 0)
"algorithm","mwap",NULL) < 0)
{
elog_notify(0,"dbaddv error saving array average particle motion parameters in mwpm table for evid %d\n",
evid);
Expand Down Expand Up @@ -559,15 +559,14 @@ Written: April 2002

MWbasis *load_multiwavelets_db(Dbptr db, Pf *pf,int *nwavelets, int *bankid)
{
MWbasis *mwb;
int nw;
MWbasis *mwb=NULL;
char *select_condition;
Dbptr dbv;
int nrecords;
long nrecords;
/* These are the attribute in the mwdisc table minus
those returned in the argument list */

int nsamp,foff;
long nsamp,foff;
double f0,fw;
char datatype[4],mworder[4];
char fname[128];
Expand All @@ -588,14 +587,14 @@ MWbasis *load_multiwavelets_db(Dbptr db, Pf *pf,int *nwavelets, int *bankid)
elog_complain(0,"load_multiwavelet_db: multiple records in mwdisc match the condition %s\nUsing first record found\n",
select_condition);
dbv.record=0;
dbgetv(dbv,0,"bankid",bankid,
dbgetv(dbv,0,"bankid",(long)bankid,
"nsamp",&nsamp,
"nwavelets",nwavelets,
"f0",&f0,
"fw",&fw,
"datatype",datatype,
"foff",&foff,
"mworder",mworder,0);
"mworder",mworder,NULL);
if(strcmp(datatype,"t4"))
elog_die(0,"multiwavelets must be in t4 binary form\n");
if(strcmp(mworder,"ti") || strcmp(mworder,"ts") )
Expand Down Expand Up @@ -645,16 +644,16 @@ MWbasis *load_multiwavelets_db(Dbptr db, Pf *pf,int *nwavelets, int *bankid)
nr=fread(mwb[i].r,sizeof(float),nsamp,fp);
ni=fread(mwb[i].i,sizeof(float),nsamp,fp);
if( (nr!=nsamp) || (ni!=nsamp) )
elog_die(0,"read error on file %s while reading wavelet %d\nRead %d real and %d imaginary samples while expecting %d\n",
elog_die(0,"read error on file %s while reading wavelet %d\nRead %d real and %d imaginary samples while expecting %ld\n",
fname,i,
nr,ni,nsamp);
}
}
fclose(fp);
}
else
elog_die(0,"load_multiwavelet_db: don't know how to read mworder %s\nCurrently support only ti and ts\n",
mworder);

fclose(fp);
return(mwb);
}
13 changes: 5 additions & 8 deletions lib/multiwavelet/libmultiwavelet/decimate.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Tbl **define_decimation(Pf *pf, int *nbands)
}

/* This routine looks at a sequence of css response files passed
through the dec_stages list of file names, reads these response
through the decdef tbl of file names, reads these response
files, and stores the description of them in a series of output
Tbls.
arguments:
Expand All @@ -81,7 +81,6 @@ int read_dec_files (Tbl *decdef, int *dec_fac, Tbl **decimators)
Response *rsp;
char string[512];
FILE *file;
char **dec_stages;

FIR_decimation *decptr;
Response *resp;
Expand Down Expand Up @@ -137,20 +136,20 @@ int read_dec_files (Tbl *decdef, int *dec_fac, Tbl **decimators)
get_response_stage_fir_ncoefs (rsp, j, &srate, &dec_factor, &nnum, &nden);
if (nden > 1) {
elog_notify(0, "read_dec_files: Dont know how to do IIR filters (%s).\n",
dec_stages[i]);
decfile);
return (0);
}
if (nnum < 1) {
elog_notify(0, "read_dec_files: No numerator terms (%s).\n",
dec_stages[i]);
decfile);
return (0);
}
ok=1;
(*dec_fac) *= dec_factor;
}
if (!ok) {
elog_notify(0, "read_dec_files: no fir stage on file '%s'.\n",
dec_stages[i]);
decfile);
return (0);
}
for (j=0; j<n; j++) {
Expand All @@ -170,12 +169,10 @@ int read_dec_files (Tbl *decdef, int *dec_fac, Tbl **decimators)

for (i=0; i<n; i++) {
Response_group *gpi;
int dec_factor, nnum, nden, n2;
int dec_factor, nnum, nden;
double srate;
double *coefsi, *coefs_err;
double *coefdi, *coefd_err;
float *cfs;
int *numb, *decf;

decptr = (FIR_decimation *) malloc(sizeof(FIR_decimation));
if(decptr == NULL)
Expand Down
Loading

0 comments on commit ccd8cf4

Please sign in to comment.