diff --git a/Plugin/DecomposeInSimplex.cpp b/Plugin/DecomposeInSimplex.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bb6957d8c0cc9a2d431299594e89dd611a9c0901 --- /dev/null +++ b/Plugin/DecomposeInSimplex.cpp @@ -0,0 +1,120 @@ +// $Id: DecomposeInSimplex.cpp,v 1.1 2003-06-18 20:47:41 geuzaine Exp $ +// +// Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle +// +// 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 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// +// Please report all bugs and problems to "gmsh@geuz.org". + +#include "Plugin.h" +#include "DecomposeInSimplex.h" +#include "List.h" +#include "Tree.h" +#include "Views.h" +#include "Context.h" +#include "Malloc.h" + +extern Context_T CTX; + +StringXNumber DecomposeInSimplexOptions_Number[] = { + {GMSH_FULLRC, "iView", NULL, -1.} +}; + +extern "C" +{ + GMSH_Plugin *GMSH_RegisterDecomposeInSimplexPlugin() + { + return new GMSH_DecomposeInSimplexPlugin(); + } +} + +GMSH_DecomposeInSimplexPlugin::GMSH_DecomposeInSimplexPlugin() +{ + ; +} + +void GMSH_DecomposeInSimplexPlugin::getName(char *name) const +{ + strcpy(name, "DecomposeInSimplex"); +} + +void GMSH_DecomposeInSimplexPlugin::getInfos(char *author, char *copyright, + char *help_text) const +{ + strcpy(author, "C. Geuzaine (geuz@geuz.org)"); + strcpy(copyright, "DGR (www.multiphysics.com)"); + strcpy(help_text, + "Decompose any non-simplectic elements in\n" + "the view into simplices.\n" + "Script name: Plugin(DecomposeInSimplex).\n"); +} + +int GMSH_DecomposeInSimplexPlugin::getNbOptions() const +{ + return sizeof(DecomposeInSimplexOptions_Number) / sizeof(StringXNumber); +} + +StringXNumber *GMSH_DecomposeInSimplexPlugin::GetOption(int iopt) +{ + return &DecomposeInSimplexOptions_Number[iopt]; +} + +void GMSH_DecomposeInSimplexPlugin::CatchErrorMessage(char *errorMessage) const +{ + strcpy(errorMessage, "DecomposeInSimplex failed..."); +} + +Post_View *GMSH_DecomposeInSimplexPlugin::execute(Post_View * v) +{ + Post_View *vv; + + int iView = (int)DecomposeInSimplexOptions_Number[0].def; + + if(v && iView < 0) + vv = v; + else { + if(!v && iView < 0) + iView = 0; + if(!(vv = (Post_View *) List_Pointer_Test(CTX.post.list, iView))) { + Msg(WARNING, "View[%d] does not exist", iView); + return 0; + } + } + + if(vv->NbSQ || vv->NbVQ || vv->NbTQ) { // quad + } + + if(vv->NbSH || vv->NbVH || vv->NbTH) { // hexa + } + + if(vv->NbSI || vv->NbVI || vv->NbTI) { // prism + } + + if(vv->NbSY || vv->NbVY || vv->NbTY) { // pyram + } + + return 0; +} + +void GMSH_DecomposeInSimplexPlugin::Run() +{ + execute(0); +} + +void GMSH_DecomposeInSimplexPlugin::Save() +{ + ; +} diff --git a/Plugin/DecomposeInSimplex.h b/Plugin/DecomposeInSimplex.h new file mode 100644 index 0000000000000000000000000000000000000000..3e16857ce9b8df41d93bb2de7cabc5206e3c25a7 --- /dev/null +++ b/Plugin/DecomposeInSimplex.h @@ -0,0 +1,43 @@ +#ifndef _DECOMPOSE_IN_SIMPLEX_H_ +#define _DECOMPOSE_IN_SIMPLEX_H_ + +// Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle +// +// 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 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// +// Please report all bugs and problems to "gmsh@geuz.org". + +extern "C" +{ + GMSH_Plugin *GMSH_RegisterDecomposeInSimplexPlugin (); +} + +class GMSH_DecomposeInSimplexPlugin : public GMSH_Post_Plugin +{ +public: + GMSH_DecomposeInSimplexPlugin(); + void Run(); + void Save(); + void getName (char *name) const; + void getInfos (char *author, + char *copyright, + char *help_text) const; + void CatchErrorMessage (char *errorMessage) const; + int getNbOptions() const; + StringXNumber* GetOption (int iopt); + Post_View *execute (Post_View *); +}; +#endif diff --git a/Plugin/Harmonic2Time.cpp b/Plugin/Harmonic2Time.cpp index d0c03224fa0da44c7f0579937c75de813b133552..571f6caa995b786d780c7655ecc6b473d1a9ec3c 100644 --- a/Plugin/Harmonic2Time.cpp +++ b/Plugin/Harmonic2Time.cpp @@ -1,4 +1,4 @@ -// $Id: Harmonic2Time.cpp,v 1.4 2003-03-21 00:52:45 geuzaine Exp $ +// $Id: Harmonic2Time.cpp,v 1.5 2003-06-18 20:47:41 geuzaine Exp $ // // Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle // @@ -51,7 +51,7 @@ GMSH_Harmonic2TimePlugin::GMSH_Harmonic2TimePlugin() void GMSH_Harmonic2TimePlugin::getName(char *name) const { - strcpy(name, ""); + strcpy(name, "Harmonic2Time"); } void GMSH_Harmonic2TimePlugin::getInfos(char *author, char *copyright, diff --git a/Plugin/Makefile b/Plugin/Makefile index a9f20e479741edcc7f4b6106ce071abc6bcde399..7b24e05b5d4334409eec0c9535f6ed172a5927d8 100644 --- a/Plugin/Makefile +++ b/Plugin/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.35 2003-03-21 00:52:46 geuzaine Exp $ +# $Id: Makefile,v 1.36 2003-06-18 20:47:41 geuzaine Exp $ # # Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle # @@ -34,6 +34,7 @@ SRC = Plugin.cpp\ Triangulate.cpp\ SphericalRaise.cpp\ Skin.cpp\ + DecomposeInSimplex.cpp\ Harmonic2Time.cpp OBJ = ${SRC:.cpp=.o} @@ -95,6 +96,10 @@ SphericalRaise.o: SphericalRaise.cpp Plugin.h ../Common/Options.h \ Skin.o: Skin.cpp Plugin.h ../Common/Options.h ../Common/Message.h Skin.h \ ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../Common/Views.h \ ../Common/ColorTable.h ../Common/Context.h ../DataStr/Malloc.h +DecomposeInSimplex.o: DecomposeInSimplex.cpp Plugin.h ../Common/Options.h\ + ../Common/Message.h DecomposeInSimplex.h \ + ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../Common/Views.h \ + ../Common/ColorTable.h ../Common/Context.h ../DataStr/Malloc.h Harmonic2Time.o: Harmonic2Time.cpp Plugin.h ../Common/Options.h \ ../Common/Message.h Harmonic2Time.h ../DataStr/List.h ../Common/Views.h \ ../Common/ColorTable.h ../Common/Context.h ../Numeric/Numeric.h diff --git a/Plugin/Plugin.cpp b/Plugin/Plugin.cpp index f1b21d7b57fb33355fcc9e71bdc0ede929ea3344..92bc9b3d8dc2e475e50e0d08ad3959f54542e279 100644 --- a/Plugin/Plugin.cpp +++ b/Plugin/Plugin.cpp @@ -1,4 +1,4 @@ -// $Id: Plugin.cpp,v 1.40 2003-03-21 00:52:46 geuzaine Exp $ +// $Id: Plugin.cpp,v 1.41 2003-06-18 20:47:41 geuzaine Exp $ // // Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle // @@ -36,6 +36,8 @@ #include "CutPlane.h" #include "CutSphere.h" #include "Skin.h" +#include "Harmonic2Time.h" +#include "DecomposeInSimplex.h" #include "Smooth.h" #include "Transform.h" #include "Triangulate.h" @@ -129,30 +131,30 @@ GMSH_PluginManager *GMSH_PluginManager::Instance() void GMSH_PluginManager::RegisterDefaultPlugins() { - allPlugins.insert(std::pair < char *, GMSH_Plugin * >("CutMap", - GMSH_RegisterCutMapPlugin - ())); - allPlugins.insert(std::pair < char *, - GMSH_Plugin * >("CutPlane", - GMSH_RegisterCutPlanePlugin())); - allPlugins.insert(std::pair < char *, - GMSH_Plugin * >("CutSphere", - GMSH_RegisterCutSpherePlugin())); - allPlugins.insert(std::pair < char *, - GMSH_Plugin * >("Skin", GMSH_RegisterSkinPlugin())); - allPlugins.insert(std::pair < char *, - GMSH_Plugin * >("Smooth", GMSH_RegisterSmoothPlugin())); - allPlugins.insert(std::pair < char *, - GMSH_Plugin * >("Transform", - GMSH_RegisterTransformPlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("CutMap", GMSH_RegisterCutMapPlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("CutPlane", GMSH_RegisterCutPlanePlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("CutSphere", GMSH_RegisterCutSpherePlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("Skin", GMSH_RegisterSkinPlugin())); +#if 0 // not ready yet + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("Harmonic2Time", GMSH_RegisterHarmonic2TimePlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("DecomposeInSimplex", GMSH_RegisterDecomposeInSimplexPlugin())); +#endif + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("Smooth", GMSH_RegisterSmoothPlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("Transform", GMSH_RegisterTransformPlugin())); #if defined(HAVE_TRIANGLE) - allPlugins.insert(std::pair < char *, - GMSH_Plugin * >("Triangulate", - GMSH_RegisterTriangulatePlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("Triangulate", GMSH_RegisterTriangulatePlugin())); #endif - allPlugins.insert(std::pair < char *, - GMSH_Plugin * >("SphericalRaise", - GMSH_RegisterSphericalRaisePlugin())); + allPlugins.insert(std::pair < char *, GMSH_Plugin * > + ("SphericalRaise", GMSH_RegisterSphericalRaisePlugin())); #if defined(HAVE_FLTK) struct dirent **list;