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

fixed iView

parent 88d7b784
Branches
Tags
No related merge requests found
// $Id: Views.cpp,v 1.48 2001-08-06 08:09:51 geuzaine Exp $
// $Id: Views.cpp,v 1.49 2001-08-06 10:35:47 geuzaine Exp $
#include <set>
#include "Gmsh.h"
......@@ -793,8 +793,6 @@ void smooth_list (List_T *SS ,
}
}
Msg(DEBUG, "Smotthing phase 2");
for(i = 0 ; i < List_Nbr(SS) ; i+=nb){
x = (double*)List_Pointer_Fast(SS,i);
y = (double*)List_Pointer_Fast(SS,i+nbvert);
......@@ -821,14 +819,14 @@ void Post_View :: smooth (){
if(NbSS){
mycont conSS;
Msg(INFO,"Smoothing SS vector in a view ...");
Msg(INFO,"Smoothing scalar tetrahedra in view...");
nb = List_Nbr(SS) / NbSS ;
smooth_list (SS , &Min, &Max, NbTimeStep, 4, nb, conSS);
Msg(INFO,"...done");
}
if(NbST){
mycont conST;
Msg(INFO,"Smoothing ST vector in a view ...");
Msg(INFO,"Smoothing scalar triangles in view...");
nb = List_Nbr(ST) / NbST ;
smooth_list (ST , &Min, &Max, NbTimeStep, 3, nb, conST);
Msg(INFO,"...done");
......
// $Id: CutMap.cpp,v 1.15 2001-08-06 09:44:22 geuzaine Exp $
// $Id: CutMap.cpp,v 1.16 2001-08-06 10:35:47 geuzaine Exp $
#include "CutMap.h"
#include "List.h"
StringXNumber CutMapOptions_Number[] = {
{ GMSH_FULLRC, "A" , NULL , 1. },
{ GMSH_FULLRC, "iView" , NULL , 1. }
{ GMSH_FULLRC, "iView" , NULL , -1. }
};
extern "C"
......@@ -64,25 +64,23 @@ extern List_T *Post_ViewList;
Post_View *GMSH_CutMapPlugin::execute (Post_View *v)
{
Post_View *vv;
A = CutMapOptions_Number[0].def;
iView = (int)CutMapOptions_Number[1].def;
Msg(INFO, "View %d -> iso %g",iView, A);
if(v)
return GMSH_LevelsetPlugin::execute(v);
else{
if(List_Nbr(Post_ViewList) < iView){
Msg(WARNING,"Plugin CutMap, view %d not loaded",iView);
if(v && iView < 0)
vv = v;
else if(!(vv = (Post_View*)List_Pointer_Test(Post_ViewList,iView))){
Msg(WARNING,"Plugin CutMap: View[%d] does not exist",iView);
return 0;
}
return GMSH_LevelsetPlugin::execute((Post_View*)List_Pointer_Test(Post_ViewList,iView-1));
}
}
return GMSH_LevelsetPlugin::execute(vv);
}
void GMSH_CutMapPlugin::Run ()
{
int iView = (int)CutMapOptions_Number[1].def;
if(iView < 0) CutMapOptions_Number[1].def = 0;
execute (0);
}
......@@ -22,5 +22,6 @@ public:
virtual int getNbOptions() const;
virtual StringXNumber* GetOption (int iopt);
virtual Post_View *execute (Post_View *);
virtual void Run();
};
#endif
// $Id: CutPlane.cpp,v 1.13 2001-08-06 09:44:22 geuzaine Exp $
// $Id: CutPlane.cpp,v 1.14 2001-08-06 10:35:47 geuzaine Exp $
#include "CutPlane.h"
#include "List.h"
......@@ -8,7 +8,7 @@ StringXNumber CutPlaneOptions_Number[] = {
{ GMSH_FULLRC, "B" , NULL , 0. },
{ GMSH_FULLRC, "C" , NULL , 0. },
{ GMSH_FULLRC, "D" , NULL , 0.01 },
{ GMSH_FULLRC, "iView" , NULL , 1. }
{ GMSH_FULLRC, "iView" , NULL , -1. }
};
extern "C"
......@@ -67,24 +67,29 @@ extern List_T *Post_ViewList;
Post_View *GMSH_CutPlanePlugin::execute (Post_View *v)
{
Post_View *vv;
a = CutPlaneOptions_Number[0].def;
b = CutPlaneOptions_Number[1].def;
c = CutPlaneOptions_Number[2].def;
d = CutPlaneOptions_Number[3].def;
int iView = (int)CutPlaneOptions_Number[4].def;
if(v)
return GMSH_LevelsetPlugin::execute(v);
else{
if(List_Nbr(Post_ViewList) < iView){
Msg(WARNING,"Plugin CutPlane, view %d not loaded",iView);
if(v && iView < 0)
vv = v;
else if(!(vv = (Post_View*)List_Pointer_Test(Post_ViewList,iView))){
Msg(WARNING,"Plugin CutPlane: View[%d] does not exist",iView);
return 0;
}
return GMSH_LevelsetPlugin::execute((Post_View*)List_Pointer_Test(Post_ViewList,iView-1));
}
return GMSH_LevelsetPlugin::execute(vv);
}
void GMSH_CutPlanePlugin::Run ()
{
int iView = (int)CutPlaneOptions_Number[4].def;
if(iView < 0) CutPlaneOptions_Number[4].def = 0;
execute (0);
}
......@@ -23,6 +23,7 @@ public:
virtual int getNbOptions() const;
virtual StringXNumber *GetOption (int iopt);
virtual Post_View *execute (Post_View *);
virtual void Run();
};
#endif
// $Id: CutSphere.cpp,v 1.12 2001-08-06 09:44:22 geuzaine Exp $
// $Id: CutSphere.cpp,v 1.13 2001-08-06 10:35:47 geuzaine Exp $
#include <string.h>
#include "CutSphere.h"
......@@ -9,7 +9,7 @@ StringXNumber CutSphereOptions_Number[] = {
{ GMSH_FULLRC, "Yc" , NULL , 0. },
{ GMSH_FULLRC, "Zc" , NULL , 0. },
{ GMSH_FULLRC, "R" , NULL , 0.25 },
{ GMSH_FULLRC, "iView" , NULL , 1. }
{ GMSH_FULLRC, "iView" , NULL , -1. }
};
extern "C"
......@@ -68,20 +68,26 @@ extern List_T *Post_ViewList;
Post_View *GMSH_CutSpherePlugin::execute (Post_View *v)
{
Post_View *vv;
a = CutSphereOptions_Number[0].def;
b = CutSphereOptions_Number[1].def;
c = CutSphereOptions_Number[2].def;
r = CutSphereOptions_Number[3].def;
int iView = (int)CutSphereOptions_Number[4].def;
if(v)
return GMSH_LevelsetPlugin::execute(v);
else{
if(List_Nbr(Post_ViewList) < iView){
Msg(WARNING,"Plugin CutSphere, view %d not loaded",iView);
if(v && iView < 0)
vv = v;
else if(!(vv = (Post_View*)List_Pointer_Test(Post_ViewList,iView))){
Msg(WARNING,"Plugin CutSphere: View[%d] does not exist",iView);
return 0;
}
return GMSH_LevelsetPlugin::execute((Post_View*)List_Pointer_Test(Post_ViewList,iView-1));
return GMSH_LevelsetPlugin::execute(vv);
}
void GMSH_CutSpherePlugin::Run ()
{
int iView = (int)CutSphereOptions_Number[4].def;
if(iView < 0) CutSphereOptions_Number[4].def = 0;
execute (0);
}
......@@ -23,6 +23,7 @@ public:
virtual int getNbOptions() const;
virtual StringXNumber* GetOption (int iopt);
virtual Post_View *execute (Post_View *);
virtual void Run();
};
#endif
// $Id: LevelsetPlugin.cpp,v 1.9 2001-08-06 08:09:51 geuzaine Exp $
// $Id: LevelsetPlugin.cpp,v 1.10 2001-08-06 10:35:47 geuzaine Exp $
#include "LevelsetPlugin.h"
#include "List.h"
......@@ -23,7 +23,6 @@ void GMSH_LevelsetPlugin::Save ()
void GMSH_LevelsetPlugin::Run ()
{
Msg(INFO, "Running Levelset plugin");
execute (0);
}
......@@ -98,8 +97,7 @@ Post_View *GMSH_LevelsetPlugin::execute (Post_View *v)
sprintf(filename,"cut-%s",v->FileName);
EndView(1, filename, name);
Msg(INFO, "Levelset plugin OK: created view '%s' (%d triangles)",
name, View->NbST);
Msg(INFO, "Levelset: created view '%s' (%d triangles)", name, View->NbST);
processed = View;
return View;
}
......
// $Id: Skin.cpp,v 1.2 2001-08-06 09:44:22 geuzaine Exp $
// $Id: Skin.cpp,v 1.3 2001-08-06 10:35:47 geuzaine Exp $
#include "Plugin.h"
#include "Skin.h"
......@@ -10,7 +10,7 @@
extern Context_T CTX;
StringXNumber SkinOptions_Number[] = {
{ GMSH_FULLRC, "iView" , NULL , 1. }
{ GMSH_FULLRC, "iView" , NULL , -1. }
};
extern "C"
......@@ -115,16 +115,12 @@ Post_View *GMSH_SkinPlugin::execute (Post_View *v)
struct elm elm;
int iView = (int)SkinOptions_Number[0].def;
if(v)
if(v && iView < 0)
vv = v;
else{
if(List_Nbr(Post_ViewList) < iView){
Msg(WARNING,"Plugin CutPlane, view %d not loaded",iView);
else if(!(vv = (Post_View*)List_Pointer_Test(Post_ViewList,iView))){
Msg(WARNING,"Plugin Skin: View[%d] does not exist",iView);
return 0;
}
vv = (Post_View*)List_Pointer_Test(Post_ViewList,iView-1);
}
if(vv->NbSS){
View = BeginView(1);
......@@ -151,8 +147,7 @@ Post_View *GMSH_SkinPlugin::execute (Post_View *v)
sprintf(name,"skin-%s",vv->Name);
sprintf(filename,"skin-%s",vv->FileName);
EndView(1, filename, name);
Msg(INFO, "Skin plugin OK: created view '%s' (%d triangles)",
name, View->NbST);
Msg(INFO, "Skin: created view '%s' (%d triangles)", name, View->NbST);
return View;
}
......@@ -161,6 +156,8 @@ Post_View *GMSH_SkinPlugin::execute (Post_View *v)
void GMSH_SkinPlugin::Run ()
{
int iView = (int)SkinOptions_Number[0].def;
if(iView < 0) SkinOptions_Number[0].def = 0;
execute(0);
}
......
// $Id: Smooth.cpp,v 1.2 2001-08-06 09:44:22 geuzaine Exp $
// $Id: Smooth.cpp,v 1.3 2001-08-06 10:35:47 geuzaine Exp $
#include "Plugin.h"
#include "Smooth.h"
......@@ -6,7 +6,7 @@
#include "Views.h"
StringXNumber SmoothOptions_Number[] = {
{ GMSH_FULLRC, "iView" , NULL , 1. }
{ GMSH_FULLRC, "iView" , NULL , -1. }
};
extern "C"
......@@ -59,23 +59,21 @@ Post_View *GMSH_SmoothPlugin::execute (Post_View *v)
Post_View *vv;
int iView = (int)SmoothOptions_Number[0].def;
if(v)
if(v && iView < 0)
vv = v;
else{
if(List_Nbr(Post_ViewList) < iView){
Msg(WARNING,"Plugin Smooth, view %d not loaded",iView);
else if(!(vv = (Post_View*)List_Pointer_Test(Post_ViewList,iView))){
Msg(WARNING,"Plugin Smooth: View[%d] does not exist",iView);
return 0;
}
vv = (Post_View*)List_Pointer_Test(Post_ViewList,iView-1);
}
Msg(INFO, "Executing Smooth on View num %d", vv->Num);
vv->smooth();
return vv;
}
void GMSH_SmoothPlugin::Run ()
{
int iView = (int)SmoothOptions_Number[0].def;
if(iView < 0) SmoothOptions_Number[0].def = 0;
execute(0);
}
......
// $Id: Transform.cpp,v 1.2 2001-08-06 09:44:22 geuzaine Exp $
// $Id: Transform.cpp,v 1.3 2001-08-06 10:35:47 geuzaine Exp $
#include "Plugin.h"
#include "Transform.h"
......@@ -15,7 +15,7 @@ StringXNumber TransformOptions_Number[] = {
{ GMSH_FULLRC, "A31" , NULL , 0. },
{ GMSH_FULLRC, "A32" , NULL , 0. },
{ GMSH_FULLRC, "A33" , NULL , 1. },
{ GMSH_FULLRC, "iView" , NULL , 1. }
{ GMSH_FULLRC, "iView" , NULL , -1. }
};
extern "C"
......@@ -93,15 +93,12 @@ Post_View *GMSH_TransformPlugin::execute (Post_View *v)
mat[2][2] = TransformOptions_Number[8].def;
int iView = (int)TransformOptions_Number[9].def;
if(v)
if(v && iView < 0)
vv = v;
else{
if(List_Nbr(Post_ViewList) < iView){
Msg(WARNING,"Plugin CutTransform, view %d not loaded",iView);
else if(!(vv = (Post_View*)List_Pointer_Test(Post_ViewList,iView))){
Msg(WARNING,"Plugin Transform: View[%d] does not exist",iView);
return 0;
}
vv = (Post_View*)List_Pointer_Test(Post_ViewList,iView-1);
}
vv->transform(mat);
return vv;
......@@ -109,6 +106,8 @@ Post_View *GMSH_TransformPlugin::execute (Post_View *v)
void GMSH_TransformPlugin::Run ()
{
int iView = (int)TransformOptions_Number[9].def;
if(iView < 0) TransformOptions_Number[9].def = 0;
execute(0);
}
......
......@@ -28,6 +28,7 @@ Include "view3.pos" ;
// documentation of each plugin), and runs the plugin:
Plugin(CutMap).A = 0.67 ;
Plugin(CutMap).iView = 0 ; //select View[0] as the working view
Plugin(CutMap).Run ;
Plugin(CutPlane).A = 0 ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment