Newer
Older
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software

Christophe Geuzaine
committed
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// To create a plugin for gmsh:
// 1) Create a dynamin lib (.so) containing 1 symbol
// GMSH_Plugin * GMSH_RegisterPlugin ();
// 2) When there is an unacceptable error in the plugin,
// just throw this, the plugin manager will be able to
// catch the exception.
// Some Plugins are default gmsh plugins and are insterted
// directly in the executable. I think that it's a good
// way to start.
public :
// 4 kinds of plugins
typedef enum {
GMSH_CAD_PLUGIN,
GMSH_MESH_PLUGIN,
GMSH_POST_PLUGIN,
GMSH_SOLVE_PLUGIN
} GMSH_PLUGIN_TYPE;
// a dialog box for the user interface
GMSH_Plugin() : dialogBox(0), hlib(0) {}
virtual ~GMSH_Plugin(){}
// return plugin type, name and info
virtual void getName(char *name) const = 0;
virtual void getInfos(char *author, char *copyright, char *helpText) const = 0;
// show the message and hopefully continue
virtual int getNbOptionsStr() const = 0;
virtual StringXString *getOptionStr(int iopt) = 0;
// run the plugin
// The base class for post-processing plugins. The user can either
// modify or duplicate a post-processing view
class GMSH_Post_Plugin : public GMSH_Plugin
{
inline GMSH_PLUGIN_TYPE getType() const { return GMSH_Plugin::GMSH_POST_PLUGIN; }
virtual int getNbOptionsStr() const { return 0; }
virtual StringXString *getOptionStr(int iopt) { return NULL; }
// if the returned pointer is the same as the argument, then the
// view is simply modified, else, a new view is added in the view
// list
virtual PView *execute(PView *) = 0;
// get the view given an index and a default value
virtual PView *getView(int index, PView *view);
// get the data in list format
virtual PViewDataList *getDataList(PView *view);
virtual void assignSpecificVisibility() const {}
virtual bool geometricalFilter(Double_Matrix *) const { return true; }
// The base class for solver plugins. The idea is to be able to
// associate some properties to physical entities, so that we can
// interface gmsh with a solver (ABAQUS...), i.e., create the input
// file for the solver
class GMSH_Solve_Plugin : public GMSH_Plugin
{
public:
virtual int getNbOptionsStr() const { return 0; }
virtual StringXString *getOptionStr(int iopt) { return 0; }
virtual int getNbOptions() const { return 0; }
virtual StringXNumber *getOption(int iopt) { return 0; };
inline GMSH_PLUGIN_TYPE getType() const { return GMSH_Plugin::GMSH_SOLVE_PLUGIN; }
// popup dialog box
virtual void popupPropertiesForPhysicalEntity(int dim) = 0;
virtual void receiveNewPhysicalGroup(int dim, int id) = 0;
// load the solver input file related to the gmsh geo file
virtual void readSolverFile(const char *) = 0;
// save the solver file
virtual void writeSolverFile(const char *) const = 0;
// enhance graphics for a giver geo point
// enhance graphics for a giver geo line
virtual bool GL_enhanceLine(int CurveId, Vertex *v1, Vertex *v2) { return false; }