diff --git a/Fltk/GUI_Projection.cpp b/Fltk/GUI_Projection.cpp index 60ee12aca424281f36167c8252a5380c4837813a..b615948dad76dc829bb99b82b6bca95fa8da8534 100644 --- a/Fltk/GUI_Projection.cpp +++ b/Fltk/GUI_Projection.cpp @@ -1,8 +1,10 @@ +#include "GModelIO_F.h" #include "Draw.h" #include "Options.h" #include "Context.h" #include "SelectBuffer.h" #include "GUI_Projection.h" +#include "GUI_Extras.h" #include "FFace.h" extern GModel *GMODEL; @@ -11,8 +13,10 @@ extern Context_T CTX; #if defined(HAVE_FOURIER_MODEL) #include "FPatch.h" - -#define HARDCODED +#include "PlaneProjectionSurface.h" +#include "ParaboloidProjectionSurface.h" +#include "CylindricalProjectionSurface.h" +#include "RevolvedParabolaProjectionSurface.h" uvPlot::uvPlot(int x, int y, int w, int h, const char *l) : Fl_Window(x, y, w, h, l), _dmin(0.), _dmax(0.) @@ -102,7 +106,7 @@ projection::projection(FProjectionFace *f, int x, int y, int w, int h, int BB, i group = new Fl_Scroll(x, y, w, h); SBoundingBox3d bounds = GMODEL->bounds(); ProjectionSurface *ps = f->GetProjectionSurface(); - currentParams = new double[ps->GetNumParameters() + 9 + 100]; // FIXME!!!!!!!!!!!!! + currentParams = new double[ps->GetNumParameters() + 9]; for(int i = 0; i < ps->GetNumParameters() + 9; i++){ Fl_Value_Input *v = new Fl_Value_Input(x, y + i * BH, BB, BH); if(i < 3){ // scaling @@ -115,23 +119,14 @@ projection::projection(FProjectionFace *f, int x, int y, int w, int h, int BB, i } else if(i < 6){ //rotation currentParams[i] = 0.; -#if defined HARDCODED - currentParams[5] = 90.; -#endif v->maximum(-180.); v->minimum(180.); v->step(0.1); - v->label((i == 3) ? "X rotation" : (i == 4) ? "Y rotation" : - "Z rotation"); + v->label((i == 3) ? "X rotation" : (i == 4) ? "Y rotation" : "Z rotation"); v->value(currentParams[i]); } else if(i < 9){ // translation currentParams[i] = bounds.center()[i - 6]; -#if defined HARDCODED - currentParams[6] = 10.97; - currentParams[7] = 0.301; - currentParams[8] = 1.745; -#endif v->maximum(bounds.max()[i] + 10. * CTX.lc); v->minimum(bounds.min()[i] - 10. * CTX.lc); v->step(CTX.lc / 100.); @@ -141,11 +136,6 @@ projection::projection(FProjectionFace *f, int x, int y, int w, int h, int BB, i } else{ // other parameters currentParams[i] = ps->GetParameter(i - 9); -#if defined HARDCODED - currentParams[9] = .35; - currentParams[10] = .39; - currentParams[11] = 3.55; -#endif v->maximum(10. * CTX.lc); v->minimum(-10. * CTX.lc); v->step(CTX.lc / 100.); @@ -190,10 +180,12 @@ projectionEditor::projectionEditor(std::vector<FProjectionFace*> &faces) Fl_Toggle_Button *b1 = new Fl_Toggle_Button (width - WB - 3 * BB / 2, WB, 3 * BB / 2, BH, "Hide unselected"); b1->callback(hide_cb); - Fl_Button *b2 = new Fl_Button (width - WB - 3 * BB / 2, WB + BH, 3 * BB / 2, BH, "Save selection"); - b2->callback(save_cb, this); + b2->callback(save_selection_cb, this); + Fl_Button *b3 = new Fl_Button + (width - WB - 3 * BB / 2, WB + 2 * BH, 3 * BB / 2, BH, "Read parameters"); + b3->callback(read_parameters_cb, this); } const int brw = (int)(1.25 * BB); @@ -535,7 +527,7 @@ void hide_cb(Fl_Widget *w, void *data) Draw(); } -void save_cb(Fl_Widget *w, void *data) +void save_selection_cb(Fl_Widget *w, void *data) { projectionEditor *e = (projectionEditor*)data; @@ -550,6 +542,25 @@ void save_cb(Fl_Widget *w, void *data) } } +void read_parameters_cb(Fl_Widget *w, void *data) +{ + projectionEditor *e = (projectionEditor*)data; + projection *p = e->getCurrentProjection(); + if(p){ + if(file_chooser(0, 0, "Read parameters", "*.par")){ + FILE *fp = fopen(file_chooser_get_name(1), "r"); + if(!fp) return; + for(unsigned int i = 0; i < p->parameters.size(); i++){ + double val; + if(!fscanf(fp, "%lf", &val)) break; + p->parameters[i]->value(val); + } + fclose(fp); + update_cb(0, data); + } + } +} + void compute_cb(Fl_Widget *w, void *data) { projectionEditor *e = (projectionEditor*)data; @@ -661,8 +672,9 @@ void action_cb(Fl_Widget *w, void *data) Msg(ONSCREEN, ""); } - if(what == "delete_last" || what == "delete_all" || what == "delete_select"){ - for(unsigned int i = 0; i < faces.size(); i++) delete_fourier(faces[i]); + if(what[0] == 'd'){ + for(unsigned int i = 0; i < faces.size(); i++) + delete_fourier(faces[i]); } else{ char *filename = "patches.fm"; diff --git a/Fltk/GUI_Projection.h b/Fltk/GUI_Projection.h index a40acd895f238e18d70e5b1b93333bdf816151dd..bb73b64c7f528b2bf396e431eacfa1ec5462b3ce 100644 --- a/Fltk/GUI_Projection.h +++ b/Fltk/GUI_Projection.h @@ -1,22 +1,18 @@ #ifndef _GUI_PROJECTION_H_ #define _GUI_PROJECTION_H_ -#include "Gmsh.h" #include "GmshUI.h" #include "GModel.h" -#include "GModelIO_F.h" +#include "FProjectionFace.h" #include "GUI.h" #include "Shortcut_Window.h" #include "ColorTable.h" #include <FL/Fl_Toggle_Button.H> #include <FL/Fl_Round_Button.H> - -#if defined(HAVE_FOURIER_MODEL) - -#include "Utils.h" #include <vector> #include <complex> -#include "FProjectionFace.h" + +#if defined(HAVE_FOURIER_MODEL) void select_cb(Fl_Widget *w, void *data); void filter_cb(Fl_Widget *w, void *data); @@ -24,7 +20,8 @@ void browse_cb(Fl_Widget *w, void *data); void update_cb(Fl_Widget *w, void *data); void close_cb(Fl_Widget *w, void *data); void hide_cb(Fl_Widget *w, void *data); -void save_cb(Fl_Widget *w, void *data); +void save_selection_cb(Fl_Widget *w, void *data); +void read_parameters_cb(Fl_Widget *w, void *data); void compute_cb(Fl_Widget *w, void *data); void action_cb(Fl_Widget *w, void *data); @@ -43,8 +40,6 @@ class uvPlot : public Fl_Window { void get(std::vector<double> &u, std::vector<double> &v, std::vector<double> &dist, std::vector<std::complex<double> > &f) { u = _u; v = _v; dist = _dist; f = _f; } - double dmin() { return _dmin; } - double dmax() { return _dmax; } }; class projectionEditor; diff --git a/Fltk/Makefile b/Fltk/Makefile index 380cfdfb99032c8fe77f1fde1f6cc9eab0d89796..44f58a3a94707716fde0a4e080fc3620bb4f7d67 100644 --- a/Fltk/Makefile +++ b/Fltk/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.138 2007-07-26 17:57:27 geuzaine Exp $ +# $Id: Makefile,v 1.139 2007-08-07 03:14:24 geuzaine Exp $ # # Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle # @@ -118,29 +118,29 @@ GUI_Extras.o: GUI_Extras.cpp ../Common/Gmsh.h ../Common/Message.h \ ../Post/AdaptiveViews.h ../Common/GmshMatrix.h GUI.h Opengl_Window.h \ Colorbar_Window.h Popup_Button.h SpherePosition_Widget.h \ Shortcut_Window.h -GUI_Projection.o: GUI_Projection.cpp ../Graphics/Draw.h ../DataStr/List.h \ - ../Post/Views.h ../Post/ColorTable.h ../Common/VertexArray.h \ - ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/AdaptiveViews.h \ - ../Common/GmshMatrix.h ../Common/Options.h ../Common/Context.h \ - ../Graphics/SelectBuffer.h ../Geo/GVertex.h ../Geo/GEntity.h \ - ../Geo/Range.h ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h \ - ../Geo/SPoint3.h ../Common/GmshDefines.h ../Geo/MVertex.h \ - ../Geo/SPoint3.h ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h \ - ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h \ - ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/MElement.h ../Geo/MVertex.h \ - ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h \ - ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h \ - ../Geo/ExtrudeParams.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \ - ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/MElement.h ../Geo/SPoint2.h \ - ../Geo/SVector3.h ../Geo/Pair.h ../Geo/ExtrudeParams.h ../Geo/GRegion.h \ - ../Geo/GEntity.h ../Geo/MElement.h ../Geo/ExtrudeParams.h \ - GUI_Projection.h ../Common/Gmsh.h ../Common/Message.h \ - ../DataStr/Malloc.h ../DataStr/Tree.h ../DataStr/avl.h \ - ../DataStr/Tools.h ../DataStr/List.h ../DataStr/Tree.h \ - ../Common/GmshUI.h ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEdge.h \ - ../Geo/GFace.h ../Geo/GRegion.h ../Geo/SBoundingBox3d.h GUI.h \ - Opengl_Window.h Colorbar_Window.h Popup_Button.h \ - SpherePosition_Widget.h Shortcut_Window.h +GUI_Projection.o: GUI_Projection.cpp ../Geo/GModelIO_F.h ../Geo/GModel.h \ + ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \ + ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Common/GmshDefines.h \ + ../Geo/MVertex.h ../Geo/SPoint3.h ../Geo/GPoint.h ../Geo/SPoint2.h \ + ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h \ + ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/MElement.h \ + ../Geo/MVertex.h ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h \ + ../Common/Hash.h ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h \ + ../Numeric/Numeric.h ../Common/Context.h ../DataStr/List.h \ + ../Geo/ExtrudeParams.h ../Common/SmoothData.h ../Geo/GFace.h \ + ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/GEdgeLoop.h ../Geo/GEdge.h \ + ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h \ + ../Geo/ExtrudeParams.h ../Geo/GRegion.h ../Geo/GEntity.h \ + ../Geo/MElement.h ../Geo/ExtrudeParams.h ../Geo/SBoundingBox3d.h \ + ../Graphics/Draw.h ../Post/Views.h ../Post/ColorTable.h \ + ../Common/VertexArray.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \ + ../Common/Options.h ../Graphics/SelectBuffer.h GUI_Projection.h \ + ../Common/GmshUI.h ../Geo/FProjectionFace.h ../Geo/GModel.h \ + ../Geo/Range.h GUI.h Opengl_Window.h Colorbar_Window.h Popup_Button.h \ + SpherePosition_Widget.h Shortcut_Window.h GUI_Extras.h ../Geo/FFace.h \ + ../Geo/GFace.h ../Geo/GModel.h ../Geo/Range.h ../Geo/FEdge.h \ + ../Geo/GEdge.h ../Geo/GModel.h ../Geo/FVertex.h ../Geo/GModel.h \ + ../Geo/GVertex.h ../Geo/Range.h ../Common/Message.h Callbacks.o: Callbacks.cpp ../Common/Gmsh.h ../Common/Message.h \ ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \ ../DataStr/avl.h ../DataStr/Tools.h ../DataStr/List.h ../DataStr/Tree.h \ diff --git a/Geo/FProjectionFace.h b/Geo/FProjectionFace.h index 47f5532375f3a91c2e566982cc3a3f1289105b2d..6c49df7f9cc6e59f0495a74a54b003a53fa46807 100644 --- a/Geo/FProjectionFace.h +++ b/Geo/FProjectionFace.h @@ -7,10 +7,6 @@ #if defined(HAVE_FOURIER_MODEL) #include "ProjectionSurface.h" -#include "PlaneProjectionSurface.h" -#include "ParaboloidProjectionSurface.h" -#include "CylindricalProjectionSurface.h" -#include "RevolvedParabolaProjectionSurface.h" class FProjectionFace : public GFace { protected: @@ -43,8 +39,6 @@ class FProjectionFace : public GFace { virtual bool surfPeriodic(int dim) const {throw;} inline ProjectionSurface* GetProjectionSurface() { return ps_; } - - //virtual void ResetProjectionSurface(int type); }; #endif diff --git a/Geo/Makefile b/Geo/Makefile index 627a7815f44731177e0026948984b34026118766..cc659121f63fc786d84046d686ab831d11234dd1 100644 --- a/Geo/Makefile +++ b/Geo/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.154 2007-07-31 22:09:11 geuzaine Exp $ +# $Id: Makefile,v 1.155 2007-08-07 03:14:24 geuzaine Exp $ # # Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle # @@ -221,9 +221,7 @@ GModelIO_F.o: GModelIO_F.cpp GModel.h GVertex.h GEntity.h Range.h \ SPoint2.h GEdge.h SVector3.h MElement.h MEdge.h ../Common/Hash.h \ MFace.h ../Numeric/Numeric.h ../Common/Context.h ../DataStr/List.h \ ExtrudeParams.h ../Common/SmoothData.h GFace.h GEdgeLoop.h Pair.h \ - GRegion.h ../Common/Message.h ../Post/Views.h ../Post/ColorTable.h \ - ../Common/VertexArray.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \ - FFace.h FEdge.h FVertex.h ../Mesh/meshGFace.h GModelIO_F.h + GRegion.h ../Common/Message.h FFace.h FEdge.h FVertex.h GModelIO_F.h GModelIO_CGNS.o: GModelIO_CGNS.cpp GModel.h GVertex.h GEntity.h Range.h \ SPoint3.h SBoundingBox3d.h ../Common/GmshDefines.h MVertex.h GPoint.h \ SPoint2.h GEdge.h SVector3.h MElement.h MEdge.h ../Common/Hash.h \ diff --git a/contrib/FourierModel/Makefile b/contrib/FourierModel/Makefile index 3ed18abf555b553e9c139d273bb572011b99ac9e..f8888acbfc7e1adb9b0f2848b82653e4631edd98 100644 --- a/contrib/FourierModel/Makefile +++ b/contrib/FourierModel/Makefile @@ -51,9 +51,10 @@ depend: # DO NOT DELETE THIS LINE ProjectionSurface.o: ProjectionSurface.cpp ProjectionSurface.h -PlaneProjectionSurface.o: PlaneProjectionSurface.cpp PlaneProjectionSurface.h +PlaneProjectionSurface.o: PlaneProjectionSurface.cpp \ + PlaneProjectionSurface.h ProjectionSurface.h ParaboloidProjectionSurface.o: ParaboloidProjectionSurface.cpp \ - ParaboloidProjectionSurface.h + ParaboloidProjectionSurface.h Utils.h ProjectionSurface.h CylindricalProjectionSurface.o: CylindricalProjectionSurface.cpp \ CylindricalProjectionSurface.h ProjectionSurface.h RevolvedParabolaProjectionSurface.o: \ @@ -80,9 +81,10 @@ FM_Face.o: FM_Face.cpp FM_Face.h Patch.h ProjectionSurface.h FM_Edge.h \ FM_Info.o: FM_Info.cpp FM_Info.h FM_Reader.o: FM_Reader.cpp Message.h FM_Reader.h Curve.h \ IntersectionCurve.h Patch.h ProjectionSurface.h FM_Info.h ExactPatch.h \ - ContinuationPatch.h PartitionOfUnity.h CylindricalProjectionSurface.h \ - RevolvedParabolaProjectionSurface.h Utils.h FM_Face.h FM_Edge.h \ - FM_Vertex.h BlendOperator.h BlendedPatch.h + ContinuationPatch.h PartitionOfUnity.h PlaneProjectionSurface.h \ + CylindricalProjectionSurface.h ParaboloidProjectionSurface.h Utils.h \ + RevolvedParabolaProjectionSurface.h FM_Face.h FM_Edge.h FM_Vertex.h \ + BlendOperator.h BlendedPatch.h FM_Vertex.o: FM_Vertex.cpp Message.o: Message.cpp Message.h Utils.o: Utils.cpp Utils.h Message.h