Skip to content
Snippets Groups Projects
Commit bb989a89 authored by Gaetan Bricteux's avatar Gaetan Bricteux
Browse files

plugin cutmesh

parent 9bcc2cb2
No related branches found
No related tags found
No related merge requests found
......@@ -152,7 +152,7 @@ static void add_scripting(GMSH_PostPlugin *p, PView *view)
static void plugin_run_cb(Fl_Widget *w, void *data)
{
GMSH_PostPlugin *p = (GMSH_PostPlugin*)data;
GMSH_Plugin *p = (GMSH_Plugin*)data;
// get the values from the GUI
int m = p->getNbOptionsStr();
......@@ -168,34 +168,40 @@ static void plugin_run_cb(Fl_Widget *w, void *data)
sxn->def = p->dialogBox->value[i]->value();
}
// run on all selected views
bool no_view_selected = true;
for(int i = 1; i <= FlGui::instance()->plugins->view_browser->size(); i++) {
if(FlGui::instance()->plugins->view_browser->selected(i)) {
no_view_selected = false;
try{
if(i - 1 >= 0 && i - 1 < (int)PView::list.size()){
PView *view = PView::list[i - 1];
if(view->getData()->isRemote())
p->executeRemote(view);
if(p->getType() == GMSH_Plugin::GMSH_POST_PLUGIN){
GMSH_PostPlugin *pp = (GMSH_PostPlugin*)p;
// run on all selected views
bool no_view_selected = true;
for(int i = 1; i <= FlGui::instance()->plugins->view_browser->size(); i++) {
if(FlGui::instance()->plugins->view_browser->selected(i)) {
no_view_selected = false;
try{
if(i - 1 >= 0 && i - 1 < (int)PView::list.size()){
PView *view = PView::list[i - 1];
if(view->getData()->isRemote())
pp->executeRemote(view);
else{
pp->execute(view);
add_scripting(pp, view);
}
}
else{
p->execute(view);
add_scripting(p, view);
pp->execute(0);
add_scripting(pp, 0);
}
}
else{
p->execute(0);
add_scripting(p, 0);
catch(GMSH_Plugin * err) {
char tmp[256];
pp->catchErrorMessage(tmp);
Msg::Warning("%s", tmp);
}
}
catch(GMSH_Plugin * err) {
char tmp[256];
p->catchErrorMessage(tmp);
Msg::Warning("%s", tmp);
}
}
if(no_view_selected) pp->execute(0);
}
else{
p->run();
}
if(no_view_selected) p->execute(0);
FlGui::instance()->updateViews();
GMSH_Plugin::draw = 0;
......@@ -337,7 +343,8 @@ pluginWindow::pluginWindow(int deltaFontSize)
for(std::map<std::string, GMSH_Plugin*>::iterator it = PluginManager::
instance()->begin(); it != PluginManager::instance()->end(); ++it) {
GMSH_Plugin *p = it->second;
if(p->getType() == GMSH_Plugin::GMSH_POST_PLUGIN) {
if(p->getType() == GMSH_Plugin::GMSH_POST_PLUGIN ||
p->getType() == GMSH_Plugin::GMSH_MESH_PLUGIN) {
browser->add(p->getName().c_str(), p);
_createDialogBox(p, 2 * WB + L1 + L2, WB, width - L1 - L2 - 3 * WB,
height - 2 * WB);
......
......@@ -43,8 +43,8 @@ StringXNumber *GMSH_CutMeshPlugin::getOption(int iopt)
return &CutMeshOptions_Number[iopt];
}
void GMSH_CutMeshPlugin::run(){
void GMSH_CutMeshPlugin::run()
{
int iView = (int)CutMeshOptions_Number[0].def;
if(iView < 0)
iView = PView::list.size() - 1;
......@@ -54,6 +54,7 @@ void GMSH_CutMeshPlugin::run(){
int split = (int)CutMeshOptions_Number[1].def;
int saveTri = (int)CutMeshOptions_Number[2].def;
GModel *gm = GModel::current();
gm->buildCutGModel(gLs, !split, saveTri);
GModel *cgm = gm->buildCutGModel(gLs, !split, saveTri);
cgm->setVisibility(1);
}
......@@ -8,7 +8,7 @@
//Background Field = 1;
Mesh.Algorithm=1;
Mesh.CharacteristicLengthFactor=1.5;
Mesh.CharacteristicLengthFactor=2;
Mesh.ElementOrder=1;
lc=0.1;
......@@ -20,16 +20,23 @@ Line(1) = {2, 3};
Line(2) = {3, 4};
Line(3) = {4, 1};
Line(4) = {1, 2};
Physical Line ("top") = {1};
Physical Line ("left") = {4};
Line Loop(5) = {1, 2, 3, 4};
Plane Surface(10) = {5};
Physical Surface ("surf") = {10};
Merge "squareV.pos";
Mesh 2;
Levelset Plane (1) = {0,1,0,-7};
Levelset Sphere (2) = {{0,0,0},-10};
//Levelset Point (1) = {{0.1, 2, 0},{3,2,0},{9,2,0},{5,2,0}, {0.1, 2.2, -1},{3,2.5,-1},{9,2,-1},{5,2,-1}, {0.2, 2, 1},{3,2,1},{9,2,1},{5,2,1}};
Levelset Intersection (3) = {1,2};
Levelset CutMeshTri {3};
Levelset PostView (4) = {0};
//Levelset CutMeshTri {4};
Print "square_cut.msh";
//Print "square_cut.msh";
View "New view_MathEval_MathEval" {
SL(0.1,10,0.1,2.574999999994313,10,0.1){-4.9,-2.425000000005687};
SL(2.574999999994313,10,0.1,5.049999999986964,10,0.1){-2.425000000005687,0.04999999998696403};
SL(5.049999999986964,10,0.1,7.524999999991573,10,0.1){0.04999999998696403,2.524999999991573};
SL(7.524999999991573,10,0.1,10,10,0.1){2.524999999991573,5};
SL(0.1,0.1,0.1,0.1,2.574999999994313,0.1){-4.9,-4.9};
SL(0.1,2.574999999994313,0.1,0.1,5.049999999986964,0.1){-4.9,-4.9};
SL(0.1,5.049999999986964,0.1,0.1,7.524999999991573,0.1){-4.9,-4.9};
SL(0.1,7.524999999991573,0.1,0.1,10,0.1){-4.9,-4.9};
ST(2.36044430461694,6.067995514511253,0.1,0.1,5.049999999986964,0.1,0.1,7.524999999991573,0.1){-2.63955569538306,-4.9,-4.9};
ST(3.598465426055707,2.014538206248786,0.1,5.050000000013794,0.1,0.1,2.575000000007345,0.1,0.1){-1.401534573944293,0.05000000001379412,-2.424999999992655};
ST(7.71514272650873,4.020328902186659,0.1,10,5.050000000013794,0.1,10,2.575000000007345,0.1){2.71514272650873,5,5};
ST(2.36044430461694,6.067995514511253,0.1,3.700770119026196,8.151478613216065,0.1,5.142547865965409,5.697110637185145,0.1){-2.63955569538306,-1.299229880973804,0.1425478659654091};
ST(3.700770119026196,8.151478613216065,0.1,2.574999999994313,10,0.1,5.049999999986964,10,0.1){-1.299229880973804,-2.425000000005687,0.04999999998696403};
ST(1.949716673795976,3.569025765949217,0.1,0.1,5.049999999986964,0.1,2.36044430461694,6.067995514511253,0.1){-3.050283326204024,-4.9,-2.63955569538306};
ST(1.949716673795976,3.569025765949217,0.1,0.1,2.574999999994313,0.1,0.1,5.049999999986964,0.1){-3.050283326204024,-4.9,-4.9};
ST(3.598465426055707,2.014538206248786,0.1,5.87835667004227,2.526941299456859,0.1,5.050000000013794,0.1,0.1){-1.401534573944293,0.8783566700422698,0.05000000001379412};
ST(7.71514272650873,4.020328902186659,0.1,5.87835667004227,2.526941299456859,0.1,5.142547865965409,5.697110637185145,0.1){2.71514272650873,0.8783566700422698,0.1425478659654091};
ST(7.492800993506647,5.676422015850005,0.1,7.71514272650873,4.020328902186659,0.1,5.142547865965409,5.697110637185145,0.1){2.492800993506647,2.71514272650873,0.1425478659654091};
ST(8.67851460446659,8.804574679663698,0.1,7.524999999991573,10,0.1,10,10,0.1){3.67851460446659,2.524999999991573,5};
ST(10,7.525000000005944,0.1,8.67851460446659,8.804574679663698,0.1,10,10,0.1){5,3.67851460446659,5};
ST(8.17926562389324,1.877717499523486,0.1,10,2.575000000007345,0.1,10,0.1,0.1){3.17926562389324,5,5};
ST(7.525000000005944,0.1,0.1,8.17926562389324,1.877717499523486,0.1,10,0.1,0.1){2.525000000005944,3.17926562389324,5};
ST(2.574999999994313,10,0.1,1.744169285301122,8.508231300619908,0.1,0.1,10,0.1){-2.425000000005687,-3.255830714698878,-4.9};
ST(0.1,7.524999999991573,0.1,1.744169285301122,8.508231300619908,0.1,2.36044430461694,6.067995514511253,0.1){-4.9,-3.255830714698878,-2.63955569538306};
ST(1.744169285301122,8.508231300619908,0.1,0.1,7.524999999991573,0.1,0.1,10,0.1){-3.255830714698878,-4.9,-4.9};
ST(3.700770119026196,8.151478613216065,0.1,1.744169285301122,8.508231300619908,0.1,2.574999999994313,10,0.1){-1.299229880973804,-3.255830714698878,-2.425000000005687};
ST(3.700770119026196,8.151478613216065,0.1,2.36044430461694,6.067995514511253,0.1,1.744169285301122,8.508231300619908,0.1){-1.299229880973804,-2.63955569538306,-3.255830714698878};
ST(10,2.575000000007345,0.1,8.17926562389324,1.877717499523486,0.1,7.71514272650873,4.020328902186659,0.1){5,3.17926562389324,2.71514272650873};
ST(7.71514272650873,4.020328902186659,0.1,7.492800993506647,5.676422015850005,0.1,10,5.050000000013794,0.1){2.71514272650873,2.492800993506647,5};
ST(7.524999999991573,10,0.1,8.67851460446659,8.804574679663698,0.1,7.38014412423449,7.618172135495045,0.1){2.524999999991573,3.67851460446659,2.38014412423449};
ST(7.38014412423449,7.618172135495045,0.1,7.492800993506647,5.676422015850005,0.1,5.142547865965409,5.697110637185145,0.1){2.38014412423449,2.492800993506647,0.1425478659654091};
ST(8.67851460446659,8.804574679663698,0.1,10,7.525000000005944,0.1,7.38014412423449,7.618172135495045,0.1){3.67851460446659,5,2.38014412423449};
ST(5.87835667004227,2.526941299456859,0.1,7.525000000005944,0.1,0.1,5.050000000013794,0.1,0.1){0.8783566700422698,2.525000000005944,0.05000000001379412};
ST(8.17926562389324,1.877717499523486,0.1,5.87835667004227,2.526941299456859,0.1,7.71514272650873,4.020328902186659,0.1){3.17926562389324,0.8783566700422698,2.71514272650873};
ST(5.87835667004227,2.526941299456859,0.1,8.17926562389324,1.877717499523486,0.1,7.525000000005944,0.1,0.1){0.8783566700422698,3.17926562389324,2.525000000005944};
ST(7.492800993506647,5.676422015850005,0.1,10,7.525000000005944,0.1,10,5.050000000013794,0.1){2.492800993506647,5,5};
ST(7.38014412423449,7.618172135495045,0.1,10,7.525000000005944,0.1,7.492800993506647,5.676422015850005,0.1){2.38014412423449,5,2.492800993506647};
ST(3.78590618809526,3.975122284670252,0.1,5.87835667004227,2.526941299456859,0.1,3.598465426055707,2.014538206248786,0.1){-1.21409381190474,0.8783566700422698,-1.401534573944293};
ST(5.87835667004227,2.526941299456859,0.1,3.78590618809526,3.975122284670252,0.1,5.142547865965409,5.697110637185145,0.1){0.8783566700422698,-1.21409381190474,0.1425478659654091};
ST(1.949716673795976,3.569025765949217,0.1,3.78590618809526,3.975122284670252,0.1,3.598465426055707,2.014538206248786,0.1){-3.050283326204024,-1.21409381190474,-1.401534573944293};
ST(3.700770119026196,8.151478613216065,0.1,5.759692421840926,8.293352277179251,0.1,5.142547865965409,5.697110637185145,0.1){-1.299229880973804,0.759692421840926,0.1425478659654091};
ST(5.759692421840926,8.293352277179251,0.1,7.38014412423449,7.618172135495045,0.1,5.142547865965409,5.697110637185145,0.1){0.759692421840926,2.38014412423449,0.1425478659654091};
ST(5.759692421840926,8.293352277179251,0.1,3.700770119026196,8.151478613216065,0.1,5.049999999986964,10,0.1){0.759692421840926,-1.299229880973804,0.04999999998696403};
ST(7.524999999991573,10,0.1,5.759692421840926,8.293352277179251,0.1,5.049999999986964,10,0.1){2.524999999991573,0.759692421840926,0.04999999998696403};
ST(7.524999999991573,10,0.1,7.38014412423449,7.618172135495045,0.1,5.759692421840926,8.293352277179251,0.1){2.524999999991573,2.38014412423449,0.759692421840926};
ST(2.575000000007345,0.1,0.1,1.753484123960424,1.731498590297984,0.1,3.598465426055707,2.014538206248786,0.1){-2.424999999992655,-3.246515876039576,-1.401534573944293};
ST(0.1,2.574999999994313,0.1,1.753484123960424,1.731498590297984,0.1,0.1,0.1,0.1){-4.9,-3.246515876039576,-4.9};
ST(1.753484123960424,1.731498590297984,0.1,2.575000000007345,0.1,0.1,0.1,0.1,0.1){-3.246515876039576,-2.424999999992655,-4.9};
ST(1.949716673795976,3.569025765949217,0.1,1.753484123960424,1.731498590297984,0.1,0.1,2.574999999994313,0.1){-3.050283326204024,-3.246515876039576,-4.9};
ST(1.949716673795976,3.569025765949217,0.1,3.598465426055707,2.014538206248786,0.1,1.753484123960424,1.731498590297984,0.1){-3.050283326204024,-1.401534573944293,-3.246515876039576};
ST(3.78590618809526,3.975122284670252,0.1,2.36044430461694,6.067995514511253,0.1,5.142547865965409,5.697110637185145,0.1){-1.21409381190474,-2.63955569538306,0.1425478659654091};
ST(1.949716673795976,3.569025765949217,0.1,2.36044430461694,6.067995514511253,0.1,3.78590618809526,3.975122284670252,0.1){-3.050283326204024,-2.63955569538306,-1.21409381190474};
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment