diff --git a/Common/Options.cpp b/Common/Options.cpp index 040a7225ea0ef57136b40414f7c7cae92ee21ebb..2b63d1dfd5dfbe7884b36b9e2f951514fc93ece4 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -754,14 +754,12 @@ void PrintOptionsDoc() return; } fprintf(file, "%s@ftable @code\n", warn); - char author[256], copyright[256], help[4096]; - for(PluginManager::iter it = PluginManager::instance()->begin(); - it != PluginManager::instance()->end(); ++it) { - GMSH_Plugin *p = (*it).second; + for(std::map<std::string, GMSH_Plugin*>::iterator it = PluginManager:: + instance()->begin(); it != PluginManager::instance()->end(); ++it) { + GMSH_Plugin *p = it->second; if(p->getType() == GMSH_Plugin::GMSH_POST_PLUGIN) { - p->getInfos(author, copyright, help); - fprintf(file, "@item Plugin(%s)\n", (*it).first); - fprintf(file, "%s\n", help); + fprintf(file, "@item Plugin(%s)\n", p->getName().c_str()); + fprintf(file, "%s\n", p->getHelp().c_str()); int m = p->getNbOptionsStr(); if(m){ diff --git a/Fltk/FlGui.cpp b/Fltk/FlGui.cpp index e88f15a72894f9fb1e00a5725c8fd2e9e80169ee..7eaad910586eeaa32ae3d3b6b229fcb804b7d2a5 100644 --- a/Fltk/FlGui.cpp +++ b/Fltk/FlGui.cpp @@ -661,9 +661,9 @@ void redraw_cb(Fl_Widget *w, void *data) void window_cb(Fl_Widget *w, void *data) { static int oldx = 0, oldy = 0, oldw = 0, oldh = 0, zoom = 1; - const char *str = (const char*)data; + std::string str((const char*)data); - if(!strcmp(str, "minimize")){ + if(str == "minimize"){ for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++) if(FlGui::instance()->graph[i]->win->shown()) FlGui::instance()->graph[i]->win->iconize(); @@ -686,7 +686,7 @@ void window_cb(Fl_Widget *w, void *data) if(FlGui::instance()->menu->win->shown()) FlGui::instance()->menu->win->iconize(); } - else if(!strcmp(str, "zoom")){ + else if(str == "zoom"){ if(zoom){ oldx = FlGui::instance()->graph[0]->win->x(); oldy = FlGui::instance()->graph[0]->win->y(); @@ -704,7 +704,7 @@ void window_cb(Fl_Widget *w, void *data) FlGui::instance()->graph[0]->win->show(); FlGui::instance()->menu->win->show(); } - else if(!strcmp(str, "front")){ + else if(str == "front"){ // the order is important! for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++) FlGui::instance()->graph[i]->win->show(); diff --git a/Fltk/pluginWindow.cpp b/Fltk/pluginWindow.cpp index 34e82f205024ad6adb3c584ae3cea9b2ceee7083..5d097aeb11c1b13103f5bccde9132dede5802d4e 100644 --- a/Fltk/pluginWindow.cpp +++ b/Fltk/pluginWindow.cpp @@ -198,18 +198,14 @@ void pluginWindow::_createDialogBox(GMSH_Plugin *p, int x, int y, Fl_Browser *o = new Fl_Browser (x + WB, y + WB + BH, width - 2 * WB, height - 2 * WB - BH); - - char name[1024], copyright[256], author[256], help[4096]; - p->getName(name); - p->getInfos(author, copyright, help); - o->add(" "); - add_multiline_in_browser(o, "@c@b@.", name, false); + add_multiline_in_browser(o, "@c@b@.", p->getName().c_str(), false); o->add(" "); - add_multiline_in_browser(o, "", help, false); + add_multiline_in_browser(o, "", p->getHelp().c_str(), false); o->add(" "); - add_multiline_in_browser(o, "Author: ", author, false); - add_multiline_in_browser(o, "Copyright (C) ", copyright, false); + add_multiline_in_browser(o, "Author: ", p->getAuthor().c_str(), false); + add_multiline_in_browser(o, "Copyright (C) ", p->getCopyright().c_str(), + false); o->add(" "); g->end(); @@ -245,13 +241,11 @@ pluginWindow::pluginWindow(int deltaFontSize) view_browser->has_scrollbar(Fl_Browser_::VERTICAL); view_browser->callback(plugin_browser_cb); - for(PluginManager::iter it = PluginManager::instance()->begin(); - it != PluginManager::instance()->end(); ++it) { - GMSH_Plugin *p = (*it).second; + for(std::map<std::string, GMSH_Plugin*>::iterator it = PluginManager:: + instance()->begin(); it != PluginManager::instance()->end(); ++it) { + GMSH_Plugin *p = it->second; if(p->getType() == GMSH_Plugin::GMSH_POST_PLUGIN) { - char name[256]; - p->getName(name); - browser->add(name, p); + browser->add(p->getName().c_str(), p); _createDialogBox(p, 2 * WB + L1 + L2, WB, width - L1 - L2 - 3 * WB, height - 2 * WB); // select first plugin by default diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp index 42e06170edcced89ca62a9eafcf1fb130fd24f94..69d0a5ded390de803b56c09d1eabc1fd1a29f06a 100644 --- a/Parser/Gmsh.tab.cpp +++ b/Parser/Gmsh.tab.cpp @@ -4654,7 +4654,7 @@ yyreduce: yymsg(0, "Unknown option '%s' or plugin '%s'", (yyvsp[(6) - (9)].c), (yyvsp[(3) - (9)].c)); } #endif - Free((yyvsp[(3) - (9)].c)); Free((yyvsp[(6) - (9)].c)); + Free((yyvsp[(3) - (9)].c)); Free((yyvsp[(6) - (9)].c)); Free((yyvsp[(8) - (9)].c)); ;} break; diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y index 0bd325df09bfb22ea6fc828318e00cce76616d7f..a84fb61ce91d58316b734234c12cef53ccb1809c 100644 --- a/Parser/Gmsh.y +++ b/Parser/Gmsh.y @@ -934,7 +934,7 @@ Affectation : yymsg(0, "Unknown option '%s' or plugin '%s'", $6, $3); } #endif - Free($3); Free($6); + Free($3); Free($6); Free($8); } ; diff --git a/Plugin/Annotate.cpp b/Plugin/Annotate.cpp index f7c108b603991b0c00f2549ffee3a7ae73b8b31d..b6b21a86f9cd45939a2857c2dddefe99a8ba750e 100644 --- a/Plugin/Annotate.cpp +++ b/Plugin/Annotate.cpp @@ -180,18 +180,9 @@ std::string GMSH_AnnotatePlugin::callbackAlign(int num, int action, std::string return callbackStr(num, action, value, AnnotateOptions_String[2].def); } -void GMSH_AnnotatePlugin::getName(char *name) const +std::string GMSH_AnnotatePlugin::getHelp() const { - strcpy(name, "Annotate"); -} - -void GMSH_AnnotatePlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(Annotate) adds the text string `Text',\n" + return "Plugin(Annotate) adds the text string `Text',\n" "in font `Font' and size `FontSize', in the view\n" "`iView'. If `ThreeD' is equal to 1, the plugin inserts\n" "the string in model coordinates at the position\n" @@ -202,7 +193,7 @@ void GMSH_AnnotatePlugin::getInfos(char *author, char *copyright, "is run on the current view.\n" "\n" "Plugin(Annotate) is executed in-place for list-based\n" - "datasets or creates a new view for other datasets.\n"); + "datasets or creates a new view for other datasets.\n"; } int GMSH_AnnotatePlugin::getNbOptions() const @@ -225,11 +216,6 @@ StringXString *GMSH_AnnotatePlugin::getOptionStr(int iopt) return &AnnotateOptions_String[iopt]; } -void GMSH_AnnotatePlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "Annotate failed..."); -} - PView *GMSH_AnnotatePlugin::execute(PView *v) { double X = AnnotateOptions_Number[0].def; @@ -237,7 +223,7 @@ PView *GMSH_AnnotatePlugin::execute(PView *v) double Z = AnnotateOptions_Number[2].def; int dim3 = (int)AnnotateOptions_Number[3].def; int iView = (int)AnnotateOptions_Number[5].def; - const char *text = AnnotateOptions_String[0].def.c_str(); + std::string text = AnnotateOptions_String[0].def; double style = getStyle(); PView *v1 = getView(iView, v); @@ -257,8 +243,9 @@ PView *GMSH_AnnotatePlugin::execute(PView *v) data2->T3D.push_back(Z); data2->T3D.push_back(style); data2->T3D.push_back(data2->T3C.size()); - for(int i = 0; i < (int)strlen(text) + 1; i++) + for(unsigned int i = 0; i < text.size(); i++) data2->T3C.push_back(text[i]); + data2->T3C.push_back('\0'); data2->NbT3++; } else{ @@ -266,8 +253,9 @@ PView *GMSH_AnnotatePlugin::execute(PView *v) data2->T2D.push_back(Y); data2->T2D.push_back(style); data2->T2D.push_back(data2->T2C.size()); - for(int i = 0; i < (int)strlen(text) + 1; i++) + for(unsigned int i = 0; i < text.size(); i++) data2->T2C.push_back(text[i]); + data2->T2C.push_back('\0'); data2->NbT2++; } diff --git a/Plugin/Annotate.h b/Plugin/Annotate.h index c10648a2f13f5a365812d10c99c9d9cb86f9945f..26ef63615cb4a5ff9f65fbdd29b40f4e3b378c2e 100644 --- a/Plugin/Annotate.h +++ b/Plugin/Annotate.h @@ -23,9 +23,8 @@ class GMSH_AnnotatePlugin : public GMSH_PostPlugin std::string &opt); public: GMSH_AnnotatePlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *helpText) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "Annotate"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber *getOption(int iopt); int getNbOptionsStr() const; diff --git a/Plugin/Curl.cpp b/Plugin/Curl.cpp index 434b11ab76f3a0c06c19a87c98bc991b5631245e..3e23e45ed5c9e941ac783f8caeebac7e4e38a031 100644 --- a/Plugin/Curl.cpp +++ b/Plugin/Curl.cpp @@ -19,22 +19,13 @@ extern "C" } } -void GMSH_CurlPlugin::getName(char *name) const +std::string GMSH_CurlPlugin::getHelp() const { - strcpy(name, "Curl"); -} - -void GMSH_CurlPlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(Curl) computes the curl of the field\n" + return "Plugin(Curl) computes the curl of the field\n" "in the view `iView'. If `iView' < 0, the plugin\n" "is run on the current view.\n" "\n" - "Plugin(Curl) creates one new view.\n"); + "Plugin(Curl) creates one new view.\n"; } int GMSH_CurlPlugin::getNbOptions() const @@ -47,11 +38,6 @@ StringXNumber *GMSH_CurlPlugin::getOption(int iopt) return &CurlOptions_Number[iopt]; } -void GMSH_CurlPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "Curl failed..."); -} - static std::vector<double> *incrementList(PViewDataList *data2, int type) { switch(type){ diff --git a/Plugin/Curl.h b/Plugin/Curl.h index 9127bb611807a6b2d8e7edc5277bb741b9a1c1a4..d6156f1c239c9b03fde6c40433408ddcbb459ebe 100644 --- a/Plugin/Curl.h +++ b/Plugin/Curl.h @@ -17,9 +17,8 @@ class GMSH_CurlPlugin : public GMSH_PostPlugin { public: GMSH_CurlPlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *help_text) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "Curl"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber *getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/CutGrid.cpp b/Plugin/CutGrid.cpp index 8fbf779347ea45cdf194c367eaa2a1b85da94bd4..f93bf1071c48167c2537292af59705b9c4231beb 100644 --- a/Plugin/CutGrid.cpp +++ b/Plugin/CutGrid.cpp @@ -169,18 +169,9 @@ double GMSH_CutGridPlugin::callbackConnect(int num, int action, double value) 1, 0, 1); } -void GMSH_CutGridPlugin::getName(char *name) const +std::string GMSH_CutGridPlugin::getHelp() const { - strcpy(name, "Cut Grid"); -} - -void GMSH_CutGridPlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(CutGrid) cuts the view `iView' with a\n" + return "Plugin(CutGrid) cuts the view `iView' with a\n" "rectangular grid defined by the 3 points\n" "(`X0',`Y0',`Z0') (origin), (`X1',`Y1',`Z1') (axis of\n" "U) and (`X2',`Y2',`Z2') (axis of V). The number of\n" @@ -192,7 +183,7 @@ void GMSH_CutGridPlugin::getInfos(char *author, char *copyright, "`nPointsV'. If `iView' < 0, the plugin is run on\n" "the current view.\n" "\n" - "Plugin(CutGrid) creates one new view.\n"); + "Plugin(CutGrid) creates one new view.\n"; } int GMSH_CutGridPlugin::getNbOptions() const @@ -205,11 +196,6 @@ StringXNumber *GMSH_CutGridPlugin::getOption(int iopt) return &CutGridOptions_Number[iopt]; } -void GMSH_CutGridPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "CutGrid failed..."); -} - int GMSH_CutGridPlugin::getNbU() { return (int)CutGridOptions_Number[9].def; diff --git a/Plugin/CutGrid.h b/Plugin/CutGrid.h index 1bf062abb64d3804e2ab65bfc0ebddf7628a1ccc..1f86da5e1e6b81546637c25a53ca3f5c45a18862 100644 --- a/Plugin/CutGrid.h +++ b/Plugin/CutGrid.h @@ -25,9 +25,8 @@ class GMSH_CutGridPlugin : public GMSH_PostPlugin PView *GenerateView (PView *v, int connectPoints); public: GMSH_CutGridPlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *help_text) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "CutGrid"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber *getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/CutMap.cpp b/Plugin/CutMap.cpp index 8ed33d25d015c88d3f69a4e6b4829e6733905e58..a92f18870857a5ffd0e0ecc47140af5ceb6a24a7 100644 --- a/Plugin/CutMap.cpp +++ b/Plugin/CutMap.cpp @@ -77,18 +77,9 @@ double GMSH_CutMapPlugin::callbackTarget(int num, int action, double value) return 0.; } -void GMSH_CutMapPlugin::getName(char *name) const +std::string GMSH_CutMapPlugin::getHelp() const { - strcpy(name, "Cut Map"); -} - -void GMSH_CutMapPlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(CutMap) extracts the isosurface of value\n" + return "Plugin(CutMap) extracts the isosurface of value\n" "`A' from the view `iView' and draws the\n" "`dTimeStep'-th value of the view `dView' on the\n" "isosurface. If `iView' < 0, the plugin is run\n" @@ -102,7 +93,7 @@ void GMSH_CutMapPlugin::getInfos(char *author, char *copyright, "< 0) than the isosurface `A'.\n" "\n" "Plugin(CutMap) creates as many views as there\n" - "are time steps in `iView'.\n"); + "are time steps in `iView'.\n"; } int GMSH_CutMapPlugin::getNbOptions() const @@ -115,11 +106,6 @@ StringXNumber *GMSH_CutMapPlugin::getOption(int iopt) return &CutMapOptions_Number[iopt]; } -void GMSH_CutMapPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "CutMap failed..."); -} - double GMSH_CutMapPlugin::levelset(double x, double y, double z, double val) const { // we must look into the map for Map(x,y,z) - A diff --git a/Plugin/CutMap.h b/Plugin/CutMap.h index b471a28c06f2d47016f0eee61c77d1b4301de3e7..6ca74cf5795d59f7ae750a26b8667ed6b647f528 100644 --- a/Plugin/CutMap.h +++ b/Plugin/CutMap.h @@ -18,9 +18,8 @@ class GMSH_CutMapPlugin : public GMSH_LevelsetPlugin double levelset(double x, double y, double z, double val) const; public: GMSH_CutMapPlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *helpText) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "CutMap"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber *getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/CutParametric.cpp b/Plugin/CutParametric.cpp index 56ad15a07fb0ff2c6221b888d71a4c4e74b1fb7a..df6106e678c3316d2c838387497933325dc9e55a 100644 --- a/Plugin/CutParametric.cpp +++ b/Plugin/CutParametric.cpp @@ -192,18 +192,9 @@ std::string GMSH_CutParametricPlugin::callbackZ(int num, int action, std::string return callbackStr(num, action, value, CutParametricOptions_String[2].def); } -void GMSH_CutParametricPlugin::getName(char *name) const +std::string GMSH_CutParametricPlugin::getHelp() const { - strcpy(name, "Cut Parametric"); -} - -void GMSH_CutParametricPlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(CutParametric) cuts the view `iView' with\n" + return "Plugin(CutParametric) cuts the view `iView' with\n" "the parametric function (`X'(u), `Y'(u), `Z'(u)),\n" "using `nPointsU' values of the parameter u in\n" "[`MinU', `MaxU']. If `ConnectPoints' is set, the\n" @@ -211,7 +202,7 @@ void GMSH_CutParametricPlugin::getInfos(char *author, char *copyright, "plugin generates points. If `iView' < 0, the plugin\n" "is run on the current view.\n" "\n" - "Plugin(CutParametric) creates one new view.\n"); + "Plugin(CutParametric) creates one new view.\n"; } int GMSH_CutParametricPlugin::getNbOptions() const @@ -234,11 +225,6 @@ StringXString *GMSH_CutParametricPlugin::getOptionStr(int iopt) return &CutParametricOptions_String[iopt]; } -void GMSH_CutParametricPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "CutParametric failed..."); -} - static void addInView(int connect, int i, int nbcomp, int nbtime, double x0, double y0, double z0, double *res0, double x, double y, double z, double *res, diff --git a/Plugin/CutParametric.h b/Plugin/CutParametric.h index 3acd85b8a7999696cf144ce9950a988230b5dc42..e45705c64e5b80a2bcd85b00fbc794ac29545a82 100644 --- a/Plugin/CutParametric.h +++ b/Plugin/CutParametric.h @@ -27,9 +27,8 @@ class GMSH_CutParametricPlugin : public GMSH_PostPlugin static std::vector<double> x, y, z; public: GMSH_CutParametricPlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *help_text) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "CutParametric"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber *getOption(int iopt); int getNbOptionsStr() const; diff --git a/Plugin/CutPlane.cpp b/Plugin/CutPlane.cpp index 009fc8c8de9c3ce5340500cb436bcd54a9ffc37b..28317c0de08a4e682891809eecf128ae36228c8e 100644 --- a/Plugin/CutPlane.cpp +++ b/Plugin/CutPlane.cpp @@ -113,25 +113,16 @@ double GMSH_CutPlanePlugin::callbackTarget(int num, int action, double value) 0.01, 0., 1.); } -void GMSH_CutPlanePlugin::getName(char *name) const +std::string GMSH_CutPlanePlugin::getHelp() const { - strcpy(name, "Cut Plane"); -} - -void GMSH_CutPlanePlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(CutPlane) cuts the view `iView' with\n" + return "Plugin(CutPlane) cuts the view `iView' with\n" "the plane `A'*X + `B'*Y + `C'*Z + `D' = 0. If\n" "`ExtractVolume' is nonzero, the plugin extracts\n" "the elements on one side of the plane (depending\n" "on the sign of `ExtractVolume'). If `iView' < 0,\n" "the plugin is run on the current view.\n" "\n" - "Plugin(CutPlane) creates one new view.\n"); + "Plugin(CutPlane) creates one new view.\n"; } int GMSH_CutPlanePlugin::getNbOptions() const @@ -144,11 +135,6 @@ StringXNumber *GMSH_CutPlanePlugin::getOption(int iopt) return &CutPlaneOptions_Number[iopt]; } -void GMSH_CutPlanePlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "CutPlane failed..."); -} - double GMSH_CutPlanePlugin::levelset(double x, double y, double z, double val) const { return CutPlaneOptions_Number[0].def * x + CutPlaneOptions_Number[1].def * y + diff --git a/Plugin/CutPlane.h b/Plugin/CutPlane.h index be1bcab398bb825be6a29c558a7078379db61212..7aa9efdf6f85f946d3c4827563c88c56e727eec7 100644 --- a/Plugin/CutPlane.h +++ b/Plugin/CutPlane.h @@ -21,9 +21,8 @@ class GMSH_CutPlanePlugin : public GMSH_LevelsetPlugin static int iview; public: GMSH_CutPlanePlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *helpText) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "CutPlane"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber *getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/CutSphere.cpp b/Plugin/CutSphere.cpp index 0e8a2523c0a802a08e41cd9d3e884f85d0c53b17..bbb38d1cc05b6827149dabfc3e437d62ba525982 100644 --- a/Plugin/CutSphere.cpp +++ b/Plugin/CutSphere.cpp @@ -103,25 +103,16 @@ double GMSH_CutSpherePlugin::callbackRecur(int num, int action, double value) 1, 0, 10); } -void GMSH_CutSpherePlugin::getName(char *name) const +std::string GMSH_CutSpherePlugin::getHelp() const { - strcpy(name, "Cut Sphere"); -} - -void GMSH_CutSpherePlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(CutSphere) cuts the view `iView' with the\n" + return "Plugin(CutSphere) cuts the view `iView' with the\n" "sphere (X-`Xc')^2 + (Y-`Yc')^2 + (Z-`Zc')^2 = `R'^2.\n" "If `ExtractVolume' is nonzero, the plugin extracts\n" "the elements inside (if `ExtractVolume' < 0) or\n" "outside (if `ExtractVolume' > 0) the sphere. If\n" "`iView' < 0, the plugin is run on the current view.\n" "\n" - "Plugin(CutSphere) creates one new view.\n"); + "Plugin(CutSphere) creates one new view.\n"; } int GMSH_CutSpherePlugin::getNbOptions() const @@ -134,11 +125,6 @@ StringXNumber *GMSH_CutSpherePlugin::getOption(int iopt) return &CutSphereOptions_Number[iopt]; } -void GMSH_CutSpherePlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "CutSphere failed..."); -} - double GMSH_CutSpherePlugin::levelset(double x, double y, double z, double val) const { diff --git a/Plugin/CutSphere.h b/Plugin/CutSphere.h index d0692fecd38d1137fd89ea1dca85db8c07ce327b..ec634d64e3ed22ed7239f0fb2a787400d9768a8b 100644 --- a/Plugin/CutSphere.h +++ b/Plugin/CutSphere.h @@ -20,9 +20,8 @@ class GMSH_CutSpherePlugin : public GMSH_LevelsetPlugin double step, double min, double max); public: GMSH_CutSpherePlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *helpText) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "CutSphere"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber *getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/Divergence.cpp b/Plugin/Divergence.cpp index a64144152f7c5834fa8c5037bc3ae51ce7fcc2ad..171bb74fcc7f0a6cdbe7971c3c861d51092a6966 100644 --- a/Plugin/Divergence.cpp +++ b/Plugin/Divergence.cpp @@ -19,22 +19,13 @@ extern "C" } } -void GMSH_DivergencePlugin::getName(char *name) const +std::string GMSH_DivergencePlugin::getHelp() const { - strcpy(name, "Divergence"); -} - -void GMSH_DivergencePlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(Divergence) computes the divergence of the\n" + return "Plugin(Divergence) computes the divergence of the\n" "field in the view `iView'. If `iView' < 0, the plugin\n" "is run on the current view.\n" "\n" - "Plugin(Divergence) creates one new view.\n"); + "Plugin(Divergence) creates one new view.\n"; } int GMSH_DivergencePlugin::getNbOptions() const @@ -47,11 +38,6 @@ StringXNumber *GMSH_DivergencePlugin::getOption(int iopt) return &DivergenceOptions_Number[iopt]; } -void GMSH_DivergencePlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "Divergence failed..."); -} - static std::vector<double> *incrementList(PViewDataList *data2, int type) { switch(type){ diff --git a/Plugin/Divergence.h b/Plugin/Divergence.h index 184aeaa6c3bff3ad44f8cbfbda3e4a84ff28e3c6..d100c25c7d39032cd9c8996641db2ae0f4074e83 100644 --- a/Plugin/Divergence.h +++ b/Plugin/Divergence.h @@ -17,9 +17,8 @@ class GMSH_DivergencePlugin : public GMSH_PostPlugin { public: GMSH_DivergencePlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *help_text) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "Divergence"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber *getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/Eigenvalues.cpp b/Plugin/Eigenvalues.cpp index 6dc711a4565fe2d61086a94aeaf27e3311b1f1a9..eba0160e7cc78ea96d259df85f0b5e7b1a4807a3 100644 --- a/Plugin/Eigenvalues.cpp +++ b/Plugin/Eigenvalues.cpp @@ -19,21 +19,13 @@ extern "C" } } -void GMSH_EigenvaluesPlugin::getName(char *name) const +std::string GMSH_EigenvaluesPlugin::getHelp() const { - strcpy(name, "Eigenvalues"); -} - -void GMSH_EigenvaluesPlugin::getInfos(char *author, char *copyright, char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(Eigenvalues) computes the three real\n" + return "Plugin(Eigenvalues) computes the three real\n" "eigenvalues of each tensor in the view `iView'.\n" "If `iView' < 0, the plugin is run on the current view.\n" "\n" - "Plugin(Eigenvalues) creates three new scalar views.\n"); + "Plugin(Eigenvalues) creates three new scalar views.\n"; } int GMSH_EigenvaluesPlugin::getNbOptions() const @@ -46,11 +38,6 @@ StringXNumber *GMSH_EigenvaluesPlugin::getOption(int iopt) return &EigenvaluesOptions_Number[iopt]; } -void GMSH_EigenvaluesPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "Eigenvalues failed..."); -} - static std::vector<double> *incrementList(PViewDataList *data2, int type) { switch(type){ diff --git a/Plugin/Eigenvalues.h b/Plugin/Eigenvalues.h index 88ed35ee88b951d74eeefd932fa001269089fb90..219ce4238aa826143e7cc9144f70f0522942e7ae 100644 --- a/Plugin/Eigenvalues.h +++ b/Plugin/Eigenvalues.h @@ -17,9 +17,8 @@ class GMSH_EigenvaluesPlugin : public GMSH_PostPlugin { public: GMSH_EigenvaluesPlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *helpText) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "Eigenvalues"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber *getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/Eigenvectors.cpp b/Plugin/Eigenvectors.cpp index 8992a1624ebabb078a56bb2b44eddcadb0f5c9a9..14cda42fc6ca5a4ab0ed5c7e9ffb17963a9779c2 100644 --- a/Plugin/Eigenvectors.cpp +++ b/Plugin/Eigenvectors.cpp @@ -21,17 +21,9 @@ extern "C" } } -void GMSH_EigenvectorsPlugin::getName(char *name) const +std::string GMSH_EigenvectorsPlugin::getHelp() const { - strcpy(name, "Eigenvectors"); -} - -void GMSH_EigenvectorsPlugin::getInfos(char *author, char *copyright, char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(Eigenvectors) computes the three (right)\n" + return "Plugin(Eigenvectors) computes the three (right)\n" "eigenvectors of each tensor in the view `iView'\n" "and sorts them according to the value of the\n" "associated eigenvalues. If `ScaleByEigenvalues'\n" @@ -41,7 +33,7 @@ void GMSH_EigenvectorsPlugin::getInfos(char *author, char *copyright, char *help "the plugin is run on the current view.\n" "\n" "Plugin(Eigenvectors) creates three new\n" - "vector views.\n"); + "vector views.\n"; } int GMSH_EigenvectorsPlugin::getNbOptions() const @@ -54,11 +46,6 @@ StringXNumber *GMSH_EigenvectorsPlugin::getOption(int iopt) return &EigenvectorsOptions_Number[iopt]; } -void GMSH_EigenvectorsPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "Eigenvectors failed..."); -} - static std::vector<double> *incrementList(PViewDataList *data2, int type) { switch(type){ diff --git a/Plugin/Eigenvectors.h b/Plugin/Eigenvectors.h index b68e86153617624cf112629ff64946854fb10162..b1a89b09db1b2b96bd9c7fa404d18e0359b652f2 100644 --- a/Plugin/Eigenvectors.h +++ b/Plugin/Eigenvectors.h @@ -17,9 +17,8 @@ class GMSH_EigenvectorsPlugin : public GMSH_PostPlugin { public: GMSH_EigenvectorsPlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *helpText) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "Eigenvectors"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber *getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/Evaluate.cpp b/Plugin/Evaluate.cpp index f06e8a5fb5ab08b5053c9d23cc559ce20e150ce9..2f101e6454f75586b71a752546498a4f23b7f74c 100644 --- a/Plugin/Evaluate.cpp +++ b/Plugin/Evaluate.cpp @@ -32,18 +32,9 @@ extern "C" } } -void GMSH_EvaluatePlugin::getName(char *name) const +std::string GMSH_EvaluatePlugin::getHelp() const { - strcpy(name, "Evaluate"); -} - -void GMSH_EvaluatePlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(Evaluate) sets the `Component'-th\n" + return "Plugin(Evaluate) sets the `Component'-th\n" "component of the `TimeStep'-th time step in the\n" "view `iView' to the expression `Expression'.\n" "`Expression' can contain:\n" @@ -87,7 +78,7 @@ void GMSH_EvaluatePlugin::getInfos(char *author, char *copyright, "`ExternalView' < 0, the plugin uses `iView'\n" "instead.\n" "\n" - "Plugin(Evaluate) is executed in-place.\n"); + "Plugin(Evaluate) is executed in-place.\n"; } int GMSH_EvaluatePlugin::getNbOptions() const @@ -110,11 +101,6 @@ StringXString *GMSH_EvaluatePlugin::getOptionStr(int iopt) return &EvaluateOptions_String[iopt]; } -void GMSH_EvaluatePlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "Evaluate failed..."); -} - PView *GMSH_EvaluatePlugin::execute(PView *v) { int component = (int)EvaluateOptions_Number[0].def; diff --git a/Plugin/Evaluate.h b/Plugin/Evaluate.h index adf2937e07144a9a8be1d7d6c9b87fb4bc1a9cbe..0fb3207aee5b7c0cb1c7c76964eff9621612392f 100644 --- a/Plugin/Evaluate.h +++ b/Plugin/Evaluate.h @@ -17,9 +17,8 @@ class GMSH_EvaluatePlugin : public GMSH_PostPlugin { public: GMSH_EvaluatePlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *helpText) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "Evaluate"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber* getOption(int iopt); int getNbOptionsStr() const; diff --git a/Plugin/Extract.cpp b/Plugin/Extract.cpp index a515275fe474066cc5616bc6a525d7538c90ebe8..9f0168c5c4f8869a7a03902c502033abdeca956a 100644 --- a/Plugin/Extract.cpp +++ b/Plugin/Extract.cpp @@ -40,17 +40,9 @@ extern "C" } } -void GMSH_ExtractPlugin::getName(char *name) const +std::string GMSH_ExtractPlugin::getHelp() const { - strcpy(name, "Extract"); -} - -void GMSH_ExtractPlugin::getInfos(char *author, char *copyright, char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(Extract) extracts a combination of\n" + return "Plugin(Extract) extracts a combination of\n" "components from the `TimeStep'th time step\n" "in the view `iView'. If only `Expression0' is\n" "given (and `Expression1', ..., `Expression8' are\n" @@ -70,7 +62,7 @@ void GMSH_ExtractPlugin::getInfos(char *author, char *copyright, char *help_text "in the view. If `iView' < 0, the plugin is run on\n" "the current view.\n" "\n" - "Plugin(Extract) creates one new view.\n"); + "Plugin(Extract) creates one new view.\n"; } int GMSH_ExtractPlugin::getNbOptions() const @@ -93,11 +85,6 @@ StringXString *GMSH_ExtractPlugin::getOptionStr(int iopt) return &ExtractOptions_String[iopt]; } -void GMSH_ExtractPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "Extract failed..."); -} - static std::vector<double> *incrementList(PViewDataList *data, int numComp, int type) { diff --git a/Plugin/Extract.h b/Plugin/Extract.h index 90bc5a128ce7680b9f3c53a93a023906fbe86ac8..142e1e7f583874c8e2b8d70a51926e94c49c6c17 100644 --- a/Plugin/Extract.h +++ b/Plugin/Extract.h @@ -17,9 +17,8 @@ class GMSH_ExtractPlugin : public GMSH_PostPlugin { public: GMSH_ExtractPlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *helpText) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "Extract"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber* getOption(int iopt); int getNbOptionsStr() const; diff --git a/Plugin/ExtractEdges.cpp b/Plugin/ExtractEdges.cpp index 8a6749d4e861b535985e7c5cf04c8af00ca321d2..88498748415118411ebb4683434e33a4737de1e1 100644 --- a/Plugin/ExtractEdges.cpp +++ b/Plugin/ExtractEdges.cpp @@ -18,27 +18,14 @@ extern "C" } } -GMSH_ExtractEdgesPlugin::GMSH_ExtractEdgesPlugin() +std::string GMSH_ExtractEdgesPlugin::getHelp() const { - ; -} - -void GMSH_ExtractEdgesPlugin::getName(char *name) const -{ - strcpy(name, "Extract Edges"); -} - -void GMSH_ExtractEdgesPlugin::getInfos(char *author, char *copyright, char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(ExtractEdges) extracts the geometry edges\n" + return "Plugin(ExtractEdges) extracts the geometry edges\n" "from the surface view `iView', using `Angle' as\n" "the dihedral angle tolerance. If `iView' < 0, then\n" "plugin is run on the current view.\n" "\n" - "Plugin(ExtractEdges) creates one new view.\n"); + "Plugin(ExtractEdges) creates one new view.\n"; } int GMSH_ExtractEdgesPlugin::getNbOptions() const @@ -51,11 +38,6 @@ StringXNumber *GMSH_ExtractEdgesPlugin::getOption(int iopt) return &ExtractEdgesOptions_Number[iopt]; } -void GMSH_ExtractEdgesPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "Extract Edges failed..."); -} - PView *GMSH_ExtractEdgesPlugin::execute(PView *v) { int iView = (int)ExtractEdgesOptions_Number[1].def; diff --git a/Plugin/ExtractEdges.h b/Plugin/ExtractEdges.h index 278c105004f7bd5bd77f12add6632eabfad35b41..443be94e5b2fa2cef0958e76b436e4f974e8b965 100644 --- a/Plugin/ExtractEdges.h +++ b/Plugin/ExtractEdges.h @@ -16,10 +16,9 @@ extern "C" class GMSH_ExtractEdgesPlugin : public GMSH_PostPlugin { public: - GMSH_ExtractEdgesPlugin(); - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *helpText) const; - void catchErrorMessage(char *errorMessage) const; + GMSH_ExtractEdgesPlugin(){} + std::string getName() const { return "ExtractEdges"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber* getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/ExtractElements.cpp b/Plugin/ExtractElements.cpp index aa0b6a8290c66a31e9139c491010cf43be0b3840..6171bb1f6e40db82b42ba0a0a6dae23a4cca6b41 100644 --- a/Plugin/ExtractElements.cpp +++ b/Plugin/ExtractElements.cpp @@ -23,23 +23,15 @@ extern "C" } } -void GMSH_ExtractElementsPlugin::getName(char *name) const +std::string GMSH_ExtractElementsPlugin::getHelp() const { - strcpy(name, "Extract Elements"); -} - -void GMSH_ExtractElementsPlugin::getInfos(char *author, char *copyright, char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(ExtractElements) extracts the elements\n" + return "Plugin(ExtractElements) extracts the elements\n" "from the view `iView' whose `TimeStep'-th values\n" "(averaged by element) are comprised between\n" "`MinVal' and `MaxVal'. If `iView' < 0, the plugin\n" "is run on the current view.\n" "\n" - "Plugin(ExtractElements) creates one new view.\n"); + "Plugin(ExtractElements) creates one new view.\n"; } int GMSH_ExtractElementsPlugin::getNbOptions() const @@ -52,11 +44,6 @@ StringXNumber *GMSH_ExtractElementsPlugin::getOption(int iopt) return &ExtractElementsOptions_Number[iopt]; } -void GMSH_ExtractElementsPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "ExtractElements failed..."); -} - static void extract(std::vector<double> &inList, int inNb, std::vector<double> &outList, int *outNb, int timeStep, int nbNod, int nbComp) diff --git a/Plugin/ExtractElements.h b/Plugin/ExtractElements.h index d2278b215f842b6ffc60844f699dc16a20f85acc..66611d0219e3e14d643bdf0d01fcc209cb8b5037 100644 --- a/Plugin/ExtractElements.h +++ b/Plugin/ExtractElements.h @@ -17,9 +17,8 @@ class GMSH_ExtractElementsPlugin : public GMSH_PostPlugin { public: GMSH_ExtractElementsPlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *helpText) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "ExtractElements"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber* getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/FieldView.cpp b/Plugin/FieldView.cpp index 80b2fdea461ca329c43f68267fdd640f7879e2e0..84becb32d7dd3b4afa87271fa1a8cfe4cbc23234 100644 --- a/Plugin/FieldView.cpp +++ b/Plugin/FieldView.cpp @@ -21,18 +21,9 @@ extern "C" } } -void GMSH_FieldViewPlugin::getName(char *name) const +std::string GMSH_FieldViewPlugin::getHelp() const { - strcpy(name, "FieldView"); -} - -void GMSH_FieldViewPlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "J. Lambrechts"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(FieldView) evaluates a field on the choosen view.\n"); + return "Plugin(FieldView) evaluates a field on the choosen view.\n"; } int GMSH_FieldViewPlugin::getNbOptions() const @@ -45,11 +36,6 @@ StringXNumber *GMSH_FieldViewPlugin::getOption(int iopt) return &FieldViewOptions_Number[iopt]; } -void GMSH_FieldViewPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "FieldView failed..."); -} - PView *GMSH_FieldViewPlugin::execute(PView *v) { //int comp = (int)FieldViewOptions_Number[0].def; diff --git a/Plugin/FieldView.h b/Plugin/FieldView.h index ed692f32a51023c6415e3d6c1b1af8384af73a0a..b381159e027c7d06536fd714c6b953904ee25d70 100644 --- a/Plugin/FieldView.h +++ b/Plugin/FieldView.h @@ -16,9 +16,9 @@ extern "C" class GMSH_FieldViewPlugin : public GMSH_PostPlugin { public: - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *help_text) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "FieldView"; } + std::string getHelp() const; + std::string getAuthor() const { return "J. Lambrechts"; } int getNbOptions() const; StringXNumber* getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/FiniteElement.cpp b/Plugin/FiniteElement.cpp index b10fd745f11dded29873a7cf442a19bec12470e2..ff06c77d935fa245440e3272dca381f9811f28b2 100644 --- a/Plugin/FiniteElement.cpp +++ b/Plugin/FiniteElement.cpp @@ -40,23 +40,14 @@ extern "C" } } -void GMSH_FiniteElementPlugin::getName(char *name) const +std::string GMSH_FiniteElementPlugin::getHelp() const { - strcpy(name, "Finite Element"); -} - -void GMSH_FiniteElementPlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(FiniteElement) solves simple PDEs\n" + return "Plugin(FiniteElement) solves simple PDEs\n" "using the finite element method. This is only\n" "intended as a demonstration tool: it is NOT\n" "intended for general use." "\n" - "Plugin(FiniteElement) creates a new view.\n"); + "Plugin(FiniteElement) creates a new view.\n"; } int GMSH_FiniteElementPlugin::getNbOptions() const @@ -79,11 +70,6 @@ StringXString *GMSH_FiniteElementPlugin::getOptionStr(int iopt) return &FiniteElementOptions_String[iopt]; } -void GMSH_FiniteElementPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "FiniteElement failed..."); -} - template<class scalar> class gmshMathEvalFunction : public gmshFunction<scalar> { private: diff --git a/Plugin/FiniteElement.h b/Plugin/FiniteElement.h index fd8c92b75e52cbed9639e280d199b67e69c75333..b22e8357e04a0418ec816d66429610cc081cf61a 100644 --- a/Plugin/FiniteElement.h +++ b/Plugin/FiniteElement.h @@ -17,9 +17,8 @@ class GMSH_FiniteElementPlugin : public GMSH_PostPlugin { public: GMSH_FiniteElementPlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *helpText) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "FiniteElement"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber* getOption(int iopt); int getNbOptionsStr() const; diff --git a/Plugin/GSHHS.cpp b/Plugin/GSHHS.cpp index 37af2a83b464bae6ac5f8e0c196dac6690f2f08f..951efd178d6e5ded40db787a603590ec3c4cbbc9 100644 --- a/Plugin/GSHHS.cpp +++ b/Plugin/GSHHS.cpp @@ -56,7 +56,7 @@ public: } }; class reader_gshhs : public reader{ - /* $Id: GSHHS.cpp,v 1.31 2009-08-14 08:25:16 geuzaine Exp $ + /* $Id: GSHHS.cpp,v 1.32 2009-08-15 12:58:51 geuzaine Exp $ * * Include file defining structures used in gshhs.c * @@ -865,9 +865,9 @@ public: new_attractor(); } }; - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *help_text) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "GSHHS"; } + std::string getHelp() const; + std::string getAuthor() const { return "J. Lambrechts"; } int getNbOptions() const; int getNbOptionsStr() const; StringXNumber *getOption(int iopt); @@ -900,41 +900,43 @@ extern "C" } } -void GMSH_GSHHSPlugin::getName(char *name) const +std::string GMSH_GSHHSPlugin::getHelp() const { - strcpy(name, "GSHHS"); -} - -void GMSH_GSHHSPlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "J. Lambrechts"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(GSHHS) read different kind of contour lines data and write a .geo file on the surface of a sphere (the Earth).\n" - "The principal application is to load GSHHS data\n (see http://www.soest.hawaii.edu/wessel/gshhs/gshhs.html).\n" - "Valid values for \"Format\" are ):\n" - " -\"gshhs\" : open GSHHS file\n" - " -\"loops2\" : import 2D contour lines in simple text format :\n" - " NB_POINTS_IN_FIRST_LOOP FIRST_LOOP_IS_CLOSED\n" - " COORD1 COORD2\n" - " COORD1 COORD2\n" - " ... ...\n" - " NB_POINTS_IN_SECOND_LOOP SECOND_LOOP_IS_CLOSED\n" - " ...\n" - " (LOOP_IS_CLOSED specify if this coast line describe a closed curve (0=no, 1=yes).\n" - "In the case of \"loops2\" format, you can specify the the coordinate system used in the input file with the" - "\"Coordinate\" option, valid values are\n" - " -\"lonlat\" for longitude-latidute radian,\n" - " -\"lonlat_degrees\" for longitude-latitude degrees,\n" - " -\"UTM\" for universal transverse mercartor (\"UTMZone\" option should be specified)\n" - " -\"cartesian\" for full 3D coordinates\n" - "\"radius\" specify the earth radius.\n" - "If the \"iField\" option is set, consecutive points closer than the value of the field iField (in meters) will not be added.\n" - "If \"MinStraitsFactor\" >0 and if a field iField is provided, coastlines closer than MinStraitsFactor*field(IField) are merged and inner corners which form an angle < pi/3 are removed.\n" - "The output is always in stereographic coordinates, if the \"WritePolarSphere\" option is not 0, a sphere is added to the geo file.\n" - "WARNING : this plugin is still experimental and need polishing and error-handling. In particular, it will probably crash if an inexistant field id is given or if the input/output cannot be open." - ); + return + "Plugin(GSHHS) read different kind of contour lines data\n" + "and write a .geo file on the surface of a sphere (the Earth).\n" + "The principal application is to load GSHHS data\n (see\n" + "http://www.soest.hawaii.edu/wessel/gshhs/gshhs.html).\n" + "Valid values for \"Format\" are ):\n" + " -\"gshhs\" : open GSHHS file\n" + " -\"loops2\" : import 2D contour lines in simple text format :\n" + " NB_POINTS_IN_FIRST_LOOP FIRST_LOOP_IS_CLOSED\n" + " COORD1 COORD2\n" + " COORD1 COORD2\n" + " ... ...\n" + " NB_POINTS_IN_SECOND_LOOP SECOND_LOOP_IS_CLOSED\n" + " ...\n" + " (LOOP_IS_CLOSED specify if this coast line describe a closed curve\n" + " (0=no, 1=yes).\n" + "In the case of \"loops2\" format, you can specify the the coordinate\n" + "system used in the input file with the \"Coordinate\" option, valid\n" + "values are\n" + " -\"lonlat\" for longitude-latidute radian,\n" + " -\"lonlat_degrees\" for longitude-latitude degrees,\n" + " -\"UTM\" for universal transverse mercartor (\"UTMZone\" option should\n" + " be specified)\n" + " -\"cartesian\" for full 3D coordinates\n" + " -\"radius\" specify the earth radius.\n" + "If the \"iField\" option is set, consecutive points closer than the\n" + "value of the field iField (in meters) will not be added.\n" + "If \"MinStraitsFactor\" >0 and if a field iField is provided, coastlines\n" + "closer than MinStraitsFactor*field(IField) are merged and inner corners\n" + " which form an angle < pi/3 are removed.\n" + "The output is always in stereographic coordinates, if the \"WritePolarSphere\"\n" + "option is not 0, a sphere is added to the geo file.\n" + "WARNING : this plugin is still experimental and need polishing and\n" + "error-handling. In particular, it will probably crash if an inexistant\n" + "field id is given or if the input/output cannot be open.\n"; } int GMSH_GSHHSPlugin::getNbOptions() const @@ -957,11 +959,6 @@ StringXString *GMSH_GSHHSPlugin::getOptionStr(int iopt) return &GSHHSOptions_String[iopt]; } -void GMSH_GSHHSPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "GSHHS failed..."); -} - PView *GMSH_GSHHSPlugin::execute(PView * v) { void projector(SPoint2,SPoint3); diff --git a/Plugin/Gradient.cpp b/Plugin/Gradient.cpp index 0cdecde311fd51e457b8445579ab617223770146..5c6c1cc1a83e7f4bae5e057641e7c775570eba3b 100644 --- a/Plugin/Gradient.cpp +++ b/Plugin/Gradient.cpp @@ -19,22 +19,13 @@ extern "C" } } -void GMSH_GradientPlugin::getName(char *name) const +std::string GMSH_GradientPlugin::getHelp() const { - strcpy(name, "Gradient"); -} - -void GMSH_GradientPlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(Gradient) computes the gradient of the\n" + return "Plugin(Gradient) computes the gradient of the\n" "field in the view `iView'. If `iView' < 0, the\n" "plugin is run on the current view.\n" "\n" - "Plugin(Gradient) creates one new view.\n"); + "Plugin(Gradient) creates one new view.\n"; } int GMSH_GradientPlugin::getNbOptions() const @@ -47,11 +38,6 @@ StringXNumber *GMSH_GradientPlugin::getOption(int iopt) return &GradientOptions_Number[iopt]; } -void GMSH_GradientPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "Gradient failed..."); -} - static std::vector<double> *incrementList(PViewDataList *data2, int numComp, int type) { if(numComp == 1){ diff --git a/Plugin/Gradient.h b/Plugin/Gradient.h index fb367dddefa36da87cbb7a7b5e1490c5e26583a7..0bf3355901775bf7d828230cd0d8e76af489ccd4 100644 --- a/Plugin/Gradient.h +++ b/Plugin/Gradient.h @@ -17,9 +17,8 @@ class GMSH_GradientPlugin : public GMSH_PostPlugin { public: GMSH_GradientPlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *help_text) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "Gradient"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber *getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/HarmonicToTime.cpp b/Plugin/HarmonicToTime.cpp index 7132eb45d388088c65e3760f4df89d44777d8741..97288ab714367221a5d535755e2f805691a04f66 100644 --- a/Plugin/HarmonicToTime.cpp +++ b/Plugin/HarmonicToTime.cpp @@ -21,18 +21,9 @@ extern "C" } } -void GMSH_HarmonicToTimePlugin::getName(char *name) const +std::string GMSH_HarmonicToTimePlugin::getHelp() const { - strcpy(name, "Harmonic to Time"); -} - -void GMSH_HarmonicToTimePlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(HarmonicToTime) takes the values in the\n" + return "Plugin(HarmonicToTime) takes the values in the\n" "time steps `RealPart' and `ImaginaryPart' of\n" "the view `iView', and creates a new view\n" "containing (`iView'[`RealPart'] * cos(p) -\n" @@ -41,7 +32,7 @@ void GMSH_HarmonicToTimePlugin::getInfos(char *author, char *copyright, "If `iView' < 0, the plugin is run on the\n" "current view.\n" "\n" - "Plugin(HarmonicToTime) creates one new view.\n"); + "Plugin(HarmonicToTime) creates one new view.\n"; } int GMSH_HarmonicToTimePlugin::getNbOptions() const @@ -54,11 +45,6 @@ StringXNumber *GMSH_HarmonicToTimePlugin::getOption(int iopt) return &HarmonicToTimeOptions_Number[iopt]; } -void GMSH_HarmonicToTimePlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "HarmonicToTime failed..."); -} - static std::vector<double> *incrementList(PViewDataList *data, int numComp, int type) { diff --git a/Plugin/HarmonicToTime.h b/Plugin/HarmonicToTime.h index 731f434f6134d7ac5635b537f706feda0486c779..df6cc92ef99eddb053e45972529a91f582d29930 100644 --- a/Plugin/HarmonicToTime.h +++ b/Plugin/HarmonicToTime.h @@ -17,9 +17,8 @@ class GMSH_HarmonicToTimePlugin : public GMSH_PostPlugin { public: GMSH_HarmonicToTimePlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *help_text) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "HarmonicToTime"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber* getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/HomologyComputation.cpp b/Plugin/HomologyComputation.cpp index 80cc7e6155b9f93da7b312073bf5646b447d64f7..0f0fa194c1c144c2b7885ffb3bde9aa538ec0239 100644 --- a/Plugin/HomologyComputation.cpp +++ b/Plugin/HomologyComputation.cpp @@ -38,21 +38,12 @@ extern "C" } } -void GMSH_HomologyComputationPlugin::getName(char *name) const +std::string GMSH_HomologyComputationPlugin::getHelp() const { - strcpy(name, "Homology Computation"); -} - -void GMSH_HomologyComputationPlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "Matti Pellikka (matti.pellikka@tut.fi)"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(HomologyComputation) computes generators \n" + return "Plugin(HomologyComputation) computes generators \n" "for (relative) homology groups and their thick cuts. \n" "\n" - "Plugin(HomologyComputation) creates new views.\n"); + "Plugin(HomologyComputation) creates new views.\n"; } int GMSH_HomologyComputationPlugin::getNbOptions() const @@ -75,12 +66,6 @@ StringXString *GMSH_HomologyComputationPlugin::getOptionStr(int iopt) return &HomologyComputationOptions_String[iopt]; } -void GMSH_HomologyComputationPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "Homology Computation failed..."); -} - - PView *GMSH_HomologyComputationPlugin::execute(PView *v) { std::string fileName = HomologyComputationOptions_String[0].def; diff --git a/Plugin/HomologyComputation.h b/Plugin/HomologyComputation.h index b832be52c746bd751e6a7b88eab362fae3e54b60..26f510307372227019cc8c4669fc0120ada92ad7 100644 --- a/Plugin/HomologyComputation.h +++ b/Plugin/HomologyComputation.h @@ -22,9 +22,9 @@ class GMSH_HomologyComputationPlugin : public GMSH_PostPlugin { public: GMSH_HomologyComputationPlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *helpText) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "HomologyComputation"; } + std::string getHelp() const; + std::string getAuthor() const { return "M. Pellikka"; } int getNbOptions() const; StringXNumber *getOption(int iopt); int getNbOptionsStr() const; diff --git a/Plugin/Integrate.cpp b/Plugin/Integrate.cpp index 3b24166ac71e7659ecd42695616c253a84cd1981..db91fa15c999f9e948a578fe7327a4738efef1d7 100644 --- a/Plugin/Integrate.cpp +++ b/Plugin/Integrate.cpp @@ -19,29 +19,15 @@ extern "C" } } -GMSH_IntegratePlugin::GMSH_IntegratePlugin() +std::string GMSH_IntegratePlugin::getHelp() const { - ; -} - -void GMSH_IntegratePlugin::getName(char *name) const -{ - strcpy(name, "Integrate"); -} - -void GMSH_IntegratePlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(Integrate) integrates scalar fields over\n" + return "Plugin(Integrate) integrates scalar fields over\n" "all the elements in the view `iView', as well\n" "as the circulation/flux of vector fields over\n" "line/surface elements. If `iView' < 0, the\n" "plugin is run on the current view.\n" "\n" - "Plugin(Integrate) creates one new view.\n"); + "Plugin(Integrate) creates one new view.\n"; } int GMSH_IntegratePlugin::getNbOptions() const @@ -54,11 +40,6 @@ StringXNumber *GMSH_IntegratePlugin::getOption(int iopt) return &IntegrateOptions_Number[iopt]; } -void GMSH_IntegratePlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "Integrate failed..."); -} - PView *GMSH_IntegratePlugin::execute(PView * v) { int iView = (int)IntegrateOptions_Number[0].def; diff --git a/Plugin/Integrate.h b/Plugin/Integrate.h index 0ed2e6935bdc5196953e058a73a5c4422e70b07d..1433e5f0965de469e1fa48f0d768ae58e12f666e 100644 --- a/Plugin/Integrate.h +++ b/Plugin/Integrate.h @@ -16,10 +16,9 @@ extern "C" class GMSH_IntegratePlugin : public GMSH_PostPlugin { public: - GMSH_IntegratePlugin(); - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *help_text) const; - void catchErrorMessage(char *errorMessage) const; + GMSH_IntegratePlugin(){} + std::string getName() const { return "Integrate"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber* getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/Lambda2.cpp b/Plugin/Lambda2.cpp index a1301e478782b2ad93044d480e8c6ccaa55feb55..66bfddb644be15904da51ccc9f97bf15a7687146 100644 --- a/Plugin/Lambda2.cpp +++ b/Plugin/Lambda2.cpp @@ -19,23 +19,9 @@ extern "C" } } -GMSH_Lambda2Plugin::GMSH_Lambda2Plugin() +std::string GMSH_Lambda2Plugin::getHelp() const { - ; -} - -void GMSH_Lambda2Plugin::getName(char *name) const -{ - strcpy(name, "Lambda2"); -} - -void GMSH_Lambda2Plugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "E. Marchandise"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(Lambda2) computes the eigenvalues\n" + return "Plugin(Lambda2) computes the eigenvalues\n" "Lambda(1,2,3) of the tensor (S_ik S_kj +\n" "Om_ik Om_kj), where S_ij = 0.5 (ui,j + uj,i)\n" "and Om_ij = 0.5 (ui,j - uj,i) are respectively\n" @@ -50,7 +36,7 @@ void GMSH_Lambda2Plugin::getInfos(char *author, char *copyright, "the velocity gradient tensor. If `iView' < 0,\n" "the plugin is run on the current view.\n" "\n" - "Plugin(Lambda2) creates one new view.\n"); + "Plugin(Lambda2) creates one new view.\n"; } int GMSH_Lambda2Plugin::getNbOptions() const @@ -63,11 +49,6 @@ StringXNumber *GMSH_Lambda2Plugin::getOption(int iopt) return &Lambda2Options_Number[iopt]; } -void GMSH_Lambda2Plugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "Lambda2 failed..."); -} - static int inv3x3tran(double mat[3][3], double inv[3][3], double *det) { double ud; diff --git a/Plugin/Lambda2.h b/Plugin/Lambda2.h index 9a6bf6935d905ef9420f98264b1fcf9ad9e7c272..f6b4aa586a96adcc587d2c1048c6487d942a1146 100644 --- a/Plugin/Lambda2.h +++ b/Plugin/Lambda2.h @@ -16,10 +16,10 @@ extern "C" class GMSH_Lambda2Plugin : public GMSH_PostPlugin { public: - GMSH_Lambda2Plugin(); - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *helpText) const; - void catchErrorMessage(char *errorMessage) const; + GMSH_Lambda2Plugin(){} + std::string getName() const { return "Lambda2"; } + std::string getHelp() const; + std::string getAuthor() const { return "E. Marchandise"; } int getNbOptions() const; StringXNumber* getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/LongitudeLatitude.cpp b/Plugin/LongitudeLatitude.cpp index 077a761f72fd93d9f609bdc73090ed19f338ce47..2838fb322db539b6bd2c13c88ce7369c3eed5210 100644 --- a/Plugin/LongitudeLatitude.cpp +++ b/Plugin/LongitudeLatitude.cpp @@ -18,22 +18,13 @@ extern "C" } } -void GMSH_LongituteLatitudePlugin::getName(char *name) const +std::string GMSH_LongituteLatitudePlugin::getHelp() const { - strcpy(name, "LongituteLatitude"); -} - -void GMSH_LongituteLatitudePlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "J. Lambrechts"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(LongituteLatitude) Project the view `iView'\n" + return "Plugin(LongituteLatitude) Project the view `iView'\n" "in Longitude-Latitude. If `iView' < 0, the plugin\n" "is run on the current view.\n" "\n" - "Plugin(LongituteLatitude) is executed in place.\n"); + "Plugin(LongituteLatitude) is executed in place.\n"; } int GMSH_LongituteLatitudePlugin::getNbOptions() const @@ -46,11 +37,6 @@ StringXNumber *GMSH_LongituteLatitudePlugin::getOption(int iopt) return &LongituteLatitudeOptions_Number[iopt]; } -void GMSH_LongituteLatitudePlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "LongituteLatitude failed..."); -} - PView *GMSH_LongituteLatitudePlugin::execute(PView *v) { int iView = (int)LongituteLatitudeOptions_Number[0].def; diff --git a/Plugin/LongitudeLatitude.h b/Plugin/LongitudeLatitude.h index cdb84c437ede21b429992b604f06c5aec776c534..8c44703db34d8ab2b02c96af48d34a4b36fbfe67 100644 --- a/Plugin/LongitudeLatitude.h +++ b/Plugin/LongitudeLatitude.h @@ -16,9 +16,9 @@ extern "C" class GMSH_LongituteLatitudePlugin : public GMSH_PostPlugin { public: - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *help_text) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "LongitudeLatitude"; } + std::string getHelp() const; + std::string getAuthor() const { return "J. Lambrechts"; } int getNbOptions() const; StringXNumber* getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/MakeSimplex.cpp b/Plugin/MakeSimplex.cpp index 62f6a85364684da29e9a72aec67e2485ea972d0a..c4409248ed09589288b7400f942a551adb241c13 100644 --- a/Plugin/MakeSimplex.cpp +++ b/Plugin/MakeSimplex.cpp @@ -17,30 +17,16 @@ extern "C" } } -GMSH_MakeSimplexPlugin::GMSH_MakeSimplexPlugin() +std::string GMSH_MakeSimplexPlugin::getHelp() const { - ; -} - -void GMSH_MakeSimplexPlugin::getName(char *name) const -{ - strcpy(name, "Make Simplex"); -} - -void GMSH_MakeSimplexPlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(MakeSimplex) decomposes all non-\n" + return "Plugin(MakeSimplex) decomposes all non-\n" "simplectic elements (quadrangles, prisms,\n" "hexahedra, pyramids) in the view `iView' into\n" "simplices (triangles, tetrahedra). If `iView' < 0,\n" "the plugin is run on the current view.\n" "\n" "Plugin(MakeSimplex) is executed\n" - "in-place.\n"); + "in-place.\n"; } int GMSH_MakeSimplexPlugin::getNbOptions() const @@ -53,11 +39,6 @@ StringXNumber *GMSH_MakeSimplexPlugin::getOption(int iopt) return &MakeSimplexOptions_Number[iopt]; } -void GMSH_MakeSimplexPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "MakeSimplex failed..."); -} - static void decomposeList(PViewDataList *data, int nbNod, int nbComp, std::vector<double> &listIn, int *nbIn, std::vector<double> &listOut, int *nbOut) diff --git a/Plugin/MakeSimplex.h b/Plugin/MakeSimplex.h index 2a4531b0ce9c52511243c042485100808d36f55d..e9ec5ca910cb6713baf0a4919c75ccf689ec0817 100644 --- a/Plugin/MakeSimplex.h +++ b/Plugin/MakeSimplex.h @@ -16,10 +16,9 @@ extern "C" class GMSH_MakeSimplexPlugin : public GMSH_PostPlugin { public: - GMSH_MakeSimplexPlugin(); - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *help_text) const; - void catchErrorMessage(char *errorMessage) const; + GMSH_MakeSimplexPlugin(){} + std::string getName() const { return "MakeSimplex"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber* getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/ModulusPhase.cpp b/Plugin/ModulusPhase.cpp index d77ac7dcc4f45028dee81e045215618ba43696c0..5a9df02caf16ea47a8c7e1bd2a35632e445543e4 100644 --- a/Plugin/ModulusPhase.cpp +++ b/Plugin/ModulusPhase.cpp @@ -19,25 +19,16 @@ extern "C" } } -void GMSH_ModulusPhasePlugin::getName(char *name) const +std::string GMSH_ModulusPhasePlugin::getHelp() const { - strcpy(name, "Modulus Phase"); -} - -void GMSH_ModulusPhasePlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(ModulusPhase) interprets the time steps\n" + return "Plugin(ModulusPhase) interprets the time steps\n" "`realPart' and `imaginaryPart' in the view `iView'\n" "as the real and imaginary parts of a complex field\n" "and replaces them with their corresponding\n" "modulus and phase. If `iView' < 0, the plugin is\n" "run on the current view.\n" "\n" - "Plugin(ModulusPhase) is executed in-place.\n"); + "Plugin(ModulusPhase) is executed in-place.\n"; } int GMSH_ModulusPhasePlugin::getNbOptions() const @@ -50,11 +41,6 @@ StringXNumber *GMSH_ModulusPhasePlugin::getOption(int iopt) return &ModulusPhaseOptions_Number[iopt]; } -void GMSH_ModulusPhasePlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "ModulusPhase failed..."); -} - PView *GMSH_ModulusPhasePlugin::execute(PView *v) { int rIndex = (int)ModulusPhaseOptions_Number[0].def; diff --git a/Plugin/ModulusPhase.h b/Plugin/ModulusPhase.h index ca8210dfa540c3c1285eca5d35071d614ec7f820..7b739542089b6c6f6dd6a78235b95fa4e0c1bda1 100644 --- a/Plugin/ModulusPhase.h +++ b/Plugin/ModulusPhase.h @@ -17,9 +17,8 @@ class GMSH_ModulusPhasePlugin : public GMSH_PostPlugin { public: GMSH_ModulusPhasePlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *help_text) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "ModulusPhase"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber *getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/Plugin.cpp b/Plugin/Plugin.cpp index ca4725e1b3768bae2ae7931720bd9a4be94e70a0..c7057a26a12589c7e4073bf628b86815f1baa5ea 100644 --- a/Plugin/Plugin.cpp +++ b/Plugin/Plugin.cpp @@ -3,8 +3,15 @@ // See the LICENSE.txt file for license information. Please report all // bugs and problems to <gmsh@geuz.org>. +#include <stdio.h> #include "Plugin.h" +void GMSH_Plugin::catchErrorMessage(char *errorMessage) const +{ + std::string str = getName() + "failed..."; + strcpy(errorMessage, str.c_str()); +} + PView *GMSH_PostPlugin::getView(int index, PView *view) { if(index < 0) diff --git a/Plugin/Plugin.h b/Plugin/Plugin.h index 63dcadcb339e17d02fdac196038dca604af9af27..daef4658d9d90adbd55c516f0db0bf7f24050046 100644 --- a/Plugin/Plugin.h +++ b/Plugin/Plugin.h @@ -13,8 +13,7 @@ // Some Plugins are default gmsh plugins and are insterted directly // in the executable. I think that it's a good way to start. -#include <string.h> -#include <stdio.h> +#include <string> #include "Options.h" #include "GmshMessage.h" #include "PView.h" @@ -46,12 +45,14 @@ class GMSH_Plugin // return plugin type, name and info virtual GMSH_PLUGIN_TYPE getType() const = 0; - virtual void getName(char *name) const = 0; - virtual void getInfos(char *author, char *copyright, char *helpText) const = 0; + virtual std::string getName() const = 0; + virtual std::string getHelp() const = 0; + virtual std::string getAuthor() const { return "C. Geuzaine, J.-F. Remacle"; } + virtual std::string getCopyright() const { return "C. Geuzaine, J.-F. Remacle"; } // when an error is thrown by the plugin, the plugin manager will // show the message and hopefully continue - virtual void catchErrorMessage(char *errorMessage) const = 0; + virtual void catchErrorMessage(char *errorMessage) const; // gmsh-style numeric options virtual int getNbOptions() const = 0; diff --git a/Plugin/PluginManager.cpp b/Plugin/PluginManager.cpp index 54a7232cff62875688f533eeb88d754b02fe8578..59e04320ad386e35c7b939b0b530037162127c9d 100644 --- a/Plugin/PluginManager.cpp +++ b/Plugin/PluginManager.cpp @@ -5,8 +5,8 @@ #include <map> #include <stdlib.h> - #include "GmshConfig.h" +#include "StringUtils.h" #include "Context.h" #include "Plugin.h" #include "PluginManager.h" @@ -58,19 +58,16 @@ const char *GMSH_PluginEntry = "GMSH_RegisterPlugin"; PluginManager *PluginManager::_instance = 0; -PluginManager::PluginManager() -{ -} - PluginManager::~PluginManager() { - for(iter it = allPlugins.begin(); it != allPlugins.end(); ++it) + for(std::map<std::string, GMSH_Plugin*>::iterator it = allPlugins.begin(); + it != allPlugins.end(); ++it) delete(*it).second; } -GMSH_Plugin *PluginManager::find(char *pluginName) +GMSH_Plugin *PluginManager::find(std::string pluginName) { - iter it = allPlugins.find(pluginName); + std::map<std::string, GMSH_Plugin*>::iterator it = allPlugins.find(pluginName); if(it == allPlugins.end()) return 0; return (*it).second; @@ -78,8 +75,8 @@ GMSH_Plugin *PluginManager::find(char *pluginName) GMSH_SolverPlugin *PluginManager::findSolverPlugin() { - iter it = allPlugins.begin(); - iter ite = allPlugins.end(); + std::map<std::string, GMSH_Plugin*>::iterator it = allPlugins.begin(); + std::map<std::string, GMSH_Plugin*>::iterator ite = allPlugins.end(); for (; it != ite; ++it) { GMSH_Plugin *p = (*it).second; if(p->getType() == GMSH_Plugin::GMSH_SOLVER_PLUGIN) { @@ -89,54 +86,42 @@ GMSH_SolverPlugin *PluginManager::findSolverPlugin() return 0; } -void PluginManager::action(char *pluginName, char *action, void *data) +void PluginManager::action(std::string pluginName, std::string action, void *data) { GMSH_Plugin *plugin = find(pluginName); - if(!plugin) - throw "Unknown plugin name"; + if(!plugin) throw "Unknown plugin name"; - if(!strcmp(action, "Run")) + if(action == "Run") plugin->run(); else throw "Unknown plugin action"; } -void PluginManager::setPluginOption(char *pluginName, char *option, - char *value) +void PluginManager::setPluginOption(std::string pluginName, std::string option, + std::string value) { GMSH_Plugin *plugin = find(pluginName); - - if(!plugin) - throw "Unknown plugin name"; + if(!plugin) throw "Unknown plugin name"; for(int i = 0; i < plugin->getNbOptionsStr(); i++) { - StringXString *sxs; - // get the ith option of the plugin - sxs = plugin->getOptionStr(i); - // look if it's the good option name - if(!strcmp(sxs->str, option)) { + StringXString *sxs = plugin->getOptionStr(i); + if(option == std::string(sxs->str)) { sxs->def = value; return; } } - throw "Unknown plugin option name"; } -void PluginManager::setPluginOption(char *pluginName, char *option, +void PluginManager::setPluginOption(std::string pluginName, std::string option, double value) { GMSH_Plugin *plugin = find(pluginName); - - if(!plugin) - throw "Unknown plugin name"; + if(!plugin) throw "Unknown plugin name"; for(int i = 0; i < plugin->getNbOptions(); i++) { - StringXNumber *sxn; - // get the ith option of the plugin - sxn = plugin->getOption(i); - // look if it's the good option name - if(!strcmp(sxn->str, option)) { + StringXNumber *sxn = plugin->getOption(i); + if(option == std::string(sxn->str)) { sxn->def = value; return; } @@ -146,9 +131,7 @@ void PluginManager::setPluginOption(char *pluginName, char *option, PluginManager *PluginManager::instance() { - if(!_instance) { - _instance = new PluginManager; - } + if(!_instance) _instance = new PluginManager; return _instance; } @@ -159,98 +142,93 @@ void PluginManager::registerDefaultPlugins() } if(CTX::instance()->post.plugins){ - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("StreamLines", GMSH_RegisterStreamLinesPlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("CutGrid", GMSH_RegisterCutGridPlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("CutMap", GMSH_RegisterCutMapPlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("CutPlane", GMSH_RegisterCutPlanePlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("CutSphere", GMSH_RegisterCutSpherePlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("Skin", GMSH_RegisterSkinPlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("Extract", GMSH_RegisterExtractPlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("ExtractElements", GMSH_RegisterExtractElementsPlugin())); #if 0 // waiting for BDS rewrite - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("ExtractEdges", GMSH_RegisterExtractEdgesPlugin())); #endif - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("MakeSimplex", GMSH_RegisterMakeSimplexPlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("Smooth", GMSH_RegisterSmoothPlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("Transform", GMSH_RegisterTransformPlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("LongitudeLatitude",GMSH_RegisterLongituteLatitudePlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("Warp", GMSH_RegisterWarpPlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("SphericalRaise", GMSH_RegisterSphericalRaisePlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("HarmonicToTime", GMSH_RegisterHarmonicToTimePlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("ModulusPhase", GMSH_RegisterModulusPhasePlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("Integrate", GMSH_RegisterIntegratePlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("Gradient", GMSH_RegisterGradientPlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("Curl", GMSH_RegisterCurlPlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("Divergence", GMSH_RegisterDivergencePlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("Annotate", GMSH_RegisterAnnotatePlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("Remove", GMSH_RegisterRemovePlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("Eigenvectors", GMSH_RegisterEigenvectorsPlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("Eigenvalues", GMSH_RegisterEigenvaluesPlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("Lambda2", GMSH_RegisterLambda2Plugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("Probe", GMSH_RegisterProbePlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("FieldView", GMSH_RegisterFieldViewPlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("Triangulate", GMSH_RegisterTriangulatePlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("GSHHS", GMSH_RegisterGSHHSPlugin())); #if defined(HAVE_MATH_EVAL) - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("Evaluate", GMSH_RegisterEvaluatePlugin())); - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("CutParametric", GMSH_RegisterCutParametricPlugin())); #endif - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("FiniteElement", GMSH_RegisterFiniteElementPlugin())); #if defined(HAVE_KBIPACK) - allPlugins.insert(std::pair<const char*, GMSH_Plugin*> + allPlugins.insert(std::pair<std::string, GMSH_Plugin*> ("HomologyComputation", GMSH_RegisterHomologyComputationPlugin())); #endif } #if defined(HAVE_FLTK) - char *homeplugins = getenv("GMSHPLUGINSHOME"); - if(!homeplugins) return; + char *pluginsHome = getenv("GMSHPLUGINSHOME"); + if(!pluginsHome) return; struct dirent **list; - int nbFiles = fl_filename_list(homeplugins, &list); + int nbFiles = fl_filename_list(pluginsHome, &list); if(nbFiles <= 0) return; for(int i = 0; i < nbFiles; i++) { - char *name = list[i]->d_name; - if(strlen(name) > 3) { - char ext[6]; - strcpy(ext, name + (strlen(name) - 3)); - if(!strcmp(ext, ".so") || !strcmp(ext, "dll")) { - addPlugin(homeplugins, name); - } - } + std::string ext = SplitFileName(list[i]->d_name)[2]; + if(ext == ".so" || ext == ".dll") + addPlugin(list[i]->d_name); } for(int i = 0; i < nbFiles; i++) free(list[i]); @@ -258,42 +236,36 @@ void PluginManager::registerDefaultPlugins() #endif } -void PluginManager::addPlugin(char *dirName, char *pluginName) +void PluginManager::addPlugin(std::string fileName) { #if defined(HAVE_NO_DLL) || !defined(HAVE_FLTK) Msg::Warning("No dynamic plugin loading on this platform"); #else - char dynamic_lib[1024]; - char plugin_name[256]; - char plugin_author[256]; - char plugin_copyright[256]; - char plugin_help[1024]; - class GMSH_Plugin *(*registerPlugin) (void); - sprintf(dynamic_lib, "%s/%s", dirName, pluginName); - Msg::Info("Opening Plugin '%s'", dynamic_lib); - void *hlib = dlopen(dynamic_lib, RTLD_NOW); + Msg::Info("Opening Plugin '%s'", fileName.c_str()); + void *hlib = dlopen(fileName.c_str(), RTLD_NOW); const char *err = dlerror(); if(!hlib){ - Msg::Warning("Error in opening %s (dlerror = %s)", dynamic_lib, err); + Msg::Warning("Could not open '%s' (dlerror = %s)", fileName.c_str(), err); return; } + + class GMSH_Plugin *(*registerPlugin) (void); registerPlugin = (class GMSH_Plugin * (*)(void))dlsym(hlib, GMSH_PluginEntry); err = dlerror(); if(err){ - Msg::Warning("Symbol '%s' missing in plugin '%s' (dlerror = %s)", - GMSH_PluginEntry, pluginName, err); + Msg::Warning("Symbol '%s' missing in '%s' (dlerror = %s)", + GMSH_PluginEntry, fileName.c_str(), err); return; } GMSH_Plugin *p = registerPlugin(); p->hlib = hlib; - p->getName(plugin_name); - p->getInfos(plugin_author, plugin_copyright, plugin_help); - if(allPlugins.find(plugin_name) != allPlugins.end()) { - Msg::Warning("Plugin '%s' multiply defined", pluginName); + if(allPlugins.find(p->getName()) != allPlugins.end()) { + Msg::Warning("Plugin '%s' multiply defined", fileName.c_str()); return; } - allPlugins.insert(std::pair<const char*, GMSH_Plugin*>(plugin_name, p)); - Msg::Info("Loaded Plugin '%s' (%s)", plugin_name, plugin_author); + + allPlugins.insert(std::pair<std::string, GMSH_Plugin*>(p->getName(), p)); + Msg::Info("Loaded Plugin '%s' (%s)", p->getName().c_str(), p->getAuthor().c_str()); #endif } diff --git a/Plugin/PluginManager.h b/Plugin/PluginManager.h index c43d2e0638bbe377eecd37bfbb2686bb6be34554..6504545408b484ae3aa214fe156e1d24521df4b7 100644 --- a/Plugin/PluginManager.h +++ b/Plugin/PluginManager.h @@ -6,30 +6,21 @@ #ifndef _PLUGIN_MANAGER_H_ #define _PLUGIN_MANAGER_H_ -#include <cstring> #include <map> +#include <string> class GMSH_Plugin; class GMSH_SolverPlugin; -struct ltstrpg -{ - bool operator()(const char* s1, const char* s2) const - { - return strcmp(s1, s2) < 0; - } -}; - class PluginManager { private: - PluginManager(); + PluginManager(){} static PluginManager *_instance; - std::map<const char*, GMSH_Plugin*, ltstrpg> allPlugins; + std::map<std::string, GMSH_Plugin*> allPlugins; public : virtual ~PluginManager(); - typedef std::map<const char*, GMSH_Plugin*, ltstrpg>::iterator iter; // register all the plugins that are in $(GMSHPLUGINSHOME). (Note // that loading a .so is not what is usually called a 'plugin': we @@ -39,28 +30,30 @@ class PluginManager static PluginManager *instance(); // Dynamically add a plugin pluginName.so in dirName - void addPlugin(char *dirName, char *pluginName); + void addPlugin(std::string fileName); // Uninstall a given plugin - void uninstallPlugin(char *pluginName); + void uninstallPlugin(std::string pluginName); // Set an option to a value in plugin named pluginName - void setPluginOption(char *pluginName, char *option, double value); - void setPluginOption(char *pluginName, char *option, char *value); + void setPluginOption(std::string pluginName, std::string option, + double value); + void setPluginOption(std::string pluginName, std::string option, + std::string value); // Iterator on plugins - inline iter begin(){ return allPlugins.begin(); } - inline iter end(){ return allPlugins.end(); } + std::map<std::string, GMSH_Plugin*>::iterator begin(){ return allPlugins.begin(); } + std::map<std::string, GMSH_Plugin*>::iterator end(){ return allPlugins.end(); } // Find a plugin named pluginName - GMSH_Plugin *find(char *pluginName); + GMSH_Plugin *find(std::string pluginName); // Get The ONLY Solver Plugin GMSH_SolverPlugin *findSolverPlugin(); // Perform an action on the plugin. Default action are Run and // Save. Other plugins may perform other actions. - void action(char *pluginMane, char *action, void *data); + void action(std::string pluginName, std::string action, void *data); }; #endif diff --git a/Plugin/Probe.cpp b/Plugin/Probe.cpp index 0090235a7e47007ebd83be14fb0697c69267c6e8..28baaf2db49ba81d58a392dfb9c07e2ef29a1725 100644 --- a/Plugin/Probe.cpp +++ b/Plugin/Probe.cpp @@ -99,22 +99,13 @@ double GMSH_ProbePlugin::callbackZ(int num, int action, double value) return callback(num, action, value, &ProbeOptions_Number[2].def); } -void GMSH_ProbePlugin::getName(char *name) const +std::string GMSH_ProbePlugin::getHelp() const { - strcpy(name, "Probe"); -} - -void GMSH_ProbePlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(Probe) gets the value of the view `iView' at\n" + return "Plugin(Probe) gets the value of the view `iView' at\n" "the point (`X',`Y',`Z'). If `iView' < 0, the plugin is\n" "run on the current view.\n" "\n" - "Plugin(Probe) creates one new view.\n"); + "Plugin(Probe) creates one new view.\n"; } int GMSH_ProbePlugin::getNbOptions() const @@ -127,11 +118,6 @@ StringXNumber *GMSH_ProbePlugin::getOption(int iopt) return &ProbeOptions_Number[iopt]; } -void GMSH_ProbePlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "Probe failed..."); -} - PView *GMSH_ProbePlugin::execute(PView *v) { double x = ProbeOptions_Number[0].def; diff --git a/Plugin/Probe.h b/Plugin/Probe.h index bd8879111ef6e5eef9d95cbd497bbe5846bd53ae..8a4eab7a7d380c18043b66a5485a66adb6c6af3f 100644 --- a/Plugin/Probe.h +++ b/Plugin/Probe.h @@ -20,9 +20,8 @@ class GMSH_ProbePlugin : public GMSH_PostPlugin static int iview; public: GMSH_ProbePlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *helpText) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "Probe"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber *getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/Remove.cpp b/Plugin/Remove.cpp index 325db88e29dc11f6d4530b4319a6762ddd921ce5..2c7c56e0fcaae16957e09be07d9ae896bb2d472e 100644 --- a/Plugin/Remove.cpp +++ b/Plugin/Remove.cpp @@ -30,22 +30,13 @@ extern "C" } } -void GMSH_RemovePlugin::getName(char *name) const +std::string GMSH_RemovePlugin::getHelp() const { - strcpy(name, "Remove"); -} - -void GMSH_RemovePlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(Remove) removes the marked items\n" + return "Plugin(Remove) removes the marked items\n" "from the view `iView'. If `iView' < 0, the plugin\n" "is run on the current view.\n" "\n" - "Plugin(Remove) is executed in-place.\n"); + "Plugin(Remove) is executed in-place.\n"; } int GMSH_RemovePlugin::getNbOptions() const @@ -58,11 +49,6 @@ StringXNumber *GMSH_RemovePlugin::getOption(int iopt) return &RemoveOptions_Number[iopt]; } -void GMSH_RemovePlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "Remove failed..."); -} - PView *GMSH_RemovePlugin::execute(PView *v) { int iView = (int)RemoveOptions_Number[13].def; diff --git a/Plugin/Remove.h b/Plugin/Remove.h index aec2d06d930bbd61331661d5c68a5de4c5344c22..7f3f5793a0bf9803db7a758a86481a4e3f871f68 100644 --- a/Plugin/Remove.h +++ b/Plugin/Remove.h @@ -17,9 +17,8 @@ class GMSH_RemovePlugin : public GMSH_PostPlugin { public: GMSH_RemovePlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *helpText) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "Remove"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber *getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/Skin.cpp b/Plugin/Skin.cpp index 3156d783ac995641ebb3f10f9226d23302a04abd..efe2b033321942db7ef63f490852d9724e743edf 100644 --- a/Plugin/Skin.cpp +++ b/Plugin/Skin.cpp @@ -20,21 +20,13 @@ extern "C" } } -void GMSH_SkinPlugin::getName(char *name) const +std::string GMSH_SkinPlugin::getHelp() const { - strcpy(name, "Skin"); -} - -void GMSH_SkinPlugin::getInfos(char *author, char *copyright, char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(Skin) extracts the skin (the boundary) of\n" + return "Plugin(Skin) extracts the skin (the boundary) of\n" "the view `iView'. If `iView' < 0, the plugin is run\n" "on the current view.\n" "\n" - "Plugin(Skin) creates one new view.\n"); + "Plugin(Skin) creates one new view.\n"; } int GMSH_SkinPlugin::getNbOptions() const @@ -47,11 +39,6 @@ StringXNumber *GMSH_SkinPlugin::getOption(int iopt) return &SkinOptions_Number[iopt]; } -void GMSH_SkinPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "Skin failed..."); -} - class ElmData { public: int numComp; diff --git a/Plugin/Skin.h b/Plugin/Skin.h index f7082cf5ffb5fae9940cb85e690087d45dac084b..150ca9e613c4380c11a1446371dff37a388ad26b 100644 --- a/Plugin/Skin.h +++ b/Plugin/Skin.h @@ -17,9 +17,8 @@ class GMSH_SkinPlugin : public GMSH_PostPlugin { public: GMSH_SkinPlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *helpText) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "Skin"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber *getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/Smooth.cpp b/Plugin/Smooth.cpp index 28a1531ce2c41525bd8fc1e80627dcffa9fcda20..1aea6a82c76150670f8973254e074175b29f79b6 100644 --- a/Plugin/Smooth.cpp +++ b/Plugin/Smooth.cpp @@ -17,22 +17,13 @@ extern "C" } } -void GMSH_SmoothPlugin::getName(char *name) const +std::string GMSH_SmoothPlugin::getHelp() const { - strcpy(name, "Smooth"); -} - -void GMSH_SmoothPlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(Smooth) averages the values at the nodes\n" + return "Plugin(Smooth) averages the values at the nodes\n" "of the scalar view `iView'. If `iView' < 0, the\n" "plugin is run on the current view.\n" "\n" - "Plugin(Smooth) is executed in-place.\n"); + "Plugin(Smooth) is executed in-place.\n"; } int GMSH_SmoothPlugin::getNbOptions() const @@ -45,11 +36,6 @@ StringXNumber *GMSH_SmoothPlugin::getOption(int iopt) return &SmoothOptions_Number[iopt]; } -void GMSH_SmoothPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "Smooth failed..."); -} - PView *GMSH_SmoothPlugin::execute(PView *v) { int iView = (int)SmoothOptions_Number[0].def; diff --git a/Plugin/Smooth.h b/Plugin/Smooth.h index 8ac56c603aea89003ee651e5e556725dd75cecad..d53c57a36e18294cd6cff1edcc4d61a1c836b140 100644 --- a/Plugin/Smooth.h +++ b/Plugin/Smooth.h @@ -17,9 +17,8 @@ class GMSH_SmoothPlugin : public GMSH_PostPlugin { public: GMSH_SmoothPlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *help_text) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "Smooth"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber *getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/SphericalRaise.cpp b/Plugin/SphericalRaise.cpp index f74f07eaf00bdedb841402afcf378233290f9f34..53de2a702352d4b909e22598258d90f71a8641f2 100644 --- a/Plugin/SphericalRaise.cpp +++ b/Plugin/SphericalRaise.cpp @@ -24,18 +24,9 @@ extern "C" } } -void GMSH_SphericalRaisePlugin::getName(char *name) const +std::string GMSH_SphericalRaisePlugin::getHelp() const { - strcpy(name, "Spherical Raise"); -} - -void GMSH_SphericalRaisePlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(SphericalRaise) transforms the\n" + return "Plugin(SphericalRaise) transforms the\n" "coordinates of the elements in the view\n" "`iView' using the values associated with the\n" "`TimeStep'-th time step. Instead of elevating\n" @@ -49,7 +40,7 @@ void GMSH_SphericalRaisePlugin::getInfos(char *author, char *copyright, "If `iView' < 0, the plugin is run on the current\n" "view.\n" "\n" - "Plugin(SphericalRaise) is executed in-place.\n"); + "Plugin(SphericalRaise) is executed in-place.\n"; } int GMSH_SphericalRaisePlugin::getNbOptions() const @@ -62,11 +53,6 @@ StringXNumber *GMSH_SphericalRaisePlugin::getOption(int iopt) return &SphericalRaiseOptions_Number[iopt]; } -void GMSH_SphericalRaisePlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "SphericalRaise failed..."); -} - PView *GMSH_SphericalRaisePlugin::execute(PView *v) { double center[3]; diff --git a/Plugin/SphericalRaise.h b/Plugin/SphericalRaise.h index 8ee260113d010591cdb9612b467e0208a3ddfb52..8dec8f7bddc2f5f561e237b4963e3369e2519dca 100644 --- a/Plugin/SphericalRaise.h +++ b/Plugin/SphericalRaise.h @@ -17,9 +17,8 @@ class GMSH_SphericalRaisePlugin : public GMSH_PostPlugin { public: GMSH_SphericalRaisePlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *helpText) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "SphericalRaise"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber *getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/StreamLines.cpp b/Plugin/StreamLines.cpp index 6800e1bd46840dc5ee826a0cd86c5d3021faada9..93a55f8b5445fcd45336976ebc8727254cf0a19b 100644 --- a/Plugin/StreamLines.cpp +++ b/Plugin/StreamLines.cpp @@ -140,18 +140,9 @@ double GMSH_StreamLinesPlugin::callbackV(int num, int action, double value) 1, 1, 100); } -void GMSH_StreamLinesPlugin::getName(char *name) const +std::string GMSH_StreamLinesPlugin::getHelp() const { - strcpy(name, "Stream Lines"); -} - -void GMSH_StreamLinesPlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(StreamLines) computes stream lines\n" + return "Plugin(StreamLines) computes stream lines\n" "from the `TimeStep'-th time step of a vector\n" "view `iView' and optionally interpolates the\n" "scalar view `dView' on the resulting stream\n" @@ -172,7 +163,7 @@ void GMSH_StreamLinesPlugin::getInfos(char *author, char *copyright, "\n" "Plugin(StreamLines) creates one new view. This\n" "view contains multi-step vector points if `dView'\n" - "< 0, or single-step scalar lines if `dView' >= 0.\n"); + "< 0, or single-step scalar lines if `dView' >= 0.\n"; } int GMSH_StreamLinesPlugin::getNbOptions() const @@ -185,11 +176,6 @@ StringXNumber *GMSH_StreamLinesPlugin::getOption(int iopt) return &StreamLinesOptions_Number[iopt]; } -void GMSH_StreamLinesPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "StreamLines failed..."); -} - int GMSH_StreamLinesPlugin::getNbU() { return (int)StreamLinesOptions_Number[9].def; diff --git a/Plugin/StreamLines.h b/Plugin/StreamLines.h index 42075298880fa298bb1fb3eacc2431738111e699..a3a480095138539aa255391365f83e51ab2cd01e 100644 --- a/Plugin/StreamLines.h +++ b/Plugin/StreamLines.h @@ -19,9 +19,8 @@ class GMSH_StreamLinesPlugin : public GMSH_PostPlugin double step, double min, double max); public: GMSH_StreamLinesPlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *help_text) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "StreamLines"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber *getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/Transform.cpp b/Plugin/Transform.cpp index 2319b2f5ca0188f68300a0fb8da405a9a7606067..74f385cba9de2d8b1811c831dcd4669376a48625 100644 --- a/Plugin/Transform.cpp +++ b/Plugin/Transform.cpp @@ -30,18 +30,9 @@ extern "C" } } -void GMSH_TransformPlugin::getName(char *name) const +std::string GMSH_TransformPlugin::getHelp() const { - strcpy(name, "Transform"); -} - -void GMSH_TransformPlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(Transform) transforms the homogeneous\n" + return "Plugin(Transform) transforms the homogeneous\n" "node coordinates (x,y,z,1) of the elements in\n" "the view `iView' by the matrix\n" "[`A11' `A12' `A13' `Tx']\n" @@ -51,7 +42,7 @@ void GMSH_TransformPlugin::getInfos(char *author, char *copyright, "elements is reversed. If `iView' < 0, the plugin\n" "is run on the current view.\n" "\n" - "Plugin(Transform) is executed in-place.\n"); + "Plugin(Transform) is executed in-place.\n"; } int GMSH_TransformPlugin::getNbOptions() const @@ -64,11 +55,6 @@ StringXNumber *GMSH_TransformPlugin::getOption(int iopt) return &TransformOptions_Number[iopt]; } -void GMSH_TransformPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "Transform failed..."); -} - PView *GMSH_TransformPlugin::execute(PView *v) { double mat[3][4]; diff --git a/Plugin/Transform.h b/Plugin/Transform.h index 6732293f2dd9929651efb97d8714f03a57f96b9c..2384d9bad3dd69f3b3f45e73351b9091e2a1624a 100644 --- a/Plugin/Transform.h +++ b/Plugin/Transform.h @@ -17,9 +17,8 @@ class GMSH_TransformPlugin : public GMSH_PostPlugin { public: GMSH_TransformPlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *help_text) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "Transform"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber *getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/Triangulate.cpp b/Plugin/Triangulate.cpp index 17738fcb03e5b849a775f8e3fbb4a3e6345b7447..971da9cc5ccfca0f840d45275016ae06eb92047e 100644 --- a/Plugin/Triangulate.cpp +++ b/Plugin/Triangulate.cpp @@ -24,24 +24,15 @@ extern "C" } } -void GMSH_TriangulatePlugin::getName(char *name) const +std::string GMSH_TriangulatePlugin::getHelp() const { - strcpy(name, "Triangulate"); -} - -void GMSH_TriangulatePlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(Triangulate) triangulates the points in the\n" + return "Plugin(Triangulate) triangulates the points in the\n" "view `iView', assuming that all the points belong\n" "to a surface that can be projected one-to-one\n" "onto a plane. If `iView' < 0, the plugin is run on\n" "the current view.\n" "\n" - "Plugin(Triangulate) creates one new view.\n"); + "Plugin(Triangulate) creates one new view.\n"; } int GMSH_TriangulatePlugin::getNbOptions() const @@ -54,11 +45,6 @@ StringXNumber *GMSH_TriangulatePlugin::getOption(int iopt) return &TriangulateOptions_Number[iopt]; } -void GMSH_TriangulatePlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "Triangulate failed..."); -} - class PointData : public MVertex { public: std::vector<double> v; diff --git a/Plugin/Triangulate.h b/Plugin/Triangulate.h index f8a280ab19e8b2718fc6686acb1ae174acf4d61f..4b804c7ad09a0acabf5f236c05895e3e5e6df4c8 100644 --- a/Plugin/Triangulate.h +++ b/Plugin/Triangulate.h @@ -17,9 +17,8 @@ class GMSH_TriangulatePlugin : public GMSH_PostPlugin { public: GMSH_TriangulatePlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *helpText) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "Triangulate"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber* getOption(int iopt); PView *execute(PView *); diff --git a/Plugin/Warp.cpp b/Plugin/Warp.cpp index 207f5487daf29efd76615f2dc5cc009425e83c34..dacea71d8425ef158fbbb6ad6d76cd6533906d8c 100644 --- a/Plugin/Warp.cpp +++ b/Plugin/Warp.cpp @@ -23,18 +23,9 @@ extern "C" } } -void GMSH_WarpPlugin::getName(char *name) const +std::string GMSH_WarpPlugin::getHelp() const { - strcpy(name, "Warp"); -} - -void GMSH_WarpPlugin::getInfos(char *author, char *copyright, - char *help_text) const -{ - strcpy(author, "C. Geuzaine, J.-F. Remacle"); - strcpy(copyright, "C. Geuzaine, J.-F. Remacle"); - strcpy(help_text, - "Plugin(Warp) transforms the elements in the\n" + return "Plugin(Warp) transforms the elements in the\n" "view `iView' by adding to their node coordinates\n" "the vector field stored in the `TimeStep'-th time\n" "step of the view `dView', scaled by `Factor'. If\n" @@ -45,7 +36,7 @@ void GMSH_WarpPlugin::getInfos(char *author, char *copyright, "parameter.) If `iView' < 0, the plugin is run on\n" "the current view.\n" "\n" - "Plugin(Warp) is executed in-place.\n"); + "Plugin(Warp) is executed in-place.\n"; } int GMSH_WarpPlugin::getNbOptions() const @@ -58,11 +49,6 @@ StringXNumber *GMSH_WarpPlugin::getOption(int iopt) return &WarpOptions_Number[iopt]; } -void GMSH_WarpPlugin::catchErrorMessage(char *errorMessage) const -{ - strcpy(errorMessage, "Warp failed..."); -} - PView *GMSH_WarpPlugin::execute(PView *v) { double factor = WarpOptions_Number[0].def; diff --git a/Plugin/Warp.h b/Plugin/Warp.h index deb87e3cc82ae1a328018f229c8569d1da9a44d2..fbd8cee35da4dfb156f1ee9a88bad1bfb5427cfd 100644 --- a/Plugin/Warp.h +++ b/Plugin/Warp.h @@ -17,9 +17,8 @@ class GMSH_WarpPlugin : public GMSH_PostPlugin { public: GMSH_WarpPlugin(){} - void getName(char *name) const; - void getInfos(char *author, char *copyright, char *help_text) const; - void catchErrorMessage(char *errorMessage) const; + std::string getName() const { return "Warp"; } + std::string getHelp() const; int getNbOptions() const; StringXNumber *getOption(int iopt); PView *execute(PView *);