Skip to content
Snippets Groups Projects
Commit 52448dce authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

Add infrastructure for DecomposeInSimplex plugin
parent 18d19d41
No related branches found
No related tags found
No related merge requests found
// $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()
{
;
}
#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
// $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,
......
# $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
// $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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment