Skip to content
Snippets Groups Projects
Commit 04a0d9ff authored by Jean-François Remacle's avatar Jean-François Remacle
Browse files

*** empty log message ***

parent 57ce29ca
No related branches found
No related tags found
No related merge requests found
// $Id: CutCircle.cpp,v 1.1 2004-06-15 16:17:58 remacle Exp $
//
// Copyright (C) 1997-2004 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 "CutCircle.h"
#include "List.h"
#include "Context.h"
#include <math.h>
extern Context_T CTX;
StringXNumber CutCircleOptions_Number[] = {
{GMSH_FULLRC, "Xc", NULL, 0.},
{GMSH_FULLRC, "Yc", NULL, 0.},
{GMSH_FULLRC, "Zc", NULL, 0.},
{GMSH_FULLRC, "R", NULL, 1},
{GMSH_FULLRC, "nbPoints", NULL, 360},
{GMSH_FULLRC, "iView", NULL, -1.}
};
extern "C"
{
GMSH_Plugin *GMSH_RegisterCutCirclePlugin()
{
return new GMSH_CutCirclePlugin();
}
}
GMSH_CutCirclePlugin::GMSH_CutCirclePlugin()
{
;
}
void GMSH_CutCirclePlugin::getName(char *name) const
{
strcpy(name, "Cut circle");
}
void GMSH_CutCirclePlugin::getInfos(char *author, char *copyright,
char *help_text) const
{
strcpy(author, "J.-F. Remacle (remacle@gce.ucl.ac.be)");
strcpy(copyright, "DGR (www.multiphysics.com)");
strcpy(help_text,
"Plugin(CutCircle) cuts the view `iView' with\n"
"the circle centered at Xc,Yc,Zc and of Radius R If\n"
"`iView' < 0, the plugin is run on the current\n"
"view.\n"
"\n"
"Plugin(CutCircle) creates one new view.\n");
}
int GMSH_CutCirclePlugin::getNbOptions() const
{
return sizeof(CutCircleOptions_Number) / sizeof(StringXNumber);
}
StringXNumber *GMSH_CutCirclePlugin::getOption(int iopt)
{
return &CutCircleOptions_Number[iopt];
}
void GMSH_CutCirclePlugin::catchErrorMessage(char *errorMessage) const
{
strcpy(errorMessage, "CutCircle failed...");
}
void GMSH_CutCirclePlugin::getPoint(const double &u, double &x, double &y, double &z) const
{
const double Xc =CutCircleOptions_Number[0].def;
const double Yc =CutCircleOptions_Number[1].def;
const double Zc =CutCircleOptions_Number[2].def;
const double R =CutCircleOptions_Number[3].def;
const double theta = u * 2 * 3.1415926;
x = Xc + R * cos (theta);
y = Yc + R * sin (theta);
z = 0.0;
}
int GMSH_CutCirclePlugin::getNbPoints() const
{
return (int)CutCircleOptions_Number[4].def;
}
Post_View *GMSH_CutCirclePlugin::execute(Post_View * v)
{
int iView = (int)CutCircleOptions_Number[5].def;
if(iView < 0)
iView = v ? v->Index : 0;
if(!List_Pointer_Test(CTX.post.list, iView)) {
Msg(GERROR, "View[%d] does not exist", iView);
return v;
}
Post_View *v1 = (Post_View*)List_Pointer(CTX.post.list, iView);
return GMSH_CutCurvePlugin:: GenerateView(v1);
}
#ifndef _CUT_CIRCLE_H_
#define _CUT_CIRCLE_H
// Copyright (C) 1997-2004 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 "CutCurve.h"
extern "C"
{
GMSH_Plugin *GMSH_RegisterCutCirclePlugin ();
}
class GMSH_CutCirclePlugin : public GMSH_CutCurvePlugin
{
virtual void getPoint ( const double &u , double &x, double &y, double &z) const ;
virtual int getNbPoints ( ) const ;
public:
GMSH_CutCirclePlugin();
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: CutCurve.cpp,v 1.1 2004-06-15 16:17:58 remacle Exp $
//
// Copyright (C) 1997-2004 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 "OctreePost.h"
#include "CutCurve.h"
#include "List.h"
#include "Context.h"
#include "Views.h"
#include "Message.h"
extern Context_T CTX;
GMSH_CutCurvePlugin::GMSH_CutCurvePlugin()
{
;
}
Post_View * GMSH_CutCurvePlugin::GenerateView(Post_View * v) const
{
Post_View * View = BeginView(1);
double *VALUES = new double [9*v->NbTimeStep];
OctreePost o(v);
for(int i = 0; i < getNbPoints(); ++i){
const double xi = (double)(i)/(double)(getNbPoints()-1);
double x,y,z;
getPoint (xi,x,y,z);
if(v->NbSS || v->NbSH || v->NbST || v->NbSQ){
List_Add(View->SP, &x);
List_Add(View->SP, &y);
List_Add(View->SP, &z);
View->NbSP++;
o.searchScalar(x, y, z, VALUES);
for(int k = 0; k < v->NbTimeStep; ++k){
List_Add(View->SP, &VALUES[k]);
}
}
}
char name[1024], filename[1024];
sprintf(name, "%s_CutCurve", v->Name);
sprintf(filename, "%s_CutCurve.pos", v->Name);
EndView(View, v->NbTimeStep, filename, name);
delete [] VALUES;
return View;
}
#ifndef _CUT_GRID_H_
#define _CUT_GRID_H
// Copyright (C) 1997-2004 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"
class GMSH_CutCurvePlugin : public GMSH_Post_Plugin
{
protected:
virtual void getPoint ( const double &u , double &x, double &y, double &z) const = 0;
virtual int getNbPoints ( ) const = 0;
public:
GMSH_CutCurvePlugin();
virtual Post_View * GenerateView (Post_View * v) const ;
};
#endif
# $Id: Makefile,v 1.49 2004-05-29 10:11:12 geuzaine Exp $
# $Id: Makefile,v 1.50 2004-06-15 16:17:58 remacle Exp $
#
# Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
#
......@@ -28,8 +28,8 @@ CFLAGS = -DMPICH_SKIP_MPICXX ${OPTIM} ${FLAGS} ${INCLUDE}
SRC = Plugin.cpp\
Levelset.cpp\
CutPlane.cpp CutSphere.cpp CutMap.cpp\
Smooth.cpp\
CutPlane.cpp CutSphere.cpp CutMap.cpp \
Smooth.cpp CutCurve.cpp CutCircle.cpp\
Octree.cpp OctreeInternals.cpp OctreePost.cpp\
StreamLines.cpp CutGrid.cpp\
Transform.cpp\
......@@ -68,10 +68,10 @@ depend:
Plugin.o: Plugin.cpp Plugin.h ../Common/Options.h ../Common/Message.h \
../Common/Views.h ../Common/ColorTable.h ../DataStr/List.h \
../Common/VertexArray.h PluginManager.h CutMap.h Levelset.h CutGrid.h \
StreamLines.h CutPlane.h CutSphere.h Skin.h ../DataStr/Tree.h \
../DataStr/avl.h Extract.h Harmonic2Time.h DecomposeInSimplex.h \
Smooth.h Transform.h Triangulate.h SphericalRaise.h DisplacementRaise.h \
Evaluate.h
StreamLines.h CutPlane.h CutCircle.h CutCurve.h CutSphere.h Skin.h \
../DataStr/Tree.h ../DataStr/avl.h Extract.h Harmonic2Time.h \
DecomposeInSimplex.h Smooth.h Transform.h Triangulate.h \
SphericalRaise.h DisplacementRaise.h Evaluate.h
Levelset.o: Levelset.cpp Levelset.h Plugin.h ../Common/Options.h \
../Common/Message.h ../Common/Views.h ../Common/ColorTable.h \
../DataStr/List.h ../Common/VertexArray.h DecomposeInSimplex.h \
......@@ -91,6 +91,14 @@ CutMap.o: CutMap.cpp CutMap.h Levelset.h Plugin.h ../Common/Options.h \
Smooth.o: Smooth.cpp Plugin.h ../Common/Options.h ../Common/Message.h \
../Common/Views.h ../Common/ColorTable.h ../DataStr/List.h \
../Common/VertexArray.h Smooth.h ../Common/Context.h
CutCurve.o: CutCurve.cpp OctreePost.h Octree.h OctreeInternals.h \
CutCurve.h Plugin.h ../Common/Options.h ../Common/Message.h \
../Common/Views.h ../Common/ColorTable.h ../DataStr/List.h \
../Common/VertexArray.h ../Common/Context.h
CutCircle.o: CutCircle.cpp CutCircle.h CutCurve.h Plugin.h \
../Common/Options.h ../Common/Message.h ../Common/Views.h \
../Common/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
../Common/Context.h
Octree.o: Octree.cpp Octree.h OctreeInternals.h
OctreeInternals.o: OctreeInternals.cpp ../Common/Message.h \
OctreeInternals.h
......
// $Id: Plugin.cpp,v 1.52 2004-05-22 01:24:18 geuzaine Exp $
// $Id: Plugin.cpp,v 1.53 2004-06-15 16:17:59 remacle Exp $
//
// Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
//
......@@ -36,6 +36,7 @@
#include "CutGrid.h"
#include "StreamLines.h"
#include "CutPlane.h"
#include "CutCircle.h"
#include "CutSphere.h"
#include "Skin.h"
#include "Extract.h"
......@@ -145,6 +146,8 @@ void GMSH_PluginManager::registerDefaultPlugins()
("CutMap", GMSH_RegisterCutMapPlugin()));
allPlugins.insert(std::pair < char *, GMSH_Plugin * >
("CutPlane", GMSH_RegisterCutPlanePlugin()));
allPlugins.insert(std::pair < char *, GMSH_Plugin * >
("CutCircle", GMSH_RegisterCutCirclePlugin()));
allPlugins.insert(std::pair < char *, GMSH_Plugin * >
("CutSphere", GMSH_RegisterCutSpherePlugin()));
allPlugins.insert(std::pair < char *, GMSH_Plugin * >
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment