diff --git a/Common/Context.h b/Common/Context.h index 744ac46fc695986a8fa9c48ed57ee6dc62c8d656..b7dea14908464370f06ddd9614e7c3a4ff6bf7dd 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -197,13 +197,13 @@ public : int force_num, compute_bb, vertex_arrays; int draw, scales, link, horizontal_scales ; int smooth, anim_cycle, combine_time, combine_remove_orig ; - int file_format; + int file_format, plugins; double anim_delay ; }post; // solver options struct{ - int max_delay ; + int max_delay, plugins ; }solver; // print options diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 324dfa5823abc817cd55974b75d4c89788ee284e..7245542be878b46f7fbd3d78936b5004a8c9f26f 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -888,6 +888,9 @@ StringXNumber SolverOptions_Number[] = { { F|O, "MaximumDelay" , opt_solver_max_delay , 4.0 , "Maximum delay allowed for solver response (in seconds)" }, + { F|O, "Plugins" , opt_solver_plugins , 0. , + "Enable default solver plugins?" }, + { F|O, "ClientServer0" , opt_solver_client_server0 , 1. , "Connect solver 0 to the Gmsh server" }, { F|O, "MergeViews0" , opt_solver_merge_views0 , 1. , @@ -952,6 +955,9 @@ StringXNumber PostProcessingOptions_Number[] = { { F, "NbViews" , opt_post_nb_views , 0. ,//this default val is not used "Current number of views merged" }, + { F|O, "Plugins" , opt_post_plugins , 1. , + "Enable default post-processing plugins?" }, + { F|O, "Scales" , opt_post_scales , 1. , "Show value scales" }, { F|O, "Smoothing" , opt_post_smooth , 0. , diff --git a/Common/Options.cpp b/Common/Options.cpp index aafd143168a83bfec6d752b8e137cd15cf454a99..bc56d956a93e2487876e437d454c9df6539336d7 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.196 2004-10-26 01:04:50 geuzaine Exp $ +// $Id: Options.cpp,v 1.197 2004-10-28 08:13:09 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -4107,6 +4107,13 @@ double opt_solver_max_delay(OPT_ARGS_NUM) return CTX.solver.max_delay; } +double opt_solver_plugins(OPT_ARGS_NUM) +{ + if(action & GMSH_SET) + CTX.solver.plugins = (int)val; + return CTX.solver.plugins; +} + double opt_solver_client_server(OPT_ARGS_NUM) { #if defined(HAVE_FLTK) @@ -4304,6 +4311,13 @@ double opt_post_combine_remove_orig(OPT_ARGS_NUM) return CTX.post.combine_remove_orig; } +double opt_post_plugins(OPT_ARGS_NUM) +{ + if(action & GMSH_SET) + CTX.post.plugins = (int)val; + return CTX.post.plugins; +} + double opt_post_nb_views(OPT_ARGS_NUM) { return List_Nbr(CTX.post.list); diff --git a/Common/Options.h b/Common/Options.h index 63bf21b7c3afd3bffae83d8d7ff52dadc384eb2e..afb56e82a6500b2b34a3bc5115fa4335eeb5e9be 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -422,6 +422,7 @@ double opt_mesh_nb_prisms(OPT_ARGS_NUM); double opt_mesh_nb_pyramids(OPT_ARGS_NUM); double opt_mesh_cpu_time(OPT_ARGS_NUM); double opt_solver_max_delay(OPT_ARGS_NUM); +double opt_solver_plugins(OPT_ARGS_NUM); double opt_solver_client_server(OPT_ARGS_NUM); double opt_solver_client_server0(OPT_ARGS_NUM); double opt_solver_client_server1(OPT_ARGS_NUM); @@ -448,6 +449,7 @@ double opt_post_smooth(OPT_ARGS_NUM); double opt_post_anim_delay(OPT_ARGS_NUM); double opt_post_anim_cycle(OPT_ARGS_NUM); double opt_post_combine_remove_orig(OPT_ARGS_NUM); +double opt_post_plugins(OPT_ARGS_NUM); double opt_post_nb_views(OPT_ARGS_NUM); double opt_post_file_format(OPT_ARGS_NUM); double opt_view_nb_timestep(OPT_ARGS_NUM); diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp index ebf6de3ae2f4af7f9dd42cc2ee37ee2408f7cb97..2bd70952a3b9a8445bb7cc562fb877ed4c9db2a1 100644 --- a/Fltk/Main.cpp +++ b/Fltk/Main.cpp @@ -1,4 +1,4 @@ -// $Id: Main.cpp,v 1.72 2004-09-28 17:13:49 geuzaine Exp $ +// $Id: Main.cpp,v 1.73 2004-10-28 08:13:09 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -88,13 +88,11 @@ int main(int argc, char *argv[]) M.BGM.bgm = NULL; M.Grid.init = 0; - // Initialize the default plugins - - GMSH_PluginManager::instance()->registerDefaultPlugins(); - // Generate automatic documentation (before getting user-defined options) if(argc == 2 && !strcmp(argv[1], "-doc")){ + // force all plugins for the doc + GMSH_PluginManager::instance()->registerDefaultPlugins(); Print_OptionsDoc(); exit(0); } @@ -114,6 +112,10 @@ int main(int argc, char *argv[]) signal(SIGSEGV, Signal); signal(SIGFPE, Signal); + // Initialize the default plugins + + GMSH_PluginManager::instance()->registerDefaultPlugins(); + // Non-interactive Gmsh if(CTX.batch) { diff --git a/Fltk/Makefile b/Fltk/Makefile index c67721718c41b4a1aa2da0c8adf88d5350bdc430..766321366d5a62d0ac8f13b9f25ac3fa2e284f66 100644 --- a/Fltk/Makefile +++ b/Fltk/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.59 2004-10-28 06:11:22 geuzaine Exp $ +# $Id: Makefile,v 1.60 2004-10-28 08:13:09 geuzaine Exp $ # # Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle # @@ -108,7 +108,7 @@ Callbacks.o: Callbacks.cpp ../Common/Gmsh.h ../Common/Message.h \ ../Parser/OpenFile.h ../Common/CommandLine.h ../Common/Context.h \ ../Common/Options.h GUI.h Opengl_Window.h Colorbar_Window.h \ File_Picker.h Callbacks.h ../Plugin/Plugin.h ../Plugin/PluginManager.h \ - ../Common/Visibility.h ../Geo/MinMax.h Solvers.h + ../Common/Visibility.h ../Geo/MinMax.h ../Numeric/Numeric.h Solvers.h Opengl.o: Opengl.cpp ../Common/Gmsh.h ../Common/Message.h \ ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \ ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h \ diff --git a/Plugin/Makefile b/Plugin/Makefile index e7a15077abe360db03cdb19abbf51ffab6d441c4..7dadbe3d34bc4176445332c0d18118634f5c68c5 100644 --- a/Plugin/Makefile +++ b/Plugin/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.56 2004-10-28 06:11:23 geuzaine Exp $ +# $Id: Makefile,v 1.57 2004-10-28 08:13:09 geuzaine Exp $ # # Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle # @@ -76,7 +76,8 @@ Plugin.o: Plugin.cpp Plugin.h ../Common/Options.h ../Common/Message.h \ SphericalRaise.h DisplacementRaise.h StructuralSolver.h ../Geo/Geo.h \ ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h \ ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \ - ../Mesh/Metric.h ../Mesh/Matrix.h ../Common/GmshUI.h Evaluate.h + ../Mesh/Metric.h ../Mesh/Matrix.h ../Common/GmshUI.h Evaluate.h \ + ../Common/Context.h Levelset.o: Levelset.cpp Levelset.h Plugin.h ../Common/Options.h \ ../Common/Message.h ../Common/Views.h ../Common/ColorTable.h \ ../DataStr/List.h ../Common/VertexArray.h ../Common/SmoothNormals.h \ diff --git a/Plugin/Plugin.cpp b/Plugin/Plugin.cpp index 4e6b63be8bae6cebafcee67e9019fbc513f86d92..958f42301d1d73783c10326f89d246775b043df4 100644 --- a/Plugin/Plugin.cpp +++ b/Plugin/Plugin.cpp @@ -1,4 +1,4 @@ -// $Id: Plugin.cpp,v 1.60 2004-10-28 03:40:16 geuzaine Exp $ +// $Id: Plugin.cpp,v 1.61 2004-10-28 08:13:09 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -49,9 +49,12 @@ #include "DisplacementRaise.h" #include "StructuralSolver.h" #include "Evaluate.h" +#include "Context.h" using namespace std; +extern Context_T CTX; + const char *GMSH_PluginEntry = "GMSH_RegisterPlugin"; GMSH_PluginManager *GMSH_PluginManager::_instance = 0; @@ -76,12 +79,6 @@ GMSH_Plugin *GMSH_PluginManager::find(char *pluginName) GMSH_Solve_Plugin *GMSH_PluginManager::findSolverPlugin() { - // to avoid showing the solver plugin popups for "regular" users, - // let's just say for the moment that we don't have any solver - // plugins if the environment variable is not defined... - if(!getenv("GMSHPLUGINSHOME")) - return 0; - iter it = allPlugins.begin(); iter ite = allPlugins.end(); for (;it!=ite;++it) { @@ -159,43 +156,48 @@ GMSH_PluginManager *GMSH_PluginManager::instance() void GMSH_PluginManager::registerDefaultPlugins() { // SOLVE PLUGINS - allPlugins.insert(std::pair < char *, GMSH_Plugin * > - ("StructuralSolver", GMSH_RegisterStructuralSolverPlugin())); + if(CTX.solver.plugins){ + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("StructuralSolver", GMSH_RegisterStructuralSolverPlugin())); + } + // POST PLUGINS - allPlugins.insert(std::pair < char *, GMSH_Plugin * > - ("StreamLines", GMSH_RegisterStreamLinesPlugin())); - allPlugins.insert(std::pair < char *, GMSH_Plugin * > - ("CutGrid", GMSH_RegisterCutGridPlugin())); - allPlugins.insert(std::pair < char *, GMSH_Plugin * > - ("CutMap", GMSH_RegisterCutMapPlugin())); - allPlugins.insert(std::pair < char *, GMSH_Plugin * > - ("CutPlane", GMSH_RegisterCutPlanePlugin())); - allPlugins.insert(std::pair < char *, GMSH_Plugin * > - ("CutSphere", GMSH_RegisterCutSpherePlugin())); - allPlugins.insert(std::pair < char *, GMSH_Plugin * > - ("Skin", GMSH_RegisterSkinPlugin())); - allPlugins.insert(std::pair < char *, GMSH_Plugin * > - ("Extract", GMSH_RegisterExtractPlugin())); - allPlugins.insert(std::pair < char *, GMSH_Plugin * > - ("DecomposeInSimplex", GMSH_RegisterDecomposeInSimplexPlugin())); - allPlugins.insert(std::pair < char *, GMSH_Plugin * > - ("Smooth", GMSH_RegisterSmoothPlugin())); - allPlugins.insert(std::pair < char *, GMSH_Plugin * > - ("Transform", GMSH_RegisterTransformPlugin())); - allPlugins.insert(std::pair < char *, GMSH_Plugin * > - ("SphericalRaise", GMSH_RegisterSphericalRaisePlugin())); - allPlugins.insert(std::pair < char *, GMSH_Plugin * > - ("DisplacementRaise", GMSH_RegisterDisplacementRaisePlugin())); + if(CTX.post.plugins){ + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("StreamLines", GMSH_RegisterStreamLinesPlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("CutGrid", GMSH_RegisterCutGridPlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("CutMap", GMSH_RegisterCutMapPlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("CutPlane", GMSH_RegisterCutPlanePlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("CutSphere", GMSH_RegisterCutSpherePlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("Skin", GMSH_RegisterSkinPlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("Extract", GMSH_RegisterExtractPlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("DecomposeInSimplex", GMSH_RegisterDecomposeInSimplexPlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("Smooth", GMSH_RegisterSmoothPlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("Transform", GMSH_RegisterTransformPlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("SphericalRaise", GMSH_RegisterSphericalRaisePlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("DisplacementRaise", GMSH_RegisterDisplacementRaisePlugin())); #if defined(HAVE_TRIANGLE) - allPlugins.insert(std::pair < char *, GMSH_Plugin * > - ("Triangulate", GMSH_RegisterTriangulatePlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("Triangulate", GMSH_RegisterTriangulatePlugin())); #endif #if defined(HAVE_MATH_EVAL) - allPlugins.insert(std::pair < char *, GMSH_Plugin * > - ("Evaluate", GMSH_RegisterEvaluatePlugin())); - allPlugins.insert(std::pair < char *, GMSH_Plugin * > - ("CutParametric", GMSH_RegisterCutParametricPlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("Evaluate", GMSH_RegisterEvaluatePlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("CutParametric", GMSH_RegisterCutParametricPlugin())); #endif + } #if defined(HAVE_FLTK) struct dirent **list;