本文整理汇总了C++中sf_putint函数的典型用法代码示例。如果您正苦于以下问题:C++ sf_putint函数的具体用法?C++ sf_putint怎么用?C++ sf_putint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sf_putint函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: write1di
void write1di(const char *file, int *dat, int n1) {
sf_file f = sf_output(file);
sf_putint(f, "n1", n1); sf_putint(f, "o1", 0); sf_putint(f, "d1", 0);
sf_putint(f, "n2", 1);
sf_settype(f, SF_INT);
sf_intwrite(dat, n1, f);
}
开发者ID:conghui,项目名称:qprop3delastic,代码行数:7,代码来源:check.c
示例2: puthead4x
void puthead4x(sf_file Fo, int n1, int n2, int n3, int n4, float d1, float d2, float d3, float d4, float o1, float o2, float o3, float o4)
/*< put head for (y,x,z,t) domain float-type 3D data sets>*/
{
/* Read/Write axes */
sf_putint(Fo,"n1",n1);
sf_putint(Fo,"n2",n2);
sf_putint(Fo,"n3",n3);
sf_putint(Fo,"n4",n4);
sf_putfloat(Fo,"d1",d1);
sf_putfloat(Fo,"d2",d2);
sf_putfloat(Fo,"d3",d3);
sf_putfloat(Fo,"d4",d4);
sf_putfloat(Fo,"o1",o1);
sf_putfloat(Fo,"o2",o2);
sf_putfloat(Fo,"o3",o3);
sf_putfloat(Fo,"o4",o4);
sf_putstring(Fo,"label1","z");
sf_putstring(Fo,"label2","x");
sf_putstring(Fo,"label3","y");
sf_putstring(Fo,"label4","t");
sf_putstring(Fo,"unit1","km");
sf_putstring(Fo,"unit2","km");
sf_putstring(Fo,"unit3","km");
sf_putstring(Fo,"unit4","s");
}
开发者ID:1014511134,项目名称:src,代码行数:25,代码来源:puthead.c
示例3: write3df
void write3df(const char *file, float ***dat, int n1, int n2, int n3)
{
sf_file f = sf_output(file);
sf_putint(f, "n1", n1); sf_putfloat(f, "o1", 0); sf_putfloat(f, "d1", 0);
sf_putint(f, "n2", n2); sf_putfloat(f, "o2", 0); sf_putfloat(f, "d2", 0);
sf_putint(f, "n3", n3); sf_putfloat(f, "o3", 0); sf_putfloat(f, "d3", 0);
sf_floatwrite(dat[0][0], n1*n2*n3, f);
}
开发者ID:conghui,项目名称:qprop3delastic,代码行数:8,代码来源:check.c
示例4: write3dfdm
void write3dfdm(const char *file, float ***dat, fdm3d fdm)
{
sf_file f = sf_output(file);
sf_putint(f, "n1", fdm->nzpad); sf_putfloat(f, "o1", fdm->ozpad); sf_putfloat(f, "d1", fdm->dz);
sf_putint(f, "n2", fdm->nxpad); sf_putfloat(f, "o2", fdm->oxpad); sf_putfloat(f, "d2", fdm->dx);
sf_putint(f, "n3", fdm->nypad); sf_putfloat(f, "o3", fdm->oypad); sf_putfloat(f, "d3", fdm->dy);
sf_floatwrite(dat[0][0], fdm->nzpad*fdm->nxpad*fdm->nypad, f);
}
开发者ID:conghui,项目名称:qprop3delastic,代码行数:8,代码来源:check.c
示例5: main
int main(int argc, char* argv[])
{
int n1,n2,n12;
bool adj;
float d1,d2,o1,o2,v, *model=NULL, *dat=NULL;
sf_file in=NULL, out=NULL;
sf_init(argc,argv);
in = sf_input("in");
out = sf_output("out");
if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input");
if (!sf_histfloat(in,"d1",&d1)) sf_error("No d1= in input");
if (!sf_histfloat(in,"o1",&o1)) o1=0.;
if (!sf_getbool("adj",&adj)) adj=false;
/* adjoint flag */
if (adj) {
if (!sf_histint(in,"n2",&n2)) sf_error("No n2= in input");
if (!sf_histfloat(in,"d2",&d2)) sf_error("No d2= in input");
if (!sf_histfloat(in,"o2",&o2)) sf_error("No o2= in input");
sf_putint(out,"n2",1);
} else {
if (!sf_getint("n2",&n2)) n2=20;
/* number of offsets (if inv=n) */
if (!sf_getfloat("d2",&d2)) d2=200.;
/* offset sampling (if inv=n) */
if (!sf_getfloat("o2",&o2)) o2=0.;
/* offset origin (if inv=n) */
sf_putint(out,"n2",n2);
sf_putfloat(out,"d2",d2);
sf_putfloat(out,"o2",o2);
}
n12 = n1*n2;
if (!sf_getfloat ("v",&v)) v=1000.;
/* velocity */
dat = sf_floatalloc(n12);
model = sf_floatalloc(n1);
imospray_init (1./v, o2,d2, o1,d1, n1,n2);
if (adj) {
sf_floatread(dat,n12,in);
imospray_lop (true,false,n1,n12,model,dat);
sf_floatwrite(model,n1,out);
} else {
sf_floatread(model,n1,in);
imospray_lop (false,false,n1,n12,model,dat);
sf_floatwrite(dat,n12,out);
}
exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:58,代码来源:Mimospray.c
示例6: main
int main(int argc, char* argv[])
{
int nz, nx, ix, iz;
float *trace, x0, z0, x, z, dx, dz, v0, g, v, a, d;
sf_file mod;
sf_init (argc,argv);
mod = sf_output("out");
if (!sf_getint("nz",&nz)) nz=601;
/* vertical dimension */
if (!sf_getint("nx",&nx)) nx=401;
/* horizontal dimension */
dz = 4./(nz-1);
dx = 6./(nx-1);
sf_putint (mod,"n1",nz);
sf_putfloat (mod,"d1",dz);
sf_putfloat (mod,"o1",0.);
sf_putint (mod,"n2",nx);
sf_putfloat (mod,"d2",dx);
sf_putfloat (mod,"o2",0.);
sf_setformat (mod,"native_float");
if(!sf_getfloat ("x0",&x0)) x0=4.;
/* anomaly center in x */
if(!sf_getfloat ("z0",&z0)) z0=1.5;
/* anomaly center in z */
if(!sf_getfloat ("v0",&v0)) v0=1.5;
/* surface velocity */
if(!sf_getfloat ("g",&g)) g=0.6;
/* velocity gradient */
if(!sf_getfloat ("a",&a)) a=1.;
/* anomaly magnitude */
if(!sf_getfloat ("d",&d)) d=1.;
/* anomaly radius */
d *= d;
trace = sf_floatalloc(nz);
for (ix=0; ix < nx; ix++) {
x = ix*dx - x0;
x *= x;
for (iz=0; iz < nz; iz++) {
z = iz*dz;
v = v0 + g*z;
z = z - z0;
z = z*z + x;
trace[iz] = v + a*exp(-z/d);
}
sf_floatwrite (trace,nz,mod);
}
exit (0);
}
开发者ID:1014511134,项目名称:src,代码行数:56,代码来源:Mhale.c
示例7: main
int main(int argc, char* argv[])
{
int i3, n3, ix, nx, iz, nz;
int nx2, nz2, scalex, scalez;
float dx, dz;
float **a, **b;
sf_file in, out;
sf_init(argc, argv);
in=sf_input("in");
out=sf_output("out");
if(!sf_getint("scalex", &scalex)) sf_error("Need scalex=");
if(!sf_getint("scalez", &scalez)) sf_error("Need scalez=");
if(!sf_histint(in, "n1", &nz)) sf_error("No n1= in input");
if(!sf_histfloat(in, "d1", &dz)) sf_error("No d1= in input");
if(!sf_histint(in, "n2", &nx)) sf_error("No n2= in input");
if(!sf_histfloat(in, "d2", &dx)) sf_error("No d2= in input");
nx2=(nx-1)*scalex+1;
nz2=(nz-1)*scalez+1;
n3=sf_leftsize(in, 2);
sf_putint(out, "n1", nz2);
sf_putfloat(out, "d1", dz/scalez);
sf_putint(out, "n2", nx2);
sf_putfloat(out, "d2", dx/scalex);
a=sf_floatalloc2(nz, nx);
b=sf_floatalloc2(nz2, nx2);
for (i3=0; i3<n3; i3++){
sf_floatread(a[0], nz*nx, in);
#pragma omp parallel for private(ix, iz)
for(ix=0; ix<nx2; ix++){
for(iz=0; iz<nz2; iz++){
b[ix][iz]=0.;
}
}
#pragma omp parallel for private(ix, iz)
for(ix=0; ix<nx; ix++){
for(iz=0; iz<nz; iz++){
b[ix*scalex][iz*scalez]=a[ix][iz];
}
}
sf_floatwrite(b[0], nz2*nx2, out);
}
exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:55,代码来源:Mpadzero.c
示例8: main
int main(int argc, char*argv[])
{
sf_file in, out;
int nf, n1, n2, n3, m, n;
int i3;
float **wav, ****fb;
char *interp;
sf_init(argc, argv);
in = sf_input("in");
out = sf_output("out");
if (SF_FLOAT != sf_gettype(in)) sf_error("Need float type");
if (!sf_histint(in, "n1", &n1)) sf_error("No n1= in input");
if (!sf_histint(in, "n2", &n2)) sf_error("No n2= in input");
n3 = sf_leftsize(in, 2);
sf_shiftdim2(in,out,2);
if(!sf_getint("m", &m)) m=1;
/* b[-m, ... ,n] */
if(!sf_getint("n", &n)) n=1;
/* b[-m, ... ,n] */
if ((interp=sf_getstring("interp"))==NULL) interp="maxflat";
/* interpolation method: maxflat lagrange bspline */
nf = m+n+1;
wav = sf_floatalloc2(n1,n2);
fb = sf_floatalloc4(n1, n2, nf, nf);
sf_putint(out, "n3", nf);
sf_putint(out, "n4", nf);
sf_putfloat(out, "o3", 0);
sf_putfloat(out, "d3", 1);
sf_putfloat(out, "o4", 0);
sf_putfloat(out, "d4", 1);
fbank_init(m, n, interp);
for(i3=0; i3<n3; i3++)
{
sf_floatread(wav[0], n1*n2, in);
fbank2(n1, n2, wav, fb);
sf_floatwrite(fb[0][0][0], n1*n2*nf*nf, out);
}
fbank_close();
return 0;
}
开发者ID:1014511134,项目名称:src,代码行数:54,代码来源:Mfbank2.c
示例9: sfFloatWrite2d
void sfFloatWrite2d(const char *fn, const float *dat, int n1, int n2,
float d1, float d2, float o1, float o2) {
sf_file f = sf_output(fn);
sf_putint(f, "n1", n1);
sf_putint(f, "n2", n2);
sf_putfloat(f, "d1", d1);
sf_putfloat(f, "d2", d2);
sf_putfloat(f, "o1", o1);
sf_putfloat(f, "o2", o2);
sf_floatwrite(const_cast<float *>(dat), n1 * n2, f);
}
开发者ID:conghui,项目名称:swfwi,代码行数:11,代码来源:sfutil.cpp
示例10: main
int main(int argc, char* argv[])
{
sf_init(argc,argv);
sf_file Fin,Fout;
long long int n1,n2,n3;
float d1,o1,d2,o2;
Fin=sf_input ("in" );
sf_axis a1,a2,a3;
a1 = sf_iaxa(Fin,1); n1 = sf_n(a1); d1=sf_d(a1);o1=sf_o(a1);
a2=sf_iaxa(Fin,2);n2=sf_n(a2);d2=sf_d(a2);o2=sf_o(a2);
fprintf(stderr,"%lld %lld %f %f %f %f\n",n1,n2,d1,d2,o1,o2);
int maxoffset;
if (!sf_getint("maxoffset",&maxoffset)) maxoffset=100000000;
Fout=sf_output("out");
sf_putint(Fout,"n2",15);
float temp[15];
int i,j;
int ntrace=0;
for(i=0;i<n2;i++)
for(j=0;j<n2;j++)
{
if((abs(j-i)%2==0)&&(fabs(j-i)*d2)<=maxoffset)
{
ntrace++;
}
}
sf_putint(Fout,"n1",ntrace);
ntrace=0;
for(i=0;i<n2;i++)
for(j=0;j<n2;j++)
{
if((abs(j-i)%2==0)&&(fabs(j-i)*d2)<=maxoffset)
{
float s=o2+i*d2;
float r=o2+j*d2;
float h=(r-s)/2.0;
float x=(s+r)/2;
temp[0]=i;
temp[1]=s;
temp[2]=r;
temp[3]=0;
temp[4]=0;
temp[5]=x;
temp[6]=h;
temp[14]=ntrace;
ntrace++;
fprintf(stderr,"temp[0]=%f %f %f %f %f ntrace=%f\n",temp[0],s,r,h,x,temp[14]);
sf_floatwrite(temp,15,Fout);
}
}
sf_close();
return 0;
}
开发者ID:1014511134,项目名称:src,代码行数:54,代码来源:Mgenheaderallreceiver.c
示例11: main
int main(int argc, char* argv[])
{
int nx, nf, ny, i2, n2, lag;
bool each, trans;
float *xx, *yy, *ff;
sf_file in, out, filt;
sf_init(argc,argv);
in = sf_input("in");
out = sf_output("out");
filt = sf_input("filt");
if (SF_FLOAT != sf_gettype(in) ||
SF_FLOAT != sf_gettype(filt)) sf_error("Need float input");
if (!sf_histint(in,"n1",&nx)) sf_error("No n1= in input");
n2 = sf_leftsize(in,1);
if (!sf_histint(filt,"n1",&nf)) sf_error("No n1= in filtin");
xx = sf_floatalloc(nx);
ff = sf_floatalloc(nf);
if (!sf_getbool("trans",&trans)) trans=false;
/* if y, transient convolution; if n, internal */
if (!sf_getbool("each",&each)) each=false;
/* if y, new filter for each trace */
if (!sf_getint("lag",&lag)) lag=1;
/* lag for internal convolution */
ny = trans? (nx+nf-1)*(nx+nf-1): nx;
yy = sf_floatalloc(ny);
if (trans){
sf_putint(out,"n1",nx+nf-1);
sf_putint(out,"n2",nx+nf-1);
}
if (!each) sf_floatread (ff,nf,filt);
for (i2=0; i2 < n2; i2++) {
if (each) sf_floatread (ff,nf,filt);
sf_floatread (xx,nx,in);
if (trans) {
tcai1_ns_init(nf,ff);
tcai1_ns_lop (false, false,nx,ny,xx,yy);
} else {
icai1_init(nf,ff,lag);
icai1_lop (false, false,nx,ny,xx,yy);
}
sf_floatwrite (yy,ny,out);
}
exit(0);
}
开发者ID:fernandovr89,项目名称:fvillanu,代码行数:53,代码来源:Mtnsconv.c
示例12: main
int main(int argc, char* argv[])
{
sf_file out;
FILE *tiffin;
TIFF *tiffout;
char *tiffname, buf[BUFSIZ];
unsigned char *grey;
int n1, i2, n2, nbuf;
short nc;
sf_init(argc,argv);
out = sf_output("out");
sf_settype(out,SF_UCHAR);
fclose(sf_tempfile(&tiffname,"w"));
tiffin = fopen(tiffname,"wb");
while (1) {
nbuf = fread(buf,1,BUFSIZ,stdin);
if (nbuf <= 0) break;
fwrite(buf,1,nbuf,tiffin);
}
fclose(tiffin);
tiffout = TIFFOpen(tiffname,"rb");
/* Find the width and height of the image */
TIFFGetField(tiffout, TIFFTAG_IMAGEWIDTH, &n1);
TIFFGetField(tiffout, TIFFTAG_IMAGELENGTH, &n2);
TIFFGetField(tiffout,TIFFTAG_SAMPLESPERPIXEL,&nc);
if (1==nc) {
sf_putint(out,"n1",n1);
sf_putint(out,"n2",n2);
} else {
sf_putint(out,"n1",nc);
sf_putint(out,"n2",n1);
sf_putint(out,"n3",n2);
}
grey = sf_ucharalloc(n1*nc);
for (i2 = 0; i2 < n2; i2++) {
if (TIFFReadScanline(tiffout, grey, i2, 0) < 0)
sf_error("Trouble reading TIFF file");
sf_ucharwrite(grey,n1*nc,out);
}
TIFFClose(tiffout);
unlink(tiffname);
exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:53,代码来源:_tif2byte.c
示例13: main
int main(int argc, char* argv[])
{
int ix, iy, nx, ny;
float dx, dy, zx, zy, x, y, *trace;
sf_file angle;
sf_init(argc,argv);
angle=sf_output("out");
sf_setformat(angle,"native_float");
if (!sf_getint("nx",&nx)) nx=451;
if (!sf_getint("ny",&ny)) ny=451;
if (!sf_getfloat("dx",&dx)) dx=0.1;
if (!sf_getfloat("dy",&dy)) dy=0.1;
if (!sf_getfloat("zx",&zx)) zx=0.;
if (!sf_getfloat("zy",&zy)) zy=0.;
zx = tanf(SF_PI*zx/180.);
zy = tanf(SF_PI*zy/180.);
sf_putint(angle,"n1",2*nx-1);
sf_putfloat(angle,"o1",-(nx-1)*dx);
sf_putfloat(angle,"d1",dx);
sf_putstring(angle,"label1","In-line Offset Slope");
sf_putstring(angle,"unit1","degrees");
sf_putint(angle,"n2",2*ny-1);
sf_putfloat(angle,"o2",-(ny-1)*dy);
sf_putfloat(angle,"d2",dy);
sf_putstring(angle,"label2","Cross-line Offset Slope");
sf_putstring(angle,"unit2","degrees");
trace = sf_floatalloc(2*nx-1);
for (iy=-ny+1; iy < ny; iy++) {
y = tanf(iy*dy*SF_PI/180.);
for (ix=-nx+1; ix < nx; ix++) {
x = tanf(ix*dx*SF_PI/180.);
x = x*x*(1.+zx*zx) + 2.*x*y*zx*zy + y*y*(1.+zy*zy);
x /= (1.+zx*zx+zy*zy);
if (x > 0.) {
trace[ix+nx-1] = atanf(sqrtf(x)) * 180./SF_PI;
} else {
trace[ix+nx-1] = -1.;
}
}
sf_floatwrite(trace,2*nx-1,angle);
}
exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:53,代码来源:Mangle2.c
示例14: putf
void putf(sf_file so1, int nx, int nz, float dx, float dz)
{
sf_putint (so1, "n3", 1);
sf_putint (so1, "n2", nx);
sf_putint (so1, "n1", nz);
sf_putfloat (so1, "d3", 0);
sf_putfloat (so1, "d2", dx);
sf_putfloat (so1, "d1", dz);
sf_putfloat (so1, "o3", 0);
sf_putfloat (so1, "o2", 0);
sf_putfloat (so1, "o1", 0);
}
开发者ID:1014511134,项目名称:src,代码行数:12,代码来源:Mreadsample.c
示例15: sfDoubleWrite2d
void sfDoubleWrite2d(const char *fn, const double *dat, int n1, int n2,
float d1, float d2, float o1, float o2) {
sf_file f = sf_output(fn);
sf_putint(f, "n1", n1);
sf_putint(f, "n2", n2);
sf_putfloat(f, "d1", d1);
sf_putfloat(f, "d2", d2);
sf_putfloat(f, "o1", o1);
sf_putfloat(f, "o2", o2);
std::vector<float> tmp(dat, dat + n1 * n2);
sf_floatwrite(&tmp[0], n1 * n2, f);
}
开发者ID:conghui,项目名称:swfwi,代码行数:13,代码来源:sfutil.cpp
示例16: main
int main(int argc, char* argv[])
{
int n1, ia, na, ib, nb;
float a0, b0, a1, b1, da, db, a, b, *trace, *filt;
sf_file inp, out;
sf_init(argc,argv);
inp = sf_input("in");
out = sf_output("out");
if (!sf_histint(inp,"n1",&n1)) sf_error("No n1= in input");
trace = sf_floatalloc(n1);
filt = sf_floatalloc(n1);
if (!sf_getint("na",&na)) na=1;
if (!sf_getint("nb",&nb)) nb=1;
if (!sf_getfloat("a0",&a0)) sf_error("Need a0=");
if (!sf_getfloat("b0",&b0)) sf_error("Need b0=");
if (!sf_getfloat("a1",&a1)) a1=a0;
if (!sf_getfloat("b1",&b1)) b1=b0;
da = (1 >= na)?0.: (a1-a0)/(na-1);
db = (1 >= nb)?0.: (b1-b0)/(nb-1);
sf_putint(out,"n2",na);
sf_putint(out,"n3",nb);
sf_putfloat(out,"o2",a0);
sf_putfloat(out,"o3",b0);
sf_putfloat(out,"d2",da);
sf_putfloat(out,"d3",db);
sf_floatread(trace,n1,inp);
for (ib=0; ib < nb; ib++) {
b = b0 + ib*db;
for (ia=0; ia < na; ia++) {
a = a0 + ia*da;
locov_init(a,b);
locov_filt(n1,trace,filt);
sf_floatwrite(filt,n1,out);
}
}
exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:49,代码来源:Mlocov.c
示例17: main
int main(int argc, char* argv[])
{
float x; /* trace value */
int ns=512; /* number of samples */
int ntr=8; /* number of traces */
int dtime=16; /* one way time in samples through "ocean" layer */
float rbot=0.8; /* reflection strength of "ocean" bottom */
int h=100; /* location in samples of two way reverb train */
float amp=0.2; /* strength of reflector */
int loc=170; /* location of reflector on trace 1 in time samples */
int dip=12; /* dip of reflector in time samples */
int i, j, k, sgn;
float *trace;
sf_file traces;
sf_init(argc,argv);
traces = sf_output("out");
sf_setformat(traces,"native_float");
sf_putint(traces,"n1",ns);
sf_putint(traces,"n2",ntr);
sf_putfloat(traces,"o1",0);
sf_putfloat(traces,"d1",0.004);
sf_putfloat(traces,"o2",1);
sf_putfloat(traces,"d2",1);
sf_putstring(traces,"label1","Time");
sf_putstring(traces,"unit1","s");
sf_putstring(traces,"label2","Trace");
trace = sf_floatalloc(ns);
for (j = 0; j < ntr; j++) {
for (i = 0; i < ns; i++) {
if (i >= h && ((i-h) % dtime == 0)) {
k = (i-h)/dtime;
sgn = (ISODD(k) ? -1 : 1);
x = sgn * (k+1) * powf(rbot, k);
} else {
x = 0.0f;
}
if (i == loc + j*dip) x += amp;
trace[i] = x;
}
sf_floatwrite(trace,ns,traces);
}
exit(0);
}
开发者ID:krushev36,项目名称:src,代码行数:49,代码来源:traces.c
示例18: puthead2kx
void puthead2kx(sf_file Fo, int n1, int n2, float d1, float d2, float o1, float o2)
/*< put head for (kx,kz) domain float-type 2D data sets>*/
{
/* Read/Write axes */
sf_putint(Fo,"n1",n1);
sf_putint(Fo,"n2",n2);
sf_putfloat(Fo,"d1",d1);
sf_putfloat(Fo,"d2",d2);
sf_putfloat(Fo,"o1",o1);
sf_putfloat(Fo,"o2",o2);
sf_putstring(Fo,"label1","kz");
sf_putstring(Fo,"label2","kx");
sf_putstring(Fo,"unit1","2*pi/m");
sf_putstring(Fo,"unit2","2*pi/m");
}
开发者ID:1014511134,项目名称:src,代码行数:15,代码来源:puthead.c
示例19: main
int main(int argc, char* argv[])
{
int nt, nd;
float dist;
float **points, *point;
kd_node tree, near;
sf_file inp, out;
sf_init(argc,argv);
inp = sf_input("in");
out = sf_output("out");
if (SF_FLOAT != sf_gettype(inp)) sf_error("Need float input");
if (!sf_histint(inp,"n1",&nd)) sf_error("No n1= in input");
if (!sf_histint(inp,"n2",&nt)) sf_error("No n2= in input");
sf_putint(out,"n2",1);
points = sf_floatalloc2(nd,nt);
sf_floatread(points[0],nd*nt,inp);
tree = kd_tree(points,nt,nd);
point = sf_floatalloc(nd);
if (!sf_getfloats("point",point,nd)) sf_error("Need point=");
dist = SF_HUGE;
kd_nearest(tree, point, 0, nd, &near, &dist);
sf_floatwrite(kd_coord(near),nd,out);
exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:32,代码来源:Mkdtree.c
示例20: sfFloatWrite1d
void sfFloatWrite1d(const char *fn, const float *dat, int n1, float d1, float o1) {
sf_file f = sf_output(fn);
sf_putint(f, "n1", n1);
sf_putfloat(f, "d1", d1);
sf_putfloat(f, "o1", o1);
sf_floatwrite(const_cast<float *>(dat), n1, f);
}
开发者ID:conghui,项目名称:swfwi,代码行数:7,代码来源:sfutil.cpp
注:本文中的sf_putint函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论