当前位置: 首页>>代码示例>>C++>>正文


C++ requestdoc函数代码示例

本文整理汇总了C++中requestdoc函数的典型用法代码示例。如果您正苦于以下问题:C++ requestdoc函数的具体用法?C++ requestdoc怎么用?C++ requestdoc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了requestdoc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char **argv)
{
	int i;

	char *srcfile;
	char *datfile;
	float b,e,k,a;
	int nv; float *v;

	/* Initialize */
	initargs(argc, argv);
	requestdoc(1);

	/* Get parameters */
	if (!getparstring("src", &srcfile)) err("must specify src= source file");
	if (!getparstring("dat", &datfile)) err("must specify dat= data file");
	if (!getparfloat("b", &b)) b=-INFINITY;
	if (!getparfloat("e", &e)) e=INFINITY;
	if (!getparfloat("k", &k)) k=0.01;
	if (!getparfloat("a", &a)) a=0;
	if ((nv=countparval("v"))) {
		v=malloc(nv*sizeof(float));
		getparfloat("v",v);
	}

	/* Print out parameters */
	printf("src=%s dat=%s b=%f e=%f k=%f a=%f v=",srcfile,datfile,b,e,k,a);
	for (i=0;i<nv;i++) printf("%f,",v[i]);
	printf("\n");

	return 0;
}
开发者ID:taotaokai,项目名称:libgetpar,代码行数:32,代码来源:test.c

示例2: main

int
main(int argc, char **argv)
{
	int ns;		/* samples on output traces	*/


	/* Initialize */
	initargs(argc, argv);
	requestdoc(1);


        /* Get info from first trace */ 
        if (!fvgettr(stdin, &tr))  err("can't get first trace"); 
        if (!getparint("ns", &ns)) ns = tr.ns;
        checkpars();


	/* Loop over the traces */
	do {
		int nt = tr.ns;
				
		if (nt < ns) /* pad with zeros */
                	memset((void *)(tr.data + nt), 0, (ns-nt)*FSIZE);
		tr.ns = ns;
		puttr(&tr);
	} while (fvgettr(stdin, &tr));
	
	return(CWP_Exit());
}
开发者ID:JohnWStockwellJr,项目名称:SeisUnix,代码行数:29,代码来源:suvlength.c

示例3: main

int
main(int argc, char **argv)
{
	FILE *fp;
	int fd,j=0,verbose;

	initargs(argc,argv);
	requestdoc(1);

	if(!getparint("fd",&fd)) fd=-1;
	if(!getparint("verbose",&verbose)) verbose=0; 
	warn("File descriptor passed to suget = %d",fd);
	if( (fp = (FILE *) fdopen(fd,"r"))==NULL) err("Bad file descriptor");
	warn("About to read first trace");
	if(!fgettr(fp,&tr)) err("Can't get first trace");

	do{
		if(verbose>0){
			warn("read trace %d",j);
			j++;
		}

		puttr(&tr);

	} while(fgettr(fp,&tr));

	return(CWP_Exit());
}
开发者ID:gwowen,项目名称:seismicunix,代码行数:28,代码来源:suget.c

示例4: main

int
main(int argc, char **argv)
{

	/* Initialize */
	initargs(argc, argv);
	requestdoc(1);


	while (gettr(&tr)) {
		tr.f1 = 0.0;
		tr.d1 = 0.0;
		tr.f2 = 0.0;
		tr.d2 = 0.0;
		tr.ungpow = 0.0;
		tr.unscale = 0.0;
		tr.ntr = 0;
		tr.mark = 0;

		puttr(&tr);
	}


	return(CWP_Exit());
}
开发者ID:gwowen,项目名称:seismicunix,代码行数:25,代码来源:segyclean.c

示例5: main

int
main(int argc, char **argv)
{
	float *f;
	int n1;
	void *wpc1;
	int i;

	initargs(argc,argv);
	requestdoc(1);

	wpc1 = wpc1Read(stdin);

	n1 = wpc1Numsmp(wpc1);

	if(n1< 0) fprintf(stderr, "Inconsistent data, n=%d\n", n1);

	f = alloc1float(n1);
	
	i = 0;
	while(i >= 0 /*TRUE*/){
	    if(!wpc1Uncompress(wpc1, f)){
	    	fprintf(stderr, "Inconsistent data, trace # %d\n", i);
		break;
	    }

	    i++;
	    fwrite(f, sizeof(float), n1, stdout);
	    if((wpc1 = wpc1Read(stdin)) == NULL) break; 
	}
	return EXIT_SUCCESS;
}
开发者ID:JOravetz,项目名称:SeisUnix,代码行数:32,代码来源:wpc1uncomp2.c

示例6: main

int 
main(int argc, char **argv)
{
	/* Segy data constans */
	int ntr=0;		/* number of traces			*/
	char *outpar=NULL;	/* name of file holding output		*/
	FILE *outparfp=stdout;	/* ... its file pointer			*/

	initargs(argc, argv);
   	requestdoc(1);
	
	/* Get information from the first header */
	if (!gettr(&tr)) err("can't get first trace");
	if (!getparstring("outpar", &outpar))	outpar = "/dev/stdout" ;
	
	outparfp = efopen(outpar, "w");

        checkpars();
	/* Loop over traces getting a count */
	do {
		++ntr;
	} while(gettr(&tr));

	fprintf(outparfp, "%d", ntr);

	return(CWP_Exit());

}
开发者ID:JohnWStockwellJr,项目名称:SeisUnix,代码行数:28,代码来源:sutrcount.c

示例7: main

int
main(int argc, char **argv)
{
	cwp_String key1,  key2;	/* x and y key header words	*/
	Value  val1,  val2;	/* ... their values		*/
	cwp_String type1, type2;/* ... their types		*/
	int index1, index2;	/* ... their indices in hdr.h	*/
	float x, y;		/* temps to hold current x & y 	*/
	cwp_String outpar;	/* name of par file		*/
	register int npairs;	/* number of pairs found	*/


	/* Hook up getpars */
	initargs(argc, argv);
	requestdoc(1);


	/* Prevent byte codes from spilling to screen */
	if (isatty(STDOUT)) err("must redirect or pipe binary output");


	/* Get parameters */
	if (!getparstring("key1", &key1))	key1 = "sx";
	if (!getparstring("key2", &key2))	key2 = "gx";

	type1 = hdtype(key1);
	type2 = hdtype(key2);

	index1 = getindex(key1);
	index2 = getindex(key2);


	/* Loop over traces */
	npairs = 0;
	while(gettr(&tr)) {

		gethval(&tr, index1, &val1);
		gethval(&tr, index2, &val2);

		x = vtof(type1, val1);
		y = vtof(type2, val2);

		efwrite(&x, FSIZE, 1, stdout);
		efwrite(&y, FSIZE, 1, stdout);

		++npairs;
	}


	/* Make parfile if needed */
	if (getparstring("outpar", &outpar))
		fprintf(efopen(outpar, "w"),
			"n=%d label1=%s label2=%s\n",
			npairs, key1, key2);

	return(CWP_Exit());
}
开发者ID:gwowen,项目名称:seismicunix,代码行数:57,代码来源:suchart.c

示例8: main

int
main(int argc, char **argv)
{
	int i, j, n;
	float *f,  max, step, rstep;
	float fhist[1024], dev, rdev, ent, error; 
	int hist[1024];
	 
	initargs(argc, argv);
	requestdoc(1);

	MUSTGETPARINT("n",&n);

	f = alloc1float(n);

	fread(f,sizeof(float),n,stdin);
	
	for(i=0;i<1024;i++) hist[i] = 0;

	for(i=0,rdev=0.;i<n;i++)
	   rdev += f[i]*f[i]; 
	rdev = rdev/n;
	rdev = sqrt(rdev);

	if(!getparfloat("dev",&dev)) dev = rdev;

	fprintf(stderr,"dev=%f\n", dev);

	step = dev*3.464*.01;

	rstep = 1./step;

	error = 0.;
	for(i=0;i<n;i++){
	    max = f[i]*rstep;
	    error += (NINT(max)*step - f[i])*(NINT(max)*step - f[i]);
	    hist[NINT(max)+512] ++;
	}

	error = error/n;
	error = sqrt(error);
	error = error/rdev;

	ent = 0.;
	for(j=0;j<1024;j++){
		fhist[j] = ((float) hist[j])/((float) n);
		if(hist[j])
		    ent += fhist[j]*log(fhist[j])/log(2.);
	}
	ent = -ent;

fprintf(stderr,"entropy of the signal is=%f, average error=%f\n",ent, error);

	fwrite(fhist,sizeof(float),1024,stdout);

	return EXIT_SUCCESS;
}
开发者ID:gwowen,项目名称:seismicunix,代码行数:57,代码来源:entropy.c

示例9: main

int
main(int argc, char **argv)
{

	int i;			/* counter			*/
	int itr=0;		/* trace counter		*/
	int verbose;		/* =0 silent,  =1 chatty	*/
	int interp;		/* =1 interpolate to get NaN	*/
				/* and Inf replacement values	*/
			
	float value;		/* value to set NaN and Infs to */

	/* Initialize */
   	initargs(argc,argv);
   	requestdoc(1);

	/* Get info from first trace */
	if(!gettr(&tr) ) err("Can't get first trace \n");

	/* Get parameters */
	if(!getparint("verbose",&verbose))	verbose = 1;
	if(!getparint("interp",&interp))	interp = 0;
	if(!getparfloat("value",&value))	value = 0.0;
        checkpars();

	/* Loop over traces */
	do{
		++itr;
      		for(i=0; i<tr.ns; ++i){
		    if(!isfinite(tr.data[i])) {
		       if (verbose)
	                warn("found NaN trace = %d  sample = %d", itr, i);

			if (interp) { /* interpolate nearest neighbors */
				      /* for NaN replacement value     */
				if (i==0 && isfinite(tr.data[i+1])) { 
					tr.data[i]=tr.data[i+1];
				} else if(i==tr.ns-1 && isfinite(tr.data[i-2])) {
					tr.data[i]= tr.data[i-2];
				} else if( isfinite(tr.data[i-1]) &&
						isfinite(tr.data[i+1]) ) {
					tr.data[i]=(tr.data[i-1]+tr.data[i+1])/2.0;
				}
			}
				
			/* use user defined NaNs replacement value */
            	       	tr.data[i] = value;
			}
		    }

      		puttr(&tr);
	} while(gettr(&tr));

	return(CWP_Exit());
}
开发者ID:JohnWStockwellJr,项目名称:SeisUnix,代码行数:55,代码来源:sunan.c

示例10: main

int
main(int argc, char **argv)
{
	float fz[BUFSIZ];
	int iz=0,jz,nz=0;
	unsigned int z[BUFSIZ];
	char line[BUFSIZ],*lp, *outpar;
	FILE *infp=stdin,*outfp=stdout, *outparfp;

	unsigned int *uz = &(z[0]);

	/* Hook up getpar */
	initargs(argc, argv);
	requestdoc(1);

	/* Prevent floats from dumping on screen */
	switch(filestat(STDOUT)) {
	case BADFILETYPE:
		warn("stdout is illegal filetype");
		pagedoc();
	break;
	case TTY:
		warn("stdout can't be tty");
		pagedoc();
	break;
	default: /* rest are OK */
	break;
	}


	/* Get parameters and do set up */
	if (!getparstring("outpar", &outpar))  outpar = "/dev/tty" ;
	outparfp = efopen(outpar, "w");

	while (fgets(line,BUFSIZ,infp)!=NULL) {

		/* set pointer to beginning of line */
		lp = line;

		/* read hex digits from input line */
		for(iz=0;sscanf(lp,"%2x",&uz[iz])==1;iz++,nz++,lp+=2);

		/* convert to floats */
		for(jz=0;jz<iz;jz++)
			fz[jz] = 255-z[jz];

		/* write floats */
		fwrite(fz,sizeof(float),iz,outfp);
	}

	/* Make par file */
	fprintf(outparfp, "total number of values=%d\n",nz);

	return(CWP_Exit());
}
开发者ID:gwowen,项目名称:seismicunix,代码行数:55,代码来源:h2b.c

示例11: main

int
main(int argc, char **argv)
{
	int nt;				/* number of samples on input */
	int ntout;			/* number of samples on output */
	int it;				/* counter */
	int istart;			/* beginning sample */
	int izero;			/* - istart */
	int norm;			/* user defined normalization value */
	int sym;			/* symmetric plot? */
	float scale;			/* scale factor computed from norm */
	float *temp=NULL;		/* temporary array */
	float dt;			/* time sampling interval (sec) */

	/* hook up getpar */
	initargs(argc, argv);
	requestdoc(1);

	/* get information from the first header */
	if (!gettr(&tr)) err("can't get first trace");
	nt = tr.ns;
	dt = tr.dt/1000000.0;

	/* get parameters */
	if (!getparint("ntout",&ntout)) ntout=101;
	if (!getparint("norm",&norm)) norm = 1;
	if (!getparint("sym",&sym)) sym = 1;
        checkpars();
	
	/* allocate workspace */
	temp = ealloc1float(ntout);
	
	/* index of first sample */
	if (sym == 0) istart = 0;
	else istart = -(ntout-1)/2;

	/* index of sample at time zero */
	izero = -istart;
	
	/* loop over traces */
	do {
		xcor(nt,0,tr.data,nt,0,tr.data,ntout,istart,temp);
		if (norm) {
			scale = 1.0/(temp[izero]==0.0?1.0:temp[izero]);
			for (it=0; it<ntout; ++it)  temp[it] *= scale;
		}
		memcpy((void *) tr.data, (const void *) temp, ntout*FSIZE);
		tr.ns = ntout;
		tr.f1 = -dt*ntout/2.0;
		tr.delrt = 0;
		puttr(&tr);
	} while(gettr(&tr));

	return(CWP_Exit());
}
开发者ID:JohnWStockwellJr,项目名称:SeisUnix,代码行数:55,代码来源:suacor.c

示例12: main

main(int argc, char **argv)
{
	initargs(argc, argv);
	requestdoc(1);

 	while (gettr(&tr)) {
 		tr.offset = abs(tr.offset);
 		puttr(&tr);
 	}

	return EXIT_SUCCESS;
}
开发者ID:gganssle,项目名称:stripper,代码行数:12,代码来源:fgettr.c

示例13: main

int
main(int argc, char **argv)
{
	double sx, sy, gx, gy, factor;
	float mx, my;
        short unit;                                                           
	int degree;
	cwp_String outpar;
	register int npairs;


	/* Initialize */
	initargs(argc, argv);
	requestdoc(1);

	if (!getparint("degree", &degree)) degree=0;

	npairs = 0;
	while (gettr(&tr)) {

		sx = tr.sx;
		sy = tr.sy;
		gx = tr.gx;
		gy = tr.gy;

                unit = tr.counit;
		
		/* If tr.scalco not set, use 1 as the value */
		factor = (!tr.scalco) ? 1 : tr.scalco;
		
                /* factor < 0 means divide; factor > 0 means to multiply */
                if (factor < 0) factor = -1/factor;

                /* if necessary, convert from seconds to degrees */
                if (unit == 2 && degree == 1) factor /= 3600;

                mx = (float) (0.5*(sx + gx) * factor);
                my = (float) (0.5*(sy + gy) * factor);

		efwrite(&mx, FSIZE, 1, stdout);
		efwrite(&my, FSIZE, 1, stdout);

		++npairs;
	}


	/* Make parfile if needed */
	if (getparstring("outpar", &outpar))
		fprintf(efopen(outpar, "w"), "n=%d\n", npairs);

	return(CWP_Exit());
}
开发者ID:gwowen,项目名称:seismicunix,代码行数:52,代码来源:su3dchart.c

示例14: main

int main( int argc, char *argv[] )
{
	/* binning */
	float xc;
	float yc;
	double cdpcx;
	double cdpcy;
	float dbx;
	float dby;
	float deg;
	float degr;
	int dirx;
	int diry;
	int nx;
	int ny;
	float xe;
	float ye;
	int ix;
	int iy;

	initargs(argc, argv);
   	requestdoc(1);

	/* binning stuff */
	if(!getparfloat("xc",&xc)) xc=1;
	if(!getparfloat("yc",&yc)) yc=1;
	if(!getparfloat("dbx",&dbx)) dbx=20;
	if(!getparfloat("dby",&dby)) dby=20;
	if(!getparfloat("deg",&deg)) deg=0;
	degr = 3.141592653/180 * deg;
	if(!getparint("dirx",&dirx)) dirx=1;
	if(!getparint("diry",&diry)) diry=1;
	MUSTGETPARINT("nx", &nx);
	MUSTGETPARINT("ny", &ny);

	/* edge of bin# 1,1 */
	xe = xc - dirx*dbx/2.0*cos(degr) - diry*dby/2.0*sin(degr);
	ye = yc - diry*dby/2.0*cos(degr) + dirx*dbx/2.0*sin(degr);

	/* compute bin centre coordinates */
	for(ix=1;ix<=nx; ix++) {
		for(iy=1;iy<=ny;iy++) { 
			cdpcx= xc + dirx*(ix-1)*dbx*cos(degr) +
                        	diry*(iy-1)*dby*sin(degr);
			cdpcy= yc + diry*(iy-1)*dby*cos(degr) -
                        	dirx*(ix-1)*dbx*sin(degr);
			fprintf(stdout," %d %f %f\n",
				ix*1000+iy,cdpcx,cdpcy);
			}
	}
	return EXIT_SUCCESS;
}
开发者ID:JOravetz,项目名称:SeisUnix,代码行数:52,代码来源:subins.c

示例15: main

int
main(int argc, char **argv)
{
	int itmin;		/* smallest sample (zero-based)	to plot	*/
	int itmax;		/* largest sample (zero-based) to plot	*/
	int nt;			/* number of samples			*/
	int count;		/* number of traces to plot		*/
	register int itr;	/* trace counter			*/
	cwp_Bool plotall;	/* plot all the traces			*/


	/* Initialize */
	initargs(argc, argv);
	requestdoc(1);


	/* Set number of traces to plot */
	plotall = cwp_false;
	if (!getparint("count", &count)) plotall = cwp_true;


	/* Loop over traces */
	for (itr = 0; (plotall || itr < count) && gettr(&tr); itr++) {

		nt = (int) tr.ns;	/* Cast from unsigned */
		if (itr == 0) {	/* Awkward to do a gettr outside loop */
			if (!getparint("itmin", &itmin))	itmin = 0;
			if (!getparint("itmax", &itmax))	itmax = nt - 1;
			if (itmin >= nt - 1 || itmin < 0) {
				err("itmin=%d, require 0 < itmin < %d",
							itmin, nt - 1);
			}
			if (itmax >= nt) {
				itmax = nt - 1;
			}
			if (itmax < 0) {
				err("itmax=%d, require itmax > 0", itmax);
			}
			if (itmin > itmax) {
				itmin = itmax;
			}
		}

		printheader(&tr);

		tabplot(&tr, itmin, itmax);

	}


	return(CWP_Exit());
}
开发者ID:JohnWStockwellJr,项目名称:SeisUnix,代码行数:52,代码来源:sutab.c


注:本文中的requestdoc函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。