diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 22f980c7b247f360979c74302177ffb4a6090443..ee02235ddf4e24c2394d52da9c2f8f4cd786db5b 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,5 +1,6 @@ -// $Id: Callbacks.cpp,v 1.38 2001-03-05 23:14:57 remacle Exp $ +// $Id: Callbacks.cpp,v 1.39 2001-03-06 04:38:56 remacle Exp $ +#include <map> #include "Gmsh.h" #include "GmshUI.h" #include "Geo.h" @@ -1447,9 +1448,25 @@ void view_options_cb(CALLBACK_ARGS){ void view_plugin_cb(CALLBACK_ARGS){ char name[256]; - GMSH_Plugin *p = (GMSH_Plugin*)data; + std::pair<int,GMSH_Plugin*> *pair = (std::pair<int,GMSH_Plugin*>*)data; + int iView = pair->first; + GMSH_Post_Plugin *p = (GMSH_Post_Plugin*)pair->second; p->getName(name); - Msg(INFO,"Plugin %s called",name); + // here we should perhaps launch + // a dialogbox for setting up Plugin + // properties + try + { + Post_View *v = (Post_View*)List_Pointer(Post_ViewList,iView); + p->execute(v); + Msg(INFO,"Plugin %s was called",name); + } + catch (GMSH_Plugin *err) + { + p->CatchErrorMessage(name); + Msg(WARNING,"%s",name); + } + // } void view_options_custom_cb(CALLBACK_ARGS){ diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index cdb0cb808e1a07da2f05dbde32827140a0810167..8dcb6ed1356914b8e7292287a1e7537bbd9faafb 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.55 2001-03-05 23:14:57 remacle Exp $ +// $Id: GUI.cpp,v 1.56 2001-03-06 04:38:56 remacle Exp $ // To make the interface as visually consistent as possible, please: // - use the BH, BW, WB, IW values for button heights/widths, window borders, etc. @@ -505,7 +505,7 @@ void GUI::wait(){ //********************************* Create the menu window ***************************** -void add_post_plugins ( Fl_Menu_Button *button ) +void add_post_plugins ( Fl_Menu_Button *button , int iView) { char name[256],menuname[256]; for(GMSH_PluginManager::iter it = GMSH_PluginManager::Instance()->begin(); @@ -516,8 +516,11 @@ void add_post_plugins ( Fl_Menu_Button *button ) if(p->getType() == GMSH_Plugin::GMSH_POST_PLUGIN) { p->getName(name); + std::pair<int,GMSH_Plugin*> *pair = + new std::pair<int,GMSH_Plugin*>(iView,p); sprintf(menuname,"Plugins/%s",name); - button->add(menuname, 0,(Fl_Callback *)view_plugin_cb, (void*)p, 0); + button->add(menuname, 0,(Fl_Callback *)view_plugin_cb, + (void*)(pair), 0); } } } @@ -595,7 +598,7 @@ void GUI::create_menu_window(int argc, char **argv){ (Fl_Callback *)view_applybgmesh_cb, (void*)i, FL_MENU_DIVIDER); m_popup_butt[i]->add("Options...", 0, (Fl_Callback *)view_options_cb, (void*)i, 0); - add_post_plugins ( m_popup_butt[i] ); + add_post_plugins ( m_popup_butt[i] , i); m_popup_butt[i]->textsize(CTX.fontsize); m_popup_butt[i]->hide(); } diff --git a/Makefile b/Makefile index 25ec4993ad5f3ec982368b72bc73786762589b32..3dd0dbd2db57c460f5c6f3e2e10eb41d3c1b2deb 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.74 2001-03-05 23:13:02 remacle Exp $ +# $Id: Makefile,v 1.75 2001-03-06 04:38:56 remacle Exp $ # ---------------------------------------------------------------------- # Makefile for Gmsh # ---------------------------------------------------------------------- @@ -17,7 +17,7 @@ MOTIF_INC = -I/usr/X11R6/LessTif/Motif1.2/include FLTK_INC = -I$(HOME)/SOURCES/fltk FLTK_INC_SCOREC = -I/users/develop/develop/visual/fltk/1.0/include - FLTK_INC_LAPTOPJF = -I../../fltk-1.0.9 + FLTK_INC_LAPTOPJF = -I../../fltk-1.0.9 FLTK_INC_GERTHA_BURO = -I../../fltk OPENGL_LIB = -lGLU -lGL diff --git a/Plugin/Cutplane/CutPlane.cpp b/Plugin/Cutplane/CutPlane.cpp index 15d68020831597eee8774184bb44a03a7c9031b3..9ee89f9b5d5a72fab53d89d98197ff2216481eb3 100644 --- a/Plugin/Cutplane/CutPlane.cpp +++ b/Plugin/Cutplane/CutPlane.cpp @@ -1,5 +1,7 @@ #include "CutPlane.h" -//#include "Views.h" +#include "List.h" +#include "Views.h" +#include "Iso.h" /* Plugin Entry : GMSH_RegisterPlugin */ @@ -10,6 +12,7 @@ GMSH_Plugin *GMSH_RegisterPlugin () } } + GMSH_CutPlanePlugin::GMSH_CutPlanePlugin(double A, double B, double C, double D) :a(A),b(B),c(C),d(D) { @@ -43,13 +46,46 @@ void GMSH_CutPlanePlugin::CatchErrorMessage (char *errorMessage) const strcpy(errorMessage,"CutPlane Failed..."); } -Post_View *GMSH_CutPlanePlugin::execute (Post_View *) +Post_View *GMSH_CutPlanePlugin::execute (Post_View *v) { - throw this; + int i,nb,edtet[6][2] = {{0,1},{0,2},{0,3},{1,2},{1,3},{2,3}}; + /* for all scalar simplices */ + if(v->NbSS) + { + nb = List_Nbr(v->ST) / v->NbST ; + for(i = 0 ; i < List_Nbr(v->ST) ; i+=nb) + { + double levels[4],Xp[4],Yp[4],Zp[4]; + double *X = (double*)List_Pointer_Fast(v->SS,i); + double *Y = (double*)List_Pointer_Fast(v->SS,i+4); + double *Z = (double*)List_Pointer_Fast(v->SS,i+8); + for(int j=0;j<4;j++)levels[j] = levelset(X[j],Y[j],Z[j]); + double *VAL = (double*)List_Pointer_Fast(v->SS,i+12); + int nx = 0; + for(int k=0;k<6;k++) + { + if(levels[edtet[k][0]] * levels[edtet[k][1]] <= 0.0) + { + InterpolateIso(X,Y,Z,levels,0.0, + edtet[k][0],edtet[k][1], + &Xp[nx],&Yp[nx],&Zp[nx]); + nx++; + } + } + if(nx == 3) + { + } + } + } + return 0; } void GMSH_CutPlanePlugin::SetOption (char *optionName, void *optionValue) { } +double GMSH_CutPlanePlugin :: levelset (double x, double y, double z) +{ + return a * x + b * y + c * z + d; +} diff --git a/Plugin/Cutplane/CutPlane.h b/Plugin/Cutplane/CutPlane.h index 5624284d1af91f21f452349a79cecd7d9772e254..54ab0fd7541f32ea17f03af5a04fd8bcb7d56c2a 100644 --- a/Plugin/Cutplane/CutPlane.h +++ b/Plugin/Cutplane/CutPlane.h @@ -5,6 +5,7 @@ class GMSH_CutPlanePlugin : public GMSH_Post_Plugin { /*Plane a x + b y + c z + d = 0*/ double a,b,c,d; + double levelset (double x, double y, double z); public: GMSH_CutPlanePlugin(double A, double B, double C, double D); virtual void getName (char *name) const; diff --git a/Plugin/Cutplane/Makefile b/Plugin/Cutplane/Makefile index 5a71d9ea476f83747f0d183c5cd2723eb00d9685..9139f33feb4e095e908da758d5db3e70245b2a74 100644 --- a/Plugin/Cutplane/Makefile +++ b/Plugin/Cutplane/Makefile @@ -1,17 +1,17 @@ -# $Id: Makefile,v 1.3 2001-03-05 23:14:57 remacle Exp $ +# $Id: Makefile,v 1.4 2001-03-06 04:38:56 remacle Exp $ # # Makefile for "libAdapt.a" # .IGNORE: -CC = c++ -AR = c++ -Wl,--subsystem,windows -shared -o +CC = c++ -fPIC +AR = gcc -shared -o RM = rm RANLIB = ranlib LIB = ../lib/libCutPlane.so -INCLUDE = -I../../Common -I../ +INCLUDE = -I../../Common -I../../DataStr -I../ -I../../Graphics C_FLAGS = -g -Wall OS_FLAGS =