From: Dimitrios Eftaxiopoulos Date: Thu, 30 Dec 2010 13:54:26 +0000 (+0200) Subject: Update debian/changelog X-Git-Tag: archive/raspbian/2.5-2+rpi1^2~253 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=997340bed2875f1d7ff2dce74552b052f8a7daa5;p=mathgl.git Update debian/changelog --- diff --git a/.pc/applied-patches b/.pc/applied-patches index 18cd0d7..1287af9 100644 --- a/.pc/applied-patches +++ b/.pc/applied-patches @@ -4,3 +4,4 @@ dircategory-and-direntry-mgl-ru-texi.patch dircategory-and-direntry-mgl-en-texi.patch correct-spelling-error-in-nympy-i.patch createpngdirectory.patch +mgl-mgl_data_io_cpp.patch diff --git a/.pc/correct-spelling-error-in-nympy-i.patch/.timestamp b/.pc/correct-spelling-error-in-nympy-i.patch/.timestamp new file mode 100644 index 0000000..e69de29 diff --git a/.pc/createpngdirectory.patch/.timestamp b/.pc/createpngdirectory.patch/.timestamp new file mode 100644 index 0000000..e69de29 diff --git a/.pc/dircategory-and-direntry-mathgl-en-texi.patch/.timestamp b/.pc/dircategory-and-direntry-mathgl-en-texi.patch/.timestamp new file mode 100644 index 0000000..e69de29 diff --git a/.pc/dircategory-and-direntry-mathgl-ru-texi.patch/.timestamp b/.pc/dircategory-and-direntry-mathgl-ru-texi.patch/.timestamp new file mode 100644 index 0000000..e69de29 diff --git a/.pc/dircategory-and-direntry-mgl-en-texi.patch/.timestamp b/.pc/dircategory-and-direntry-mgl-en-texi.patch/.timestamp new file mode 100644 index 0000000..e69de29 diff --git a/.pc/dircategory-and-direntry-mgl-ru-texi.patch/.timestamp b/.pc/dircategory-and-direntry-mgl-ru-texi.patch/.timestamp new file mode 100644 index 0000000..e69de29 diff --git a/.pc/mgl-mgl_data_io_cpp.patch/.timestamp b/.pc/mgl-mgl_data_io_cpp.patch/.timestamp new file mode 100644 index 0000000..e69de29 diff --git a/.pc/mgl-mgl_data_io_cpp.patch/mgl/mgl_data_io.cpp b/.pc/mgl-mgl_data_io_cpp.patch/mgl/mgl_data_io.cpp new file mode 100644 index 0000000..caf525c --- /dev/null +++ b/.pc/mgl-mgl_data_io_cpp.patch/mgl/mgl_data_io.cpp @@ -0,0 +1,1165 @@ +/*************************************************************************** + * mgl_data_io.cpp is part of Math Graphic Library + * Copyright (C) 2007 Alexey Balakin * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include +#include +#include +#include +#include +#ifdef HAVE_HDF5 +#include +#endif +#ifdef HAVE_HDF4 +#define intf hdf4_intf +#include +#undef intf +#endif + +#ifndef WIN32 +#include +#endif + +#include "mgl/mgl_eval.h" +#include "mgl/mgl_data.h" + +//#define isn(ch) ((ch)<' ' && (ch)!='\t') +#define isn(ch) ((ch)=='\n') +//----------------------------------------------------------------------------- +void mglData::Set(const char *v,int NX,int NY,int NZ) +{ + if(NX<1 || NY <1 || NZ<1) return; + register int i,j=0,m=NX*NY*NZ; + mreal *b = new mreal[m]; memset(b,0,m*sizeof(mreal)); + for(i=0;isize<1) return; + Create(v->size); + for(long i=0;idata[i*v->stride]; +#endif +} +//----------------------------------------------------------------------------- +void mglData::Set(gsl_matrix *m) +{ +#ifndef NO_GSL + if(!m || m->size1<1 || m->size2<1) return; + Create(m->size1,m->size2); + register long i,j; + for(i=0;idata[i * m->tda + j]; +#endif +} +//----------------------------------------------------------------------------- +void mglData::Set(const float *A,int NX,int NY,int NZ) +{ + if(NX<=0 || NY<=0 || NZ<=0) return; + Create(NX,NY,NZ); +#if(MGL_USE_DOUBLE==1) + for(long i=0;i=nx && nz>=nx) for(i=0;i=nx) for(i=0;i1) // 3d data + { + n = xx.nx; m = xx.ny; l = xx.nz; + j = yy.nx*yy.ny*yy.nz; if(j>1 && j!=n*m*l) return d; // wrong sizes + k = zz.nx*zz.ny*zz.nz; if(k>1 && k!=n*m*l) return d; // wrong sizes + ix = true; iy = j>1; iz = k>1; + } + else if(yy.nz>1) + { + n = yy.nx; m = yy.ny; l = yy.nz; + j = xx.nx*xx.ny*xx.nz; if(j>1 && j!=n*m*l) return d; // wrong sizes + k = zz.nx*zz.ny*zz.nz; if(k>1 && k!=n*m*l) return d; // wrong sizes + iy = true; ix = j>1; iz = k>1; + } + else if(zz.nz>1) + { + n = zz.nx; m = zz.ny; l = zz.nz; + j = yy.nx*yy.ny*yy.nz; if(j>1 && j!=n*m*l) return d; // wrong sizes + k = xx.nx*xx.ny*xx.nz; if(k>1 && k!=n*m*l) return d; // wrong sizes + iz = true; iy = j>1; ix = k>1; + } + else if(xx.ny>1) // 2d data + { + n = xx.nx; m = xx.ny; l = 1; + j = yy.nx*yy.ny; if(j>1 && j!=n*m) return d; // wrong sizes + k = zz.nx*zz.ny; if(k>1 && k!=n*m) return d; // wrong sizes + ix = true; iy = j>1; iz = k>1; + } + else if(yy.ny>1) + { + n = yy.nx; m = yy.ny; l = 1; + j = xx.nx*xx.ny; if(j>1 && j!=n*m) return d; // wrong sizes + k = zz.nx*zz.ny; if(k>1 && k!=n*m) return d; // wrong sizes + iy = true; ix = j>1; iz = k>1; + } + else if(zz.ny>1) + { + n = zz.nx; m = zz.ny; l = 1; + j = yy.nx*yy.ny; if(j>1 && j!=n*m) return d; // wrong sizes + k = xx.nx*xx.ny; if(k>1 && k!=n*m) return d; // wrong sizes + iz = true; iy = j>1; ix = k>1; + } + if(n*m*l>1) // this is 2d or 3d data + { + d.Create(n,m,l); + for(i0=0;i0=nx)i=nx-1; + j = int((iy?yy.a[i0]:yy.a[0])+0.5); if(j<0)j=0; if(j>=ny)j=ny-1; + k = int((iz?zz.a[i0]:zz.a[0])+0.5); if(k<0)k=0; if(k>=nz)k=nz-1; + d.a[i0] = a[i+nx*(j+ny*k)]; + } + return d; + } + // this is 1d data -> try as normal SubData() + if(xx.nx>1 || xx.a[0]>=0) { n=xx.nx; ix=true; } + else { n=nx; ix=false; } + if(yy.nx>1 || yy.a[0]>=0) { m=yy.nx; iy=true; } + else { m=ny; iy=false; } + if(zz.nx>1 || zz.a[0]>=0) { l=zz.nx; iz=true; } + else { l=nz; iz=false; } + d.Create(n,m,l); + for(i=0;i=nx)x=nx-1; + y = iy?int(yy.a[j]+0.5):j; if(y<0)y=0; if(y>=ny)y=ny-1; + z = iz?int(zz.a[k]+0.5):k; if(z<0)z=0; if(z>=nz)z=nz-1; + d.a[i+n*(j+m*k)] = a[x+nx*(y+ny*z)]; + } + if(m==1) { d.ny=d.nz; d.nz=1; }// "squeeze" dimensions + if(n==1) { d.nx=d.ny; d.ny=d.nz; d.nz=1; d.NewId();} + return d; +} +//----------------------------------------------------------------------------- +mglData mglData::SubData(int xx,int yy,int zz) const +{ + mglData x,y,z; + x.a[0]=xx; y.a[0]=yy; z.a[0]=zz; + return SubData(x,y,z); +} +//----------------------------------------------------------------------------- +mglData mglData::Column(const char *eq) +{ + mglFormula f(eq); + mglData d; + d.Create(ny,nz); + mreal var[MGL_VS]; + memset(var,0,('z'-'a')*sizeof(mreal)); + register long i,j; + for(i=0;i='a' && id[j]<='z') + var[id[j]-'a'] = a[j+nx*i]; + d.a[i] = f.Calc(var); + } + return d; +} +//----------------------------------------------------------------------------- +void mglData::SetColumnId(const char *ids) +{ + NewId(); // clearing + be sure about correct length + if(ids) for(long i=0;i=nz && nz>1)) for(long k=0;k1) // äëÿ 3D -- ïëîñêîñòü + { + for(long i=0;i0) + { + if(m=0;i--) if(buf[i]>' ') break; + buf[i+1]=0; nb = i; // remove tailing spaces + for(i=0;i' ' && !first) first=true; + if(first && (ch==' ' || ch=='\t') && buf[i+1]>' ') k++; + } + first = false; + for(i=0;i0 ? mx:1; ny = my>0 ? my:1; nz = mz>0 ? mz:1; + if(a) { delete []a; delete []id; } + a = new mreal[nx*ny*nz]; + id = new char[nx]; + memset(a,0,nx*ny*nz*sizeof(mreal)); + memset(id,0,nx*sizeof(char)); +} +//----------------------------------------------------------------------------- +bool mglData::Read(const char *fname,int mx,int my,int mz) +{ + if(mx<=0 || my<=0 || mz<=0) return false; + gzFile fp = gzopen(fname,"r"); + if(!fp) return false; + Create(mx,my,mz); + char *buf = mgl_read_gz(fp); + long nb = strlen(buf); gzclose(fp); + + register long i=0, j=0, k=0; + while(j0 || buf[j+1]!='#') // this is columns id + while(!isn(buf[j]) && j='a' && buf[j]<='z') + id[k++] = buf[j]; + j++; + } + } +// while(buf[j]!='\n' && j' ' && j=nx*ny*nz) break; + } + free(buf); + return true; +} +//----------------------------------------------------------------------------- +bool mglData::ReadMat(const char *fname,int dim) +{ + if(dim<=0 || dim>3) return false; + gzFile fp = gzopen(fname,"r"); + if(!fp) return false; + nx = ny = nz = 1; NewId(); + char *buf = mgl_read_gz(fp); + long nb = strlen(buf); gzclose(fp); + + register long i=0,j=0; + while(j' ') j++; + } + else if(dim==2) + { + sscanf(buf+j,"%ld%ld",&nx,&ny); + while(buf[j]>' ' && j' ' && j' ' && j' ' && j' ' && j=nx*ny*nz) break; + while(buf[j]>' ' && j=nx || j<0 || j>=ny || k<0 || k>=nz; + if(not_ok) return 0; + return a[i+nx*(j+ny*k)]; +} +//----------------------------------------------------------------------------- +mglData mglData::Resize(int mx, int my, int mz, mreal x1, mreal x2, + mreal y1, mreal y2, mreal z1, mreal z2) const +{ + register long i,j,k; + mglData d; + mx = mx<1 ? 1:mx; my = my<1 ? 1:my; mz = mz<1 ? 1:mz; + d.Create(mx,my,mz); + mreal dx, dy, dz; + dx = mx>1 ? (x2-x1)/(mx-1):0; + dy = my>1 ? (y2-y1)/(my-1):0; + dz = mz>1 ? (z2-z1)/(mz-1):0; + for(i=0;ia[i] ? m : a[i]; + return m; +} +//----------------------------------------------------------------------------- +mreal mglData::Minimal() const +{ + register mreal m=1e10; + for(long i=0;ia[i]) + { m=a[i]; im=i%nx; jm=(i/nx)%ny; km=i/(nx*ny); } + return m; +} +//----------------------------------------------------------------------------- +mreal mglData::Maximal(mreal &x,mreal &y,mreal &z) const +{ + int im=-1,jm=-1,km=-1; + register long tm,i; + mreal m=Maximal(im,jm,km); + x=im; y=jm; z=km; + + if(nx>2) + { + if(im==0) im=1; + if(im==nx-1)im=nx-2; + x = (a[im+1]+a[im-1]-2*a[im])==0 ? im : im+(a[im+1]-a[im-1])/(a[im+1]+a[im-1]-2*a[im])/2; + } + if(ny>2) + { + if(jm==0) jm=1; + if(jm==ny-1)jm=ny-2; + i=nx; tm = jm*nx; + y = (a[tm+i]+a[tm-i]-2*a[tm])==0? jm : jm+(a[tm+i]-a[tm-i])/(a[tm+i]+a[tm-i]-2*a[tm])/2; + } + if(nz>2) + { + if(km==0) km=1; + if(km==nz-1)km=nz-2; + i=nx*ny; tm = km*i; + z = (a[tm+i]+a[tm-i]-2*a[tm])==0? km : km+(a[tm+i]-a[tm-i])/(a[tm+i]+a[tm-i]-2*a[tm])/2; + } + return m; +} +//----------------------------------------------------------------------------- +mreal mglData::Minimal(mreal &x,mreal &y,mreal &z) const +{ + int im=-1,jm=-1,km=-1; + register long tm,i; + mreal m=Minimal(im,jm,km); + x=im; y=jm; z=km; + if(nx>2) + { + if(im==0) im=1; + if(im==nx-1)im=nx-2; + x = im+(a[im+1]-a[im-1])/(a[im+1]+a[im-1]-2*a[im])/2; + } + if(ny>2) + { + if(jm==0) jm=1; + if(jm==ny-1)jm=ny-2; + i=nx; tm = jm*nx; + y = jm+(a[tm+i]-a[tm-i])/(a[tm+i]+a[tm-i]-2*a[tm])/2; + } + if(nz>2) + { + if(km==0) km=1; + if(km==nz-1)km=nz-2; + i=nx*ny; tm = km*i; + z = km+(a[tm+i]-a[tm-i])/(a[tm+i]+a[tm-i]-2*a[tm])/2; + } + return m; +} +//----------------------------------------------------------------------------- +void mglData::Modify(const char *eq,int dim) +{ + long i,j,k; + mreal y,z,dx=nx>1?1/(nx-1.):0,dy=ny>1?1/(ny-1.):0, *aa; + mglFormula eqs(eq); + if(dim<0) dim=0; + if(nz>1) // 3D array + { + for(k=dim;kdim+1) ? (k-dim)/(nz-dim-1.) : 0; + aa = a+nx*ny*k; +//#pragma omp parallel for + for(i=0;idim+1 ? 1/(ny-dim-1.) : 0; + for(j=dim;j'z') dir='x'; + for(k=0;k1 ? i/(nx-1.):0; + if(dir=='y') x = ny>1 ? j/(ny-1.):0; + if(dir=='z') x = nz>1 ? k/(nz-1.):0; + a[i+nx*(j+ny*k)] = x1+(x2-x1)*x; + } +} +//----------------------------------------------------------------------------- +void mglData::Norm(mreal v1,mreal v2,bool sym,int dim) +{ + long i,s,nn=nx*ny*nz; + mreal a1=1e20,a2=-1e20,v; + if(nz>1) s = dim*nx*ny; + else s = dim*ny; + for(i=s;ia[i] ? a2 : a[i]); + } + if(a1==a2) { if(a1!=0) a1=0.; else a2=1; } + if(v1>v2) { v=v1; v1=v2; v2=v; } // swap if uncorrect + if(sym) // use symmetric + { + v2 = -v1>v2 ? -v1:v2; v1 = -v2; + a2 = -a1>a2 ? -a1:a2; a1 = -a2; + } + for(i=s;i=nx) rx=nx-1; if(rx<1) rx=1; + if(ry>=ny) ry=ny-1; if(ry<1) ry=1; + if(rz>=nz) rz=nz-1; if(rz<1) rz=1; + // new sizes + kx = 1+(nx-1)/rx; ky = 1+(ny-1)/ry; kz = 1+(nz-1)/rz; + b = new mreal[kx*ky*kz]; + if(!smooth) for(i=0;i1 || (ny>1 && b.ny>1) || b.nz>1) return d; + long n1=ny,n2=b.nx; + bool dim2=true; + if(ny==1) { n1 = b.nx; n2 = b.ny; dim2 = false; } + d.Create(nx,n1,n2); + register long i,j; + if(dim2) n1=nx*ny; else { n1=nx; n2=b.nx*b.ny; } + for(i=0;i2 || n1==0) return; + long mx,my,mz; + mreal *b=0; + register long i,j; + if(n1>0) // extend to higher dimension(s) + { + n2 = n2>0 ? n2:1; + mx = nx; my = ny>1?ny:n1; mz = ny>1 ? n1 : n2; + b = new mreal[mx*my*mz]; + if(ny>1) for(i=0;i0 && ny==1) mz = n2; + b = new mreal[mx*my*mz]; + if(n2<0) for(i=0;i0 && ny==1) for(i=0;i1?1/(nx-1.):0,dy=ny>1?1/(ny-1.):0,dz=nz>1?1/(nz-1.):0; + mglFormula eqs(eq); + for(k=0;k1?1/(nx-1.):0,dy=ny>1?1/(ny-1.):0,dz=nz>1?1/(nz-1.):0; + mglFormula eqs(eq); + for(k=0;knx*v->ny*v->nz!=nx*ny*nz) return; + if(w && w->nx*w->ny*w->nz!=nx*ny*nz) return; + long i,j,k,i0; + mreal x,y,z,dx=nx>1?(r2.x-r1.x)/(nx-1.):0; + mreal dy=ny>1?(r2.y-r1.y)/(ny-1.):0; + mreal dz=nz>1?(r2.z-r1.z)/(nz-1.):0; + mglFormula eqs(eq); + for(k=0;ka[i0]:0, w?w->a[i0]:0); + } +} +//----------------------------------------------------------------------------- +void mglData::ReadHDF4(const char *fname,const char *data) +{ +#ifdef HAVE_HDF4 + int sd = SDstart(fname,DFACC_READ), nn, i; + if(sd==-1) return; // is not a HDF4 file + char name[64]; + SDfileinfo(sd,&nn,&i); + for(i=0;i0 && !rewrite) hf = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); + else hf = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if(hf<0) return; + if(nz==1 && ny == 1) { rank = 1; dims[0] = nx; } + else if(nz==1) { rank = 2; dims[0] = ny; dims[1] = nx; } + else { rank = 3; dims[0] = nz; dims[1] = ny; dims[2] = nx; } + hs = H5Screate_simple(rank, dims, 0); +#if(MGL_USE_DOUBLE==1) +#ifndef H5_USE_16_API + hd = H5Dcreate(hf, data, H5T_NATIVE_DOUBLE, hs, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); +#else /* ! HAVE_HDF5_18 */ + hd = H5Dcreate(hf, data, H5T_NATIVE_DOUBLE, hs, H5P_DEFAULT); +#endif /* HAVE_HDF5_18 */ + H5Dwrite(hd, H5T_NATIVE_DOUBLE, hs, hs, H5P_DEFAULT, a); +#else +#ifndef H5_USE_16_API + hd = H5Dcreate(hf, data, H5T_NATIVE_FLOAT, hs, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); +#else /* ! HAVE_HDF5_18 */ + hd = H5Dcreate(hf, data, H5T_NATIVE_FLOAT, hs, H5P_DEFAULT); +#endif /* HAVE_HDF5_18 */ + H5Dwrite(hd, H5T_NATIVE_FLOAT, hs, hs, H5P_DEFAULT, a); +#endif + H5Dclose(hd); H5Sclose(hs); H5Fclose(hf); +} +//----------------------------------------------------------------------------- +void mglData::ReadHDF(const char *fname,const char *data) +{ + hid_t hf,hd,hs; + hsize_t dims[3]; + long rank, res = H5Fis_hdf5(fname); + if(res<=0) { ReadHDF4(fname,data); return; } + hf = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT); if(hf<0) return; +#ifndef H5_USE_16_API + hd = H5Dopen(hf,data,H5P_DEFAULT); +#else + hd = H5Dopen(hf,data); +#endif + if(hd<0) return; + hs = H5Dget_space(hd); + rank = H5Sget_simple_extent_ndims(hs); + if(rank>0 && rank<=3) + { + H5Sget_simple_extent_dims(hs,dims,0); + nx = ny = nz = 1; + switch(rank) + { + case 1: nx = dims[0]; break; + case 2: nx = dims[1]; ny = dims[0]; break; + case 3: nx = dims[2]; ny = dims[1]; nz = dims[0]; break; + } + delete []a; a = new mreal[nx*ny*nz]; NewId(); +#if(MGL_USE_DOUBLE==1) + H5Dread(hd, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, a); +#else + H5Dread(hd, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, a); +#endif + } + H5Dclose(hd); H5Sclose(hs); H5Fclose(hf); +} +#else +void mglData::SaveHDF(const char *,const char *,bool ) const {} +void mglData::ReadHDF(const char *,const char *) {} +#endif +//----------------------------------------------------------------------------- +bool mgl_add_file(long &kx,long &ky, long &kz, mreal *&b, mglData &d,bool as_slice) +{ + if(as_slice && d.nz==1) + { + if(kx==d.nx && d.ny==1) + { + b = (mreal *)realloc(b,kx*(ky+1)*sizeof(mreal)); + memcpy(b+kx*ky,d.a,kx*sizeof(mreal)); ky++; + } + else if(kx==d.nx && ky==d.ny) + { + b = (mreal *)realloc(b,kx*ky*(kz+1)*sizeof(mreal)); + memcpy(b+kx*ky*kz,d.a,kx*ky*sizeof(mreal)); kz++; + } + else return false; + } + else + { + if(d.ny*d.nz==1 && ky*kz==1) + { + b = (mreal *)realloc(b,(kx+d.nx)*sizeof(mreal)); + memcpy(b+kx,d.a,d.nx*sizeof(mreal)); kx+=d.nx; + } + else if(kx==d.nx && kz==1 && d.nz==1) + { + b = (mreal *)realloc(b,kx*(ky+d.ny)*sizeof(mreal)); + memcpy(b+kx*ky,d.a,kx*d.ny*sizeof(mreal)); ky+=d.ny; + } + else if(kx==d.nx && ky==d.ny) + { + b = (mreal *)realloc(b,kx*kx*(kz+d.nz)*sizeof(mreal)); + memcpy(b+kx*ky*kz,d.a,kx*ky*d.nz*sizeof(mreal)); kz+=d.nz; + } + else return false; + } + return true; +} +//----------------------------------------------------------------------------- +bool mglData::ReadRange(const char *templ, mreal from, mreal to, mreal step, bool as_slice) +{ + mglData d; + mreal t = from, *b; + long kx,ky,kz; + char *fname = new char[strlen(templ)+20]; + + //read first file + do{ sprintf(fname,templ,t); t+= step; } while(!d.Read(fname) && t<=to); + + if(t>to) return false; + kx = d.nx; ky = d.ny; kz = d.nz; + b = (mreal *)malloc(kx*ky*kz*sizeof(mreal)); + memcpy(b,d.a,kx*ky*kz*sizeof(mreal)); + + // read other files + for(;t<=to;t+=step) + { + sprintf(fname,templ,t); + if(d.Read(fname)) + if(!mgl_add_file(kx,ky,kz,b,d,as_slice)) + return false; + } + Set(b,kx,ky,kz); + delete []fname; free(b); + return true; +} +//----------------------------------------------------------------------------- +bool mglData::ReadAll(const char *templ, bool as_slice) +{ +#ifndef WIN32 + mglData d; + glob_t res; + unsigned long i; + mreal *b; + long kx,ky,kz; + char *fname = new char[256]; + glob (templ, GLOB_TILDE, NULL, &res); + + //read first file + for(i=0;i=res.gl_pathc) { delete []fname; return false; } + kx = d.nx; ky = d.ny; kz = d.nz; + b = (mreal *)malloc(kx*ky*kz*sizeof(mreal)); + memcpy(b,d.a,kx*ky*kz*sizeof(mreal)); + + for(;i &d) +{ Create(d.size()); for(long i=0;i &d) +{ Create(d.size()); for(long i=0;i &d) +{ Create(d.size()); for(long i=0;i Sun, 12 Dec 2010 19:13:00 +0200 + mathgl (1.11.0.1-1) experimental; urgency=low * Correct debian/copyright file. diff --git a/debian/patches/createpngdirectory.patch b/debian/patches/createpngdirectory.patch index 0e08473..439dc25 100644 --- a/debian/patches/createpngdirectory.patch +++ b/debian/patches/createpngdirectory.patch @@ -1,9 +1,7 @@ Create /png directory in the topmost source directory -diff --git a/texinfo/png/Makefile.am b/texinfo/png/Makefile.am -index 80e5143..1d28940 100644 --- a/texinfo/png/Makefile.am +++ b/texinfo/png/Makefile.am -@@ -7,5 +7,6 @@ CLEANFILES = $(png_images) +@@ -7,5 +7,6 @@ $(png_images): hotdogs.pts # $(top_builddir)/examples/mgl_example $(top_builddir)/examples/mgl_example -kind=${@:.png=} diff --git a/debian/patches/mgl-mgl_data_io_cpp.patch b/debian/patches/mgl-mgl_data_io_cpp.patch new file mode 100644 index 0000000..10c17e9 --- /dev/null +++ b/debian/patches/mgl-mgl_data_io_cpp.patch @@ -0,0 +1,299 @@ +Upstream patch for FTBFS on i386 +--- a/mgl/mgl_data_io.cpp ++++ b/mgl/mgl_data_io.cpp +@@ -2,33 +2,33 @@ + * mgl_data_io.cpp is part of Math Graphic Library + * Copyright (C) 2007 Alexey Balakin * + * * +- * This program is free software; you can redistribute it and/or modify * +- * it under the terms of the GNU Library General Public License as * +- * published by the Free Software Foundation; either version 3 of the * +- * License, or (at your option) any later version. * +- * * +- * This program is distributed in the hope that it will be useful, * +- * but WITHOUT ANY WARRANTY; without even the implied warranty of * +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +- * GNU General Public License for more details. * +- * * +- * You should have received a copy of the GNU Library General Public * +- * License along with this program; if not, write to the * +- * Free Software Foundation, Inc., * +- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * +- ***************************************************************************/ ++ * This program is free software; you can redistribute it and/or modify * ++ * it under the terms of the GNU Library General Public License as * ++ * published by the Free Software Foundation; either version 3 of the * ++ * License, or (at your option) any later version. * ++ * * ++ * This program is distributed in the hope that it will be useful, * ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of * ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * ++ * GNU General Public License for more details. * ++ * * ++ * You should have received a copy of the GNU Library General Public * ++ * License along with this program; if not, write to the * ++ * Free Software Foundation, Inc., * ++ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ++ ***************************************************************************/ + #include + #include + #include + #include +-#include ++#include + #ifdef HAVE_HDF5 + #include + #endif + #ifdef HAVE_HDF4 +-#define intf hdf4_intf +-#include +-#undef intf ++#define intf hdf4_intf ++#include ++#undef intf + #endif + + #ifndef WIN32 +@@ -302,17 +302,17 @@ + } + fclose(fp); + } +-//----------------------------------------------------------------------------- +-char *mgl_read_gz(gzFile fp) +-{ +- long size=1024,n=0,m; +- char *buf=(char*)malloc(size); +- while((m=gzread(fp,buf+size*n,size))>0) +- { +- if(m0) ++ { ++ if(m=0;i--) if(buf[i]>' ') break; +- buf[i+1]=0; nb = i; // remove tailing spaces ++ buf[i+1]=0; nb = i; // remove tailing spaces + for(i=0;i' ' && !first) first=true; +- if(first && (ch==' ' || ch=='\t') && buf[i+1]>' ') k++; ++ if(first && (ch==' ' || ch=='\t') && buf[i+1]>' ') k++; + } + first = false; + for(i=0;i' ' && j=nx*ny*nz) break; ++ a[i] = atof(s); ++ i++; if(i>=nx*ny*nz) break; + } + free(buf); + return true; +@@ -421,7 +421,7 @@ + gzFile fp = gzopen(fname,"r"); + if(!fp) return false; + nx = ny = nz = 1; NewId(); +- char *buf = mgl_read_gz(fp); ++ char *buf = mgl_read_gz(fp); + long nb = strlen(buf); gzclose(fp); + + register long i=0,j=0; +@@ -692,10 +692,10 @@ + { + for(k=dim;kdim+1) ? (k-dim)/(nz-dim-1.) : 0; +- aa = a+nx*ny*k; +-//#pragma omp parallel for +- for(i=0;idim+1) ? (k-dim)/(nz-dim-1.) : 0; ++ aa = a+nx*ny*k; ++//#pragma omp parallel for ++ for(i=0;idim+1 ? 1/(ny-dim-1.) : 0; +- for(j=dim;j * * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU Library General Public License as * - * published by the Free Software Foundation; either version 3 of the * - * License, or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ #include #include #include #include -#include +#include #ifdef HAVE_HDF5 #include #endif #ifdef HAVE_HDF4 -#define intf hdf4_intf -#include -#undef intf +#define intf hdf4_intf +#include +#undef intf #endif #ifndef WIN32 @@ -302,17 +302,17 @@ void mglData::Save(const char *fname,int ns) const } fclose(fp); } -//----------------------------------------------------------------------------- -char *mgl_read_gz(gzFile fp) -{ - long size=1024,n=0,m; - char *buf=(char*)malloc(size); - while((m=gzread(fp,buf+size*n,size))>0) - { - if(m0) + { + if(m=0;i--) if(buf[i]>' ') break; - buf[i+1]=0; nb = i; // remove tailing spaces + buf[i+1]=0; nb = i; // remove tailing spaces for(i=0;i' ' && !first) first=true; - if(first && (ch==' ' || ch=='\t') && buf[i+1]>' ') k++; + if(first && (ch==' ' || ch=='\t') && buf[i+1]>' ') k++; } first = false; for(i=0;i' ' && j=nx*ny*nz) break; + a[i] = atof(s); + i++; if(i>=nx*ny*nz) break; } free(buf); return true; @@ -421,7 +421,7 @@ bool mglData::ReadMat(const char *fname,int dim) gzFile fp = gzopen(fname,"r"); if(!fp) return false; nx = ny = nz = 1; NewId(); - char *buf = mgl_read_gz(fp); + char *buf = mgl_read_gz(fp); long nb = strlen(buf); gzclose(fp); register long i=0,j=0; @@ -692,10 +692,10 @@ void mglData::Modify(const char *eq,int dim) { for(k=dim;kdim+1) ? (k-dim)/(nz-dim-1.) : 0; - aa = a+nx*ny*k; -//#pragma omp parallel for - for(i=0;idim+1) ? (k-dim)/(nz-dim-1.) : 0; + aa = a+nx*ny*k; +//#pragma omp parallel for + for(i=0;idim+1 ? 1/(ny-dim-1.) : 0; - for(j=dim;j