From: Dimitrios Eftaxiopoulos Date: Mon, 22 Nov 2010 23:32:34 +0000 (+0200) Subject: Upstream source 1.11.0.1 imported X-Git-Tag: archive/raspbian/2.5-2+rpi1^2~26^2~47 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ea7d4d5679b26b51603ba6bf319046ca30e06fcf;p=mathgl.git Upstream source 1.11.0.1 imported --- diff --git a/ChangeLog.txt b/ChangeLog.txt index d2ad377..a4ae6e1 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +1.11.0.1 Released 15 November 2010 + - Bugfix for reading textual data files (mostly under win32). + - Docs update. + 1.11 Released 8 November 2010 - Add new plot Grad() -- gradient of scalar field by flow threads. - Add new plot QuadPlot() -- plot of irregular quadrangle mesh (like TriPlot()). diff --git a/FindMathGL.cmake b/FindMathGL.cmake new file mode 100644 index 0000000..79479c6 --- /dev/null +++ b/FindMathGL.cmake @@ -0,0 +1,80 @@ +# FindMathGL.cmake - Check for the presence of MathGL +# +# The following variables are set when MathGL is found: +# HAVE_MATHGL = Set to true, if all components of MathGL have been found. +# MATHGL_INCLUDES = Include path for the header files of MathGL +# MATHGL_LIBRARIES = Link these to use MathGL +# MATHGL_LFLAGS = Linker flags (optional) + +## ----------------------------------------------------------------------------- +## Search locations + +set (include_locations + /usr/include + /usr/local/include) + +set (lib_locations + /usr/local/lib64 + /usr/local/lib + /usr/lib64 + /usr/lib) + +## ----------------------------------------------------------------------------- +## Check for the header files + +find_path (MATHGL_INCLUDES mgl/mgl.h mgl/mgl_data.h + PATHS ${include_locations} + NO_DEFAULT_PATH) + +## ----------------------------------------------------------------------------- +## Check for the various libraries + +set (MATHGL_LIBRARIES "") + +## libmgl + +find_library (HAVE_LIBMGL mgl + PATHS ${lib_locations} + NO_DEFAULT_PATH) +if (HAVE_LIBMGL) + list (APPEND MATHGL_LIBRARIES ${HAVE_LIBMGL}) +endif (HAVE_LIBMGL) + +## ----------------------------------------------------------------------------- +## Actions taken when all components have been found + +if (MATHGL_INCLUDES AND MATHGL_LIBRARIES) + set (HAVE_MATHGL TRUE) +else (MATHGL_INCLUDES AND MATHGL_LIBRARIES) + set (HAVE_MATHGL FALSE) + if (NOT MATHGL_FIND_QUIETLY) + if (NOT MATHGL_INCLUDES) + message (STATUS "Unable to find MATHGL header files!") + endif (NOT MATHGL_INCLUDES) + if (NOT MATHGL_LIBRARIES) + message (STATUS "Unable to find MATHGL library files!") + endif (NOT MATHGL_LIBRARIES) + endif (NOT MATHGL_FIND_QUIETLY) +endif (MATHGL_INCLUDES AND MATHGL_LIBRARIES) + +if (HAVE_MATHGL) + if (NOT MATHGL_FIND_QUIETLY) + message (STATUS "Found components for MATHGL") + message (STATUS "MATHGL_INCLUDES = ${MATHGL_INCLUDES}") + message (STATUS "MATHGL_LIBRARIES = ${MATHGL_LIBRARIES}") + endif (NOT MATHGL_FIND_QUIETLY) +else (HAVE_MATHGL) + if (MATHGL_FIND_REQUIRED) + message (FATAL_ERROR "Could not find MATHGL!") + endif (MATHGL_FIND_REQUIRED) +endif (HAVE_MATHGL) + +## ----------------------------------------------------------------------------- +## Mark advanced variables + +mark_as_advanced ( + MATHGL_INCLUDES + MATHGL_LIBRARIES +) + +# EOF FindMathGL.cmake diff --git a/TODO b/TODO index 27449bb..c41c6e3 100644 --- a/TODO +++ b/TODO @@ -1,12 +1,15 @@ - MathGL (for v.1.11.*) + MathGL for v.1.11.* or v.2.0 -1. Colorbar: print more digits for manual arrays ... but avoid overlapping ??? +1. Colorbar: print more digits for manual arrays ... but avoid overlapping ??? 2. Miss MAJOR labels or decrease its fontsize if labels too close. Also check that enough digits is printed to distingush the labels Also allow "time"-labels Also allow rotate labels if they too dense -5. Legend in OpenGL mode +3. Legend in OpenGL mode +4. Add plot Circle() as Error() but with marks instead of error boxes (default 'o') + alpha-transpared if filled +5. Export to LaTeX formats - (pgf/tikz) or metapost if possible (like EPS). +6. Use '~' for old style textual arguments!!! 11. Update STIX fonts (new release) + create PWT fonts 12. Problem with \calB and so on (\calH, ...) -- they are present only in italic font :(. @@ -30,7 +33,7 @@ 1. Plot for isolines of vector fields ??? 2. Named arguments in MGL ??? -3. \dfrac for normal size and centering ??? +3. \dfrac for normal size and centering (sample \big\big{\frac{1}{2}}) ??? 4. "Chaos" in area.png (near axis) ??? 5. save data coordinates in picture??? -- NO -- slow + a lot of memory! 6. "Cut off" curves if text is printed along it (for contour labels) ?!? diff --git a/examples/full_test.cpp b/examples/full_test.cpp index 6fb97d5..df3af66 100644 --- a/examples/full_test.cpp +++ b/examples/full_test.cpp @@ -33,134 +33,6 @@ extern mglTeXsymb mgl_tex_symb[]; int test(mglGraphAB *gr) { - int N[5] = {0, 28, 52, 73, 85}; - char text[256]; - float tmin = -900, tmax = -400, dt = 100; - double amp[5] = {1., 1.62, 3.98, 5.53, 8.54}; - double z0 = 0.031;//0.063 - gr->SetSize(2400,800); - gr->Clf(); gr->RotatedText = false; gr->TuneTicks = false; - gr->InPlot(0,0.3,0.15,1); - gr->Axis(mglPoint(tmin,-1,-0.65),mglPoint(tmax,1,1),mglPoint(tmin,0,0)); - gr->CAxis(0,1); gr->Light(true); gr->Alpha(true); gr->AlphaDef = 0.6; - gr->Rotate(75-7*1*0-5*1,365); - sprintf(text,"\\i z = %g z_R",N[0]*z0); - gr->Puts(mglPoint(0.5*(tmin+tmax),-1,-0.8),text,"rC"); - sprintf(text,"\\i I_{max}=%g",amp[0]); - gr->Puts(mglPoint(0.5*(tmax+tmin),0,1.1),text,"rC"); - gr->Light(false); gr->Alpha(false); - gr->Line(mglPoint(tmin,-1,0),mglPoint(tmax,-1,0),"r5"); - gr->dz = 0.2; gr->dx = dt; - gr->Min.z = 0; - //gr->Axis("_yz"); - float size = gr->FontSize; gr->FontSize = 4; - gr->Axis("_y"); gr->Axis("z"); - gr->Org = mglPoint(tmin,-1,0); gr->Axis("x"); gr->FontSize = size; - gr->Min.z = -0.65; - gr->Org = mglPoint(tmin,0,-0.65); gr->Axis("_xy"); - //------------------------------------------------------------------------------------ - //-----------------------------Второй график----------------------------------------- - gr->InPlot(0.172,0.472,0.135,0.985); - gr->Axis(mglPoint(tmin,-1,-0.65),mglPoint(tmax,1,1),mglPoint(tmin,0,0)); - gr->CAxis(0,1); gr->Light(true); gr->Alpha(true); gr->AlphaDef = 0.6; - gr->Rotate(75-7*1*0-5*1,365); - sprintf(text,"\\i z = %g z_R",N[1]*z0); - gr->Puts(mglPoint(0.5*(tmin+tmax),-1,-0.8),text,"rC"); - sprintf(text,"\\i I_{max}=%g",amp[1]); - gr->Puts(mglPoint(0.5*(tmax+tmin),0,1.1),text,"rC"); - gr->Light(false); gr->Alpha(false); - gr->Line(mglPoint(tmin,-1,0),mglPoint(tmax,-1,0),"r5"); - gr->Min.z = 0; - gr->Axis("_xyz"); - gr->Min.z = -0.65; - gr->Org = mglPoint(tmin,0,-0.65); gr->Axis("_xy"); -/* //------------------------------------------------------------------------------------ - //-----------------------------Третий график----------------------------------------- - u->ReadHDF(_sprintf("%d.h5",N[2]),"/Real(E)"); u->Transpose(); - intensity( Nt, Nr, k, w0, u->a ); (V+2)->Set(u->a,Nt,Nr); - std::cout<<"Max = "<Norm(0,1); (V+5)->Set((V+2)->a,Nt,1); - gr->InPlot(0.344,0.644,0.12,0.97); - gr->Axis(mglPoint(tmin,-1,-0.65),mglPoint(tmax,1,1),mglPoint(tmin,0,0)); - gr->CAxis(0,1); gr->Light(true); gr->Alpha(true); gr->AlphaDef = 0.6; - gr->Rotate(75-7*1*0-5*1,365); - sprintf(text,"\\i z = %g z_R",N[2]*z0); - gr->Puts(mglPoint(0.5*(tmin+tmax),-1,-0.8),text,"rC"); - sprintf(text,"\\i I_{max}=%g",amp[2]); - gr->Puts(mglPoint(0.5*(tmax+tmin),0,1.1),text,"rC"); - gr->Surf(V[0],V[1],V[2],"wyrRk"); gr->Surf(V[0],V[3],V[2],"wyrRk"); - gr->Plot(V[0],V[4],V[5],"b3"); - gr->Cont(V[0],V[1],V[2],"wyrRk",20); gr->Cont(V[0],V[3],V[2],"wyrRk",20); - gr->Light(false); gr->Alpha(false); - (V+2)->Norm(0,1); - gr->Dens(V[0],V[1],V[2],"wyrRk"); gr->Dens(V[0],V[3],V[2],"wyrRk"); - gr->Line(mglPoint(tmin,-1,0),mglPoint(tmax,-1,0),"r5"); - gr->Min.z = 0; - gr->Axis("_xyz"); - gr->Min.z = -0.65; - gr->Org = mglPoint(tmin,0,-0.65); gr->Axis("_xy"); - //------------------------------------------------------------------------------------ - //-----------------------------Четвертый график----------------------------------------- - u->ReadHDF(_sprintf("%d.h5",N[3]),"/Real(E)"); u->Transpose(); - intensity( Nt, Nr, k, w0, u->a ); (V+2)->Set(u->a,Nt,Nr); - std::cout<<"Max = "<Norm(0,1); (V+5)->Set((V+2)->a,Nt,1); - gr->InPlot(0.516,0.816,0.105,0.955); - gr->Axis(mglPoint(tmin,-1,-0.65),mglPoint(tmax,1,1),mglPoint(tmin,0,0)); - gr->CAxis(0,1); gr->Light(true); gr->Alpha(true); gr->AlphaDef = 0.6; - gr->Rotate(75-7*1*0-5*1,365); - sprintf(text,"\\i z = %g z_R",N[3]*z0); - gr->Puts(mglPoint(0.5*(tmin+tmax),-1,-0.8),text,"rC"); - sprintf(text,"\\i I_{max}=%g",amp[3]); - gr->Puts(mglPoint(0.5*(tmax+tmin),0,1.1),text,"rC"); - gr->Surf(V[0],V[1],V[2],"wyrRk"); gr->Surf(V[0],V[3],V[2],"wyrRk"); - gr->Plot(V[0],V[4],V[5],"b3"); - gr->Cont(V[0],V[1],V[2],"wyrRk",20); gr->Cont(V[0],V[3],V[2],"wyrRk",20); - gr->Light(false); gr->Alpha(false); - (V+2)->Norm(0,1); - gr->Dens(V[0],V[1],V[2],"wyrRk"); gr->Dens(V[0],V[3],V[2],"wyrRk"); - gr->Line(mglPoint(tmin,-1,0),mglPoint(tmax,-1,0),"r5"); - gr->Min.z = 0; - gr->Axis("_xyz"); - gr->Min.z = -0.65; - gr->Org = mglPoint(tmin,0,-0.65); gr->Axis("_xy"); - //------------------------------------------------------------------------------------ - //-----------------------------Пятый график----------------------------------------- - u->ReadHDF(_sprintf("%d.h5",N[4]),"/Real(E)"); u->Transpose(); - intensity( Nt, Nr, k, w0, u->a ); (V+2)->Set(u->a,Nt,Nr); - std::cout<<"Max = "<Norm(0,1); (V+5)->Set((V+2)->a,Nt,1); - gr->InPlot(0.688,0.988,0.09,0.94); - gr->Axis(mglPoint(tmin,-1,-0.65),mglPoint(tmax,1,1),mglPoint(tmin,0,0)); - gr->CAxis(0,1); gr->Light(true); gr->Alpha(true); gr->AlphaDef = 0.6; - gr->Rotate(75-7*1*0-5*1,365); - sprintf(text,"\\i z = %g z_R",N[4]*z0); - gr->Puts(mglPoint(0.5*(tmin+tmax),-1,-0.8),text,"rC"); - sprintf(text,"\\i I_{max}=%g",amp[4]); - gr->Puts(mglPoint(0.5*(tmax+tmin),0,1.1),text,"rC"); - gr->Surf(V[0],V[1],V[2],"wyrRk"); gr->Surf(V[0],V[3],V[2],"wyrRk"); - gr->Plot(V[0],V[4],V[5],"b3"); - gr->Cont(V[0],V[1],V[2],"wyrRk",20); gr->Cont(V[0],V[3],V[2],"wyrRk",20); - gr->Light(false); gr->Alpha(false); - (V+2)->Norm(0,1); - gr->Dens(V[0],V[1],V[2],"wyrRk"); gr->Dens(V[0],V[3],V[2],"wyrRk"); - gr->Line(mglPoint(tmin,-1,0),mglPoint(tmax,-1,0),"r5A"); - gr->Puts(mglPoint(1.1*tmax,-1,-0.15),"\\tau","rR",-1.6); - gr->Puts(mglPoint(0.9*tmax,0,-0.1),"\\rho","rR",-1.6); - gr->Min.z = 0; - gr->Axis("_xyz"); - gr->Min.z = -0.65; - gr->Org = mglPoint(tmin,0,-0.65); gr->Axis("_xy"); -*/ - return 0; - - - - - - - - mglParse par; par.AllowSetSize = true; FILE *fp=fopen("test.mgl","rt"); @@ -1893,7 +1765,11 @@ int main(int argc,char **argv) else gr->SetSize(width,height); if(dotest) - { test(gr); gr->WriteEPS("test.eps"); gr->WritePNG("test.png","",false); return 0; } + { + mglTestMode=true; test(gr); + gr->WriteEPS("test.eps"); gr->WritePNG("test.png","",false); + return 0; + } if(srnd) mgl_srnd(1); gr->VertexColor(false); gr->TextureColor(true); gr->Compression(false); diff --git a/include/mgl/mgl_define.h b/include/mgl/mgl_define.h index 8b4fcb7..6c85c13 100644 --- a/include/mgl/mgl_define.h +++ b/include/mgl/mgl_define.h @@ -148,6 +148,9 @@ struct mglThread }; /// Start several thread for the task mreal mglStartThread(void *(*func)(void *), mreal (*fres)(mreal,mreal), int n, mreal *z, long *p, void *v); +/// write testing messages +extern bool mglTestMode; +void mglTest(const char *str, ...); #ifndef MGL_NTH_DEF #define MGL_NTH_DEF 2 #endif diff --git a/mgl/mgl_data_io.cpp b/mgl/mgl_data_io.cpp index 0c5d845..caf525c 100644 --- a/mgl/mgl_data_io.cpp +++ b/mgl/mgl_data_io.cpp @@ -26,7 +26,9 @@ #include #endif #ifdef HAVE_HDF4 -#include +#define intf hdf4_intf +#include +#undef intf #endif #ifndef WIN32 @@ -303,10 +305,13 @@ void mglData::Save(const char *fname,int ns) const //----------------------------------------------------------------------------- char *mgl_read_gz(gzFile fp) { - long size=1024,n=0; + long size=1024,n=0,m; char *buf=(char*)malloc(size); - while(gzread(fp,buf+size*n,size)>0) - { n++; buf=(char*)realloc(buf,size*(n+1)); } + while((m=gzread(fp,buf+size*n,size))>0) + { + if(m' ' && j=nx*ny*nz) break; + a[i] = atof(s); + i++; if(i>=nx*ny*nz) break; } free(buf); return true; diff --git a/mgl/mgl_eval.cpp b/mgl/mgl_eval.cpp index 0170cdb..11dcc66 100644 --- a/mgl/mgl_eval.cpp +++ b/mgl/mgl_eval.cpp @@ -124,7 +124,9 @@ EQ_CL, // Clausen function #define M_PI 3.14159265358979323846 #endif //----------------------------------------------------------------------------- +#ifndef NO_GSL gsl_rng *mgl_rng=0; +#endif void mgl_srnd(long seed) { #ifndef NO_GSL @@ -150,7 +152,7 @@ double mgl_rnd() return gsl_rng_uniform(mgl_rng); // gsl_rng_free(r); #else - return rand()/(RND_MAX-1.); + return rand()/(RAND_MAX-1.); #endif } //----------------------------------------------------------------------------- diff --git a/mgl/mgl_main.cpp b/mgl/mgl_main.cpp index eeeac50..095210f 100644 --- a/mgl/mgl_main.cpp +++ b/mgl/mgl_main.cpp @@ -62,6 +62,21 @@ mglColorID mglColorIds[] = {{'k', mglColor(0,0,0)}, {' ', mglColor(-1,-1,-1)}, {0, mglColor(-1,-1,-1)} // the last one MUST have id=0 }; //----------------------------------------------------------------------------- +bool mglTestMode=false; +void mglTest(const char *str, ...) +{ + if(mglTestMode) + { + char buf[256]; + va_list lst; + va_start(lst,str); + vsprintf(buf,str,lst); + va_end(lst); + printf("TEST: %s\n",buf); + fflush(stdout); + } +} +//--------------------------------------------------------------------------- void mglGraph::RecalcBorder() { if(!fx && !fy && !fz) diff --git a/png b/png deleted file mode 120000 index 8077efa..0000000 --- a/png +++ /dev/null @@ -1 +0,0 @@ -texinfo/png/ \ No newline at end of file diff --git a/texinfo/data_en.texi b/texinfo/data_en.texi index ffc8eeb..272c458 100644 --- a/texinfo/data_en.texi +++ b/texinfo/data_en.texi @@ -1,7 +1,7 @@ @c ------------------------------------------------------------------ @chapter mglData class -Class for working with data array. This class is defined in @code{#include }. The class has functions for easy and safe allocation, resizing, loading and saving, modifying of data arrays. Also it can numerically differentiate and integrate data, interpolate, fill data by formula and so on. Class supports data with dimensions up to 3 (like function of 3 variables -- x,y,z). The internal representation of numbers is float. Float type was chosen because it has smaller size in memory and usually it has enough precision in plotting purposes. +Class for working with data array. This class is defined in @code{#include }. The class has functions for easy and safe allocation, resizing, loading and saving, modifying of data arrays. Also it can numerically differentiate and integrate data, interpolate, fill data by formula and so on. Class supports data with dimensions up to 3 (like function of 3 variables -- x,y,z). The internal representation of numbers is float. Float type was chosen because it has smaller size in memory and usually it has enough precision in plotting purposes. You can change it by selecting option @code{--enable-double} at the library configuring (@pxref{Installation and usage}). @menu * Public variables:: diff --git a/texinfo/data_ru.texi b/texinfo/data_ru.texi index 7d05004..56cbecf 100644 --- a/texinfo/data_ru.texi +++ b/texinfo/data_ru.texi @@ -1,7 +1,7 @@ @c ------------------------------------------------------------------ @chapter Класс mglData -Это класс для работы с массивами данных, определенный в @code{#include }. Он содержит функции для выделения памяти и изменения размера данных, чтения данных из файла, численного дифференцирования/интегрирования/интерполяции и пр., заполнения по текстовой формуле и т.д. Класс позволяет работать с данными размерности не более 3 (как функции от трех переменных -- x,y,z). По умолчанию внутреннее представление данных -- float, выбранный в силу меньшего размера занимаемой памяти и достаточной для построения графиков точности. Базовый тип можно сменить на этапе установки (@pxref{Installation and using}) указав опцию @code{--enable-double}. Однако, в дальнейшем в документации будет использован тип @code{float}. +Это класс для работы с массивами данных, определенный в @code{#include }. Он содержит функции для выделения памяти и изменения размера данных, чтения данных из файла, численного дифференцирования/интегрирования/интерполяции и пр., заполнения по текстовой формуле и т.д. Класс позволяет работать с данными размерности не более 3 (как функции от трех переменных -- x,y,z). По умолчанию внутреннее представление данных -- float, выбранный в силу меньшего размера занимаемой памяти и достаточной для построения графиков точности. Базовый тип можно сменить на этапе установки (@pxref{Installation and usage}) указав опцию @code{--enable-double}. Однако, в дальнейшем в документации будет использован тип @code{float}. @menu * Public variables:: diff --git a/texinfo/filter.py b/texinfo/filter.py index ad255fc..b7bfa28 100755 --- a/texinfo/filter.py +++ b/texinfo/filter.py @@ -14,6 +14,8 @@ for filename in glob.glob('./*ru.html/*html'): fpout.write(line) continue if re.search('',line): beginskip=0 + if re.search('',line): continue if re.search('