Newer
Older
if(FindLevelSet(t)){
yymsg(0, "Levelset %d already exists", t);
}
else {
std::vector<gLevelset *> vl;
for(int i = 0; i < List_Nbr((yyvsp[(7) - (8)].l)); i++) {
double d; List_Read((yyvsp[(7) - (8)].l), i, &d);
LevelSet *pl = FindLevelSet((int)d);
if(!pl) yymsg(0, "Levelset Intersection %d : unknown levelset %d", t, (int)d);
else vl.push_back(pl->ls);
}
gLevelset *ls = new gLevelsetIntersection(vl, true);
LevelSet *l = Create_LevelSet(t, ls);
Tree_Add(GModel::current()->getGEOInternals()->LevelSets, &l);
}
}
else if(!strcmp((yyvsp[(2) - (8)].c), "Cut")){
int t = (int)(yyvsp[(4) - (8)].d);
if(FindLevelSet(t)){
yymsg(0, "Levelset %d already exists", t);
}
else {
std::vector<gLevelset *> vl;
for(int i = 0; i < List_Nbr((yyvsp[(7) - (8)].l)); i++) {
double d; List_Read((yyvsp[(7) - (8)].l), i, &d);
LevelSet *pl = FindLevelSet((int)d);
if(!pl) yymsg(0, "Levelset Cut %d : unknown levelset %d", t, (int)d);
else vl.push_back(pl->ls);
}
gLevelset *ls = new gLevelsetCut(vl, true);
LevelSet *l = Create_LevelSet(t, ls);
Tree_Add(GModel::current()->getGEOInternals()->LevelSets, &l);
}
}
else if(!strcmp((yyvsp[(2) - (8)].c), "Crack")){
int t = (int)(yyvsp[(4) - (8)].d);
if(FindLevelSet(t)){
yymsg(0, "Levelset %d already exists", t);
}
else {
std::vector<gLevelset *> vl;
for(int i = 0; i < List_Nbr((yyvsp[(7) - (8)].l)); i++) {
double d; List_Read((yyvsp[(7) - (8)].l), i, &d);
LevelSet *pl = FindLevelSet((int)d);
if(!pl) yymsg(0, "Levelset Crack %d : unknown levelset %d", t, (int)d);
else vl.push_back(pl->ls);
}
gLevelset *ls = new gLevelsetCrack(vl);
LevelSet *l = Create_LevelSet(t, ls);
Tree_Add(GModel::current()->getGEOInternals()->LevelSets, &l);
}
}
else if(!strcmp((yyvsp[(2) - (8)].c), "Reverse")){
int t = (int)(yyvsp[(4) - (8)].d);
if(FindLevelSet(t)){
yymsg(0, "Levelset %d already exists", t);
}
else {
double d;
List_Read((yyvsp[(7) - (8)].l), 0, &d);
LevelSet *pl = FindLevelSet((int)d);
gLevelset *ls = NULL;
if(!pl) yymsg(0, "Levelset Reverse %d : unknown levelset %d", t, (int)d);
else ls = new gLevelsetReverse(pl->ls);
LevelSet *l = Create_LevelSet(t, ls);
Tree_Add(GModel::current()->getGEOInternals()->LevelSets, &l);
}
}
else if(!strcmp((yyvsp[(2) - (8)].c), "PostView")){
int t = (int)(yyvsp[(4) - (8)].d);
if(FindLevelSet(t)){
yymsg(0, "Levelset %d already exists", t);
}
else {
if(List_Nbr((yyvsp[(7) - (8)].l)) > 0){
double d; List_Read((yyvsp[(7) - (8)].l), 0, &d);
gLevelset *ls = new gLevelsetPostView((int)d, t);
LevelSet *l = Create_LevelSet(ls->getTag(), ls);
Tree_Add(GModel::current()->getGEOInternals()->LevelSets, &l);
}
}
}
else
yymsg(0, "Wrong levelset definition (%d)", (yyvsp[(4) - (8)].d));
Free((yyvsp[(2) - (8)].c));
break;
case 179:
#line 2411 "Gmsh.y"
{
#if defined(HAVE_DINTEGRATION)
if(!strcmp((yyvsp[(2) - (8)].c), "MathEval")){
int t = (int)(yyvsp[(4) - (8)].d);
if(FindLevelSet(t)){
yymsg(0, "Levelset %d already exists", t);
}
else {
gLevelset *ls = new gLevelsetMathEval((yyvsp[(7) - (8)].c), t);
LevelSet *l = Create_LevelSet(ls->getTag(), ls);
Tree_Add(GModel::current()->getGEOInternals()->LevelSets, &l);
}
}
else
yymsg(0, "Wrong levelset definition");
Free((yyvsp[(2) - (8)].c)); Free((yyvsp[(7) - (8)].c));
#endif
case 180:
#line 2430 "Gmsh.y"
if(!strcmp((yyvsp[(2) - (6)].c), "CutMesh")){
int t = (int)(yyvsp[(4) - (6)].d);
GModel *GM = GModel::current();
if(FindLevelSet(t)){
GM->buildCutGModel(FindLevelSet(t)->ls, true, false);
GM->setVisibility(0);
}
else
yymsg(0, "Unknown levelset (%d)", t);
Emilie Marchandise
committed
}
Emilie Marchandise
committed
int t = (int)(yyvsp[(4) - (6)].d);
GModel *GM = GModel::current();
if(FindLevelSet(t)){
GM->buildCutGModel(FindLevelSet(t)->ls, true, true);
GM->setVisibility(0);
}
else
yymsg(0, "Unknown levelset (%d)", t);
else if(!strcmp((yyvsp[(2) - (6)].c), "SplitMesh")){
int t = (int)(yyvsp[(4) - (6)].d);
GModel *GM = GModel::current();
if(FindLevelSet(t)){
GM->buildCutGModel(FindLevelSet(t)->ls, false, true);
GM->setVisibility(0);
}
else
yymsg(0, "Unknown levelset (%d)", t);
else
yymsg(0, "Wrong levelset definition");
Free((yyvsp[(2) - (6)].c));
break;
case 181:
#line 2469 "Gmsh.y"
if(!strcmp((yyvsp[(2) - (14)].c), "Cylinder") && List_Nbr((yyvsp[(12) - (14)].l)) == 1){
int t = (int)(yyvsp[(4) - (14)].d);
if(FindLevelSet(t)){
yymsg(0, "Levelset %d already exists", t);
}
else {
double d;
List_Read((yyvsp[(12) - (14)].l), 0, &d);
double pt[3] = {(yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2]};
double dir[3] = {(yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2]};
gLevelset *ls = new gLevelsetGenCylinder(pt, dir, d, t);
LevelSet *l = Create_LevelSet(ls->getTag(), ls);
Tree_Add(GModel::current()->getGEOInternals()->LevelSets, &l);
}
}
else if(!strcmp((yyvsp[(2) - (14)].c), "Cone") && List_Nbr((yyvsp[(12) - (14)].l)) == 1){
int t = (int)(yyvsp[(4) - (14)].d);
if(FindLevelSet(t)){
yymsg(0, "Levelset %d already exists", t);
}
else {
double d;
List_Read((yyvsp[(12) - (14)].l), 0, &d);
double pt[3] = {(yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2]};
double dir[3] = {(yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2]};
gLevelset *ls = new gLevelsetCone(pt, dir, d, t);
LevelSet *l = Create_LevelSet(ls->getTag(), ls);
Tree_Add(GModel::current()->getGEOInternals()->LevelSets, &l);
}
}
else if(!strcmp((yyvsp[(2) - (14)].c), "Cylinder") && List_Nbr((yyvsp[(12) - (14)].l)) == 2){
int t = (int)(yyvsp[(4) - (14)].d);
if(FindLevelSet(t)){
yymsg(0, "Levelset %d already exists", t);
}
else {
double d[2];
for(int i = 0; i < 2; i++)
List_Read((yyvsp[(12) - (14)].l), i, &d[i]);
double pt[3] = {(yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2]};
double dir[3] = {(yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2]};
gLevelset *ls = new gLevelsetCylinder(pt, dir, d[0], d[1], t);
LevelSet *l = Create_LevelSet(ls->getTag(), ls);
Tree_Add(GModel::current()->getGEOInternals()->LevelSets, &l);
}
}
else if(!strcmp((yyvsp[(2) - (14)].c), "Cylinder") && List_Nbr((yyvsp[(12) - (14)].l)) == 3){
int t = (int)(yyvsp[(4) - (14)].d);
if(FindLevelSet(t)){
yymsg(0, "Levelset %d already exists", t);
}
else {
double d[3];
for(int i = 0; i < 3; i++)
List_Read((yyvsp[(12) - (14)].l), i, &d[i]);
double pt[3] = {(yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2]};
double dir[3] = {(yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2]};
gLevelset *ls = new gLevelsetCylinder(pt, dir, d[0], d[1], d[2], t);
LevelSet *l = Create_LevelSet(ls->getTag(), ls);
Tree_Add(GModel::current()->getGEOInternals()->LevelSets, &l);
}
}
else if(!strcmp((yyvsp[(2) - (14)].c), "Ellipsoid") && List_Nbr((yyvsp[(12) - (14)].l)) == 3){
int t = (int)(yyvsp[(4) - (14)].d);
if(FindLevelSet(t)){
yymsg(0, "Levelset %d already exists", t);
}
else {
double d[3];
for(int i = 0; i < 3; i++)
List_Read((yyvsp[(12) - (14)].l), i, &d[i]);
double pt[3] = {(yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2]};
double dir[3] = {(yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2]};
gLevelset *ls = new gLevelsetEllipsoid(pt, dir, d[0], d[1], d[2], t);
LevelSet *l = Create_LevelSet(ls->getTag(), ls);
Tree_Add(GModel::current()->getGEOInternals()->LevelSets, &l);
}
}
else if(!strcmp((yyvsp[(2) - (14)].c), "Quadric") && List_Nbr((yyvsp[(12) - (14)].l)) == 5){
int t = (int)(yyvsp[(4) - (14)].d);
if(FindLevelSet(t)){
yymsg(0, "Levelset %d already exists", t);
}
else {
double d[5];
for(int i = 0; i < 5; i++)
List_Read((yyvsp[(12) - (14)].l), i, &d[i]);
double pt[3] = {(yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2]};
double dir[3] = {(yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2]};
LevelSet *l = Create_LevelSet(ls->getTag(), ls);
Tree_Add(GModel::current()->getGEOInternals()->LevelSets, &l);
}
}
else
yymsg(0, "Wrong levelset definition (%d)", (yyvsp[(4) - (14)].d));
Free((yyvsp[(2) - (14)].c));
break;
case 182:
#line 2577 "Gmsh.y"
Shape TheShape;
List_Read((yyvsp[(3) - (4)].l), i, &TheShape);
DeleteShape(TheShape.Type, TheShape.Num);
case 183:
#line 2586 "Gmsh.y"
GModel::current()->getFields()->deleteField((int)(yyvsp[(4) - (6)].d));
case 184:
#line 2592 "Gmsh.y"
int index = (int)(yyvsp[(4) - (6)].d);
if(index >= 0 && index < (int)PView::list.size())
delete PView::list[index];
else
yymsg(0, "Unknown view %d", index);
yymsg(0, "Unknown command 'Delete %s'", (yyvsp[(2) - (6)].c));

Christophe Geuzaine
committed
#endif
case 185:
#line 2607 "Gmsh.y"
if(!strcmp((yyvsp[(2) - (3)].c), "Meshes") || !strcmp((yyvsp[(2) - (3)].c), "All")){
}
else if(!strcmp((yyvsp[(2) - (3)].c), "Model")){
GModel::current()->destroy();
GModel::current()->getGEOInternals()->destroy();
GModel::current()->getGEOInternals()->reset_physicals();
GModel::current()->deletePhysicalGroups();
else if(!strcmp((yyvsp[(2) - (3)].c), "Variables")){
gmsh_yysymbols.clear();
else if(!strcmp((yyvsp[(2) - (3)].c), "Options")){
ReInitOptions(0);
InitOptionsGUI(0);
}
if(gmsh_yysymbols.count((yyvsp[(2) - (3)].c)))
gmsh_yysymbols.erase((yyvsp[(2) - (3)].c));
else
yymsg(0, "Unknown object or expression to delete '%s'", (yyvsp[(2) - (3)].c));
case 186:
#line 2635 "Gmsh.y"
if(!strcmp((yyvsp[(2) - (4)].c), "Empty") && !strcmp((yyvsp[(3) - (4)].c), "Views")){
for(int i = PView::list.size() - 1; i >= 0; i--)
if(PView::list[i]->getData()->empty()) delete PView::list[i];
yymsg(0, "Unknown command 'Delete %s %s'", (yyvsp[(2) - (4)].c), (yyvsp[(3) - (4)].c));

Christophe Geuzaine
committed
#endif
case 187:
#line 2652 "Gmsh.y"
Shape TheShape;
List_Read((yyvsp[(4) - (5)].l), i, &TheShape);
ColorShape(TheShape.Type, TheShape.Num, (yyvsp[(2) - (5)].u), false);
case 188:
#line 2661 "Gmsh.y"
for(int i = 0; i < List_Nbr((yyvsp[(5) - (6)].l)); i++){
Shape TheShape;
List_Read((yyvsp[(5) - (6)].l), i, &TheShape);
ColorShape(TheShape.Type, TheShape.Num, (yyvsp[(3) - (6)].u), true);
}
List_Delete((yyvsp[(5) - (6)].l));
case 189:
#line 2675 "Gmsh.y"
VisibilityShape((yyvsp[(2) - (3)].c), i, 1, false);
case 190:
#line 2681 "Gmsh.y"
{
for(int i = 0; i < 4; i++)
VisibilityShape((yyvsp[(2) - (3)].c), i, 0, false);
Free((yyvsp[(2) - (3)].c));
;}
break;
case 191:
#line 2687 "Gmsh.y"
Shape TheShape;
List_Read((yyvsp[(3) - (4)].l), i, &TheShape);
VisibilityShape(TheShape.Type, TheShape.Num, 1, false);
case 192:
#line 2696 "Gmsh.y"
{
for(int i = 0; i < List_Nbr((yyvsp[(4) - (5)].l)); i++){
Shape TheShape;
List_Read((yyvsp[(4) - (5)].l), i, &TheShape);
VisibilityShape(TheShape.Type, TheShape.Num, 1, true);
}
List_Delete((yyvsp[(4) - (5)].l));
;}
break;
case 193:
#line 2705 "Gmsh.y"
Shape TheShape;
List_Read((yyvsp[(3) - (4)].l), i, &TheShape);
VisibilityShape(TheShape.Type, TheShape.Num, 0, false);
case 194:
#line 2714 "Gmsh.y"
{
for(int i = 0; i < List_Nbr((yyvsp[(4) - (5)].l)); i++){
Shape TheShape;
List_Read((yyvsp[(4) - (5)].l), i, &TheShape);
VisibilityShape(TheShape.Type, TheShape.Num, 0, true);
}
List_Delete((yyvsp[(4) - (5)].l));
;}
break;
case 195:
#line 2728 "Gmsh.y"
std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(2) - (3)].c));

Christophe Geuzaine
committed
Msg::StatusBar(true, "Reading '%s'...", tmp.c_str());

Christophe Geuzaine
committed
// Warning: we explicitly ask ParseFile not to fclose() the included
// file, in order to allow user functions definitions in these files.
// The files will be closed in the next time OpenFile terminates. If
// you need to include many many files and don't have functions in
// the files, use "Merge" instead of "Include", as some OSes limit
// the number of files a process can open simultaneously. (A better
// solution would be to modify FunctionManager to reopen the files
// instead of using the FILE pointer...)
ParseFile(tmp, false, true);
SetBoundingBox();

Christophe Geuzaine
committed
Msg::StatusBar(true, "Done reading '%s'", tmp.c_str());
// make sure we have the latest data from GEO_Internals in GModel
// (fixes bug where we would have no geometry in the picture if
// the print command is in the same file as the geometry)
GModel::current()->importGEOInternals();
std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(2) - (3)].c));
CreateOutputFile(tmp, CTX::instance()->print.fileFormat);
GModel::current()->importGEOInternals();
std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(2) - (3)].c));
CreateOutputFile(tmp, CTX::instance()->mesh.fileFormat);
else if(!strcmp((yyvsp[(1) - (3)].c), "Merge") || !strcmp((yyvsp[(1) - (3)].c), "MergeWithBoundingBox")){
// MergeWithBoundingBox is deprecated
std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(2) - (3)].c));
MergeFile(tmp, true);
}
else if(!strcmp((yyvsp[(1) - (3)].c), "NonBlockingSystemCall"))
SystemCall((yyvsp[(2) - (3)].c));
else if(!strcmp((yyvsp[(1) - (3)].c), "System") || !strcmp((yyvsp[(1) - (3)].c), "SystemCall"))
SystemCall((yyvsp[(2) - (3)].c), true);
else if(!strcmp((yyvsp[(1) - (3)].c), "SetName"))
GModel::current()->setName((yyvsp[(2) - (3)].c));
yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (3)].c));
case 196:
#line 2773 "Gmsh.y"
if(!strcmp((yyvsp[(1) - (7)].c), "Save") && !strcmp((yyvsp[(2) - (7)].c), "View")){
int index = (int)(yyvsp[(4) - (7)].d);
if(index >= 0 && index < (int)PView::list.size()){
std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(6) - (7)].c));
PView::list[index]->write(tmp, CTX::instance()->post.fileFormat);
}
else
yymsg(0, "Unknown view %d", index);
yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (7)].c));

Christophe Geuzaine
committed
#endif
Free((yyvsp[(1) - (7)].c)); Free((yyvsp[(2) - (7)].c)); Free((yyvsp[(6) - (7)].c));
case 197:
#line 2790 "Gmsh.y"
#if defined(HAVE_POST) && defined(HAVE_MESH)
if(!strcmp((yyvsp[(1) - (7)].c), "Background") && !strcmp((yyvsp[(2) - (7)].c), "Mesh") && !strcmp((yyvsp[(3) - (7)].c), "View")){
int index = (int)(yyvsp[(5) - (7)].d);
if(index >= 0 && index < (int)PView::list.size())
GModel::current()->getFields()->setBackgroundMesh(index);
else
yymsg(0, "Unknown view %d", index);
yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (7)].c));

Christophe Geuzaine
committed
#endif
Free((yyvsp[(1) - (7)].c)); Free((yyvsp[(2) - (7)].c)); Free((yyvsp[(3) - (7)].c));
case 198:
#line 2805 "Gmsh.y"
SleepInSeconds((yyvsp[(2) - (3)].d));
yymsg(0, "Surface remeshing must be reinterfaced");
int lock = CTX::instance()->lock;
CTX::instance()->lock = 0;
GModel::current()->importGEOInternals();
GModel::current()->mesh((int)(yyvsp[(2) - (3)].d));
CTX::instance()->lock = lock;
yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (3)].c));
case 199:
#line 2824 "Gmsh.y"
#if defined(HAVE_PLUGINS)
PluginManager::instance()->action((yyvsp[(3) - (7)].c), (yyvsp[(6) - (7)].c), 0);
yymsg(0, "Unknown action '%s' or plugin '%s'", (yyvsp[(6) - (7)].c), (yyvsp[(3) - (7)].c));

Christophe Geuzaine
committed
#endif
case 200:
#line 2836 "Gmsh.y"
PView::combine(false, 1, CTX::instance()->post.combineRemoveOrig);
else if(!strcmp((yyvsp[(2) - (3)].c), "ElementsFromVisibleViews"))
PView::combine(false, 0, CTX::instance()->post.combineRemoveOrig);
PView::combine(false, 2, CTX::instance()->post.combineRemoveOrig);
PView::combine(true, 1, CTX::instance()->post.combineRemoveOrig);
else if(!strcmp((yyvsp[(2) - (3)].c), "TimeStepsFromVisibleViews"))
PView::combine(true, 0, CTX::instance()->post.combineRemoveOrig);
PView::combine(true, 2, CTX::instance()->post.combineRemoveOrig);
PView::combine(false, 1, CTX::instance()->post.combineRemoveOrig);
PView::combine(true, 2, CTX::instance()->post.combineRemoveOrig);
yymsg(0, "Unknown 'Combine' command");

Christophe Geuzaine
committed
#endif
case 201:
#line 2860 "Gmsh.y"
case 202:
#line 2864 "Gmsh.y"
gmsh_yyerrorstate = 999; // this will be checked when yyparse returns
YYABORT;
case 203:
#line 2869 "Gmsh.y"
{
// FIXME: this is a hack to force a transfer from the old DB to
// GModel directly during parsing.
GModel::current()->importGEOInternals();
case 204:
#line 2876 "Gmsh.y"
CTX::instance()->forcedBBox = 0;
case 205:
#line 2882 "Gmsh.y"
CTX::instance()->forcedBBox = 1;
SetBoundingBox((yyvsp[(3) - (15)].d), (yyvsp[(5) - (15)].d), (yyvsp[(7) - (15)].d), (yyvsp[(9) - (15)].d), (yyvsp[(11) - (15)].d), (yyvsp[(13) - (15)].d));
case 206:
#line 2887 "Gmsh.y"
#if defined(HAVE_OPENGL)
case 207:
#line 2893 "Gmsh.y"

Christophe Geuzaine
committed
#if defined(HAVE_OPENGL)
CTX::instance()->mesh.changed = ENT_ALL;
for(unsigned int index = 0; index < PView::list.size(); index++)
PView::list[index]->setChanged(true);
#endif
case 208:
#line 2901 "Gmsh.y"

Christophe Geuzaine
committed
GModel::current()->createTopologyFromMesh();
case 209:
#line 2905 "Gmsh.y"

Christophe Geuzaine
committed
{
GModel::current()->createTopologyFromMesh(1);
;}
break;
case 210:
#line 2909 "Gmsh.y"
{
GModel::current()->importGEOInternals();
GModel::current()->refineMesh(CTX::instance()->mesh.secondOrderLinear);
case 211:
#line 2915 "Gmsh.y"
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
{
int lock = CTX::instance()->lock;
CTX::instance()->lock = 0;
std::vector<int> technique;
for(int i = 0; i < List_Nbr((yyvsp[(3) - (16)].l)); i++){
double d;
List_Read((yyvsp[(3) - (16)].l), i, &d);
technique.push_back((int)d);
}
if(technique.empty()){
yyerror("Need at least one adaptation technique");
}
else{
std::vector<simpleFunction<double>*> f;
for(int i = 0; i < List_Nbr((yyvsp[(6) - (16)].l)); i++){
double d;
List_Read((yyvsp[(6) - (16)].l), i, &d);
LevelSet *l = FindLevelSet((int)d);
if(l) f.push_back(l->ls);
else yymsg(0, "Unknown Levelset %d", (int)d);
}
if(technique.size() != f.size()){
yyerror("Number of techniques != number of levelsets");
}
else{
if(List_Nbr((yyvsp[(9) - (16)].l)) != f.size()){
yyerror("Number of parameters != number of levelsets");
}
else{
std::vector<std::vector<double> > parameters;
parameters.resize(List_Nbr((yyvsp[(9) - (16)].l)));
for(int i = 0; i < List_Nbr((yyvsp[(9) - (16)].l)); i++){
List_T *l = *(List_T**)List_Pointer((yyvsp[(9) - (16)].l), i);
for(int j = 0; j < List_Nbr(l); j++){
double d;
List_Read(l, j, &d);
parameters[i].push_back(d);
}
}
int niter = (int)(yyvsp[(12) - (16)].d);
bool meshAll = ((yyvsp[(14) - (16)].d) == 0) ? false : true;
GModel::current()->importGEOInternals();
GModel::current()->adaptMesh(technique, f, parameters, niter, meshAll);
}
}
}
List_Delete((yyvsp[(3) - (16)].l));
List_Delete((yyvsp[(6) - (16)].l));
for(int i = 0; i < List_Nbr((yyvsp[(9) - (16)].l)); i++)
List_Delete(*(List_T**)List_Pointer((yyvsp[(9) - (16)].l), i));
List_Delete((yyvsp[(9) - (16)].l));
CTX::instance()->lock = lock;
;}
break;
case 212:
#line 2969 "Gmsh.y"
SetOrderN(GModel::current(), (yyvsp[(2) - (3)].d), CTX::instance()->mesh.secondOrderLinear,
CTX::instance()->mesh.secondOrderIncomplete,
CTX::instance()->mesh.meshOnlyVisible);
case 213:
#line 2982 "Gmsh.y"
{
LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[(3) - (6)].d);
LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[(5) - (6)].d);
fgetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop]);
yylinenoImbricatedLoopsTab[ImbricatedLoop] = gmsh_yylineno;
skip_until("For", "EndFor");
if(ImbricatedLoop > MAX_RECUR_LOOPS - 1){
yymsg(0, "Reached maximum number of imbricated loops");
ImbricatedLoop = MAX_RECUR_LOOPS - 1;
case 214:
#line 2999 "Gmsh.y"
{
LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[(3) - (8)].d);
LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[(5) - (8)].d);
LoopControlVariablesTab[ImbricatedLoop][2] = (yyvsp[(7) - (8)].d);
fgetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop]);
yylinenoImbricatedLoopsTab[ImbricatedLoop] = gmsh_yylineno;
if(((yyvsp[(7) - (8)].d) > 0. && (yyvsp[(3) - (8)].d) > (yyvsp[(5) - (8)].d)) || ((yyvsp[(7) - (8)].d) < 0. && (yyvsp[(3) - (8)].d) < (yyvsp[(5) - (8)].d)))
skip_until("For", "EndFor");
if(ImbricatedLoop > MAX_RECUR_LOOPS - 1){
yymsg(0, "Reached maximum number of imbricated loops");
ImbricatedLoop = MAX_RECUR_LOOPS - 1;
case 215:
#line 3016 "Gmsh.y"
{
LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[(5) - (8)].d);
LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[(7) - (8)].d);
LoopControlVariablesNameTab[ImbricatedLoop] = (yyvsp[(2) - (8)].c);
gmsh_yysymbol &s(gmsh_yysymbols[(yyvsp[(2) - (8)].c)]);
s.list = false;
s.value.resize(1);
s.value[0] = (yyvsp[(5) - (8)].d);
fgetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop]);
yylinenoImbricatedLoopsTab[ImbricatedLoop] = gmsh_yylineno;
skip_until("For", "EndFor");
if(ImbricatedLoop > MAX_RECUR_LOOPS - 1){
yymsg(0, "Reached maximum number of imbricated loops");
ImbricatedLoop = MAX_RECUR_LOOPS - 1;
case 216:
#line 3037 "Gmsh.y"
{
LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[(5) - (10)].d);
LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[(7) - (10)].d);
LoopControlVariablesTab[ImbricatedLoop][2] = (yyvsp[(9) - (10)].d);
LoopControlVariablesNameTab[ImbricatedLoop] = (yyvsp[(2) - (10)].c);
gmsh_yysymbol &s(gmsh_yysymbols[(yyvsp[(2) - (10)].c)]);
s.list = false;
s.value.resize(1);
s.value[0] = (yyvsp[(5) - (10)].d);
fgetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop]);
yylinenoImbricatedLoopsTab[ImbricatedLoop] = gmsh_yylineno;
if(((yyvsp[(9) - (10)].d) > 0. && (yyvsp[(5) - (10)].d) > (yyvsp[(7) - (10)].d)) || ((yyvsp[(9) - (10)].d) < 0. && (yyvsp[(5) - (10)].d) < (yyvsp[(7) - (10)].d)))
skip_until("For", "EndFor");
if(ImbricatedLoop > MAX_RECUR_LOOPS - 1){
yymsg(0, "Reached maximum number of imbricated loops");
ImbricatedLoop = MAX_RECUR_LOOPS - 1;
case 217:
#line 3058 "Gmsh.y"
yymsg(0, "Invalid For/EndFor loop");
ImbricatedLoop = 0;
double step = LoopControlVariablesTab[ImbricatedLoop - 1][2];

Christophe Geuzaine
committed
const char *name = LoopControlVariablesNameTab[ImbricatedLoop - 1];
if(name){
if(!gmsh_yysymbols.count(name))

Christophe Geuzaine
committed
else{
gmsh_yysymbol &s(gmsh_yysymbols[name]);
if(!s.list && s.value.size()){
s.value[0] += step;
LoopControlVariablesTab[ImbricatedLoop - 1][0] = s.value[0];
}
else
yymsg(0, "Bad loop variable %s", name);

Christophe Geuzaine
committed
}
}
else{
LoopControlVariablesTab[ImbricatedLoop - 1][0] += step;
}
double x0 = LoopControlVariablesTab[ImbricatedLoop - 1][0];
double x1 = LoopControlVariablesTab[ImbricatedLoop - 1][1];

Christophe Geuzaine
committed
if((step > 0. && x0 <= x1) || (step < 0. && x0 >= x1)){
fsetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop - 1]);
gmsh_yylineno = yylinenoImbricatedLoopsTab[ImbricatedLoop - 1];
}
else
ImbricatedLoop--;
case 218:
#line 3093 "Gmsh.y"
if(!FunctionManager::Instance()->createFunction
((yyvsp[(2) - (2)].c), gmsh_yyin, gmsh_yyname, gmsh_yylineno))
yymsg(0, "Redefinition of function %s", (yyvsp[(2) - (2)].c));
case 219:
#line 3101 "Gmsh.y"
if(!FunctionManager::Instance()->leaveFunction
(&gmsh_yyin, gmsh_yyname, gmsh_yylineno))
yymsg(0, "Error while exiting function");
case 220:
#line 3107 "Gmsh.y"
if(!FunctionManager::Instance()->enterFunction
((yyvsp[(2) - (3)].c), &gmsh_yyin, gmsh_yyname, gmsh_yylineno))
yymsg(0, "Unknown function %s", (yyvsp[(2) - (3)].c));
//FIXME: wee leak $2
case 221:
#line 3114 "Gmsh.y"
case 222:
#line 3118 "Gmsh.y"
case 223:
#line 3127 "Gmsh.y"
(yyvsp[(2) - (5)].v)[0], (yyvsp[(2) - (5)].v)[1], (yyvsp[(2) - (5)].v)[2], 0., 0., 0., 0., 0., 0., 0.,
NULL, (yyval.l));
case 224:
#line 3135 "Gmsh.y"
0., 0., 0., (yyvsp[(3) - (11)].v)[0], (yyvsp[(3) - (11)].v)[1], (yyvsp[(3) - (11)].v)[2], (yyvsp[(5) - (11)].v)[0], (yyvsp[(5) - (11)].v)[1], (yyvsp[(5) - (11)].v)[2], (yyvsp[(7) - (11)].d),
NULL, (yyval.l));
case 225:
#line 3143 "Gmsh.y"
(yyvsp[(3) - (13)].v)[0], (yyvsp[(3) - (13)].v)[1], (yyvsp[(3) - (13)].v)[2], (yyvsp[(5) - (13)].v)[0], (yyvsp[(5) - (13)].v)[1], (yyvsp[(5) - (13)].v)[2], (yyvsp[(7) - (13)].v)[0], (yyvsp[(7) - (13)].v)[1], (yyvsp[(7) - (13)].v)[2], (yyvsp[(9) - (13)].d),
NULL, (yyval.l));
case 226:
#line 3151 "Gmsh.y"

Christophe Geuzaine
committed
extr.mesh.QuadToTri = NO_QUADTRI;
case 227:
#line 3157 "Gmsh.y"
(yyvsp[(2) - (7)].v)[0], (yyvsp[(2) - (7)].v)[1], (yyvsp[(2) - (7)].v)[2], 0., 0., 0., 0., 0., 0., 0.,
&extr, (yyval.l));
case 228:
#line 3165 "Gmsh.y"

Christophe Geuzaine
committed
extr.mesh.QuadToTri = NO_QUADTRI;
case 229:
#line 3171 "Gmsh.y"
0., 0., 0., (yyvsp[(3) - (13)].v)[0], (yyvsp[(3) - (13)].v)[1], (yyvsp[(3) - (13)].v)[2], (yyvsp[(5) - (13)].v)[0], (yyvsp[(5) - (13)].v)[1], (yyvsp[(5) - (13)].v)[2], (yyvsp[(7) - (13)].d),
&extr, (yyval.l));
case 230:
#line 3179 "Gmsh.y"

Christophe Geuzaine
committed
extr.mesh.QuadToTri = NO_QUADTRI;
case 231:
#line 3185 "Gmsh.y"
(yyvsp[(3) - (15)].v)[0], (yyvsp[(3) - (15)].v)[1], (yyvsp[(3) - (15)].v)[2], (yyvsp[(5) - (15)].v)[0], (yyvsp[(5) - (15)].v)[1], (yyvsp[(5) - (15)].v)[2], (yyvsp[(7) - (15)].v)[0], (yyvsp[(7) - (15)].v)[1], (yyvsp[(7) - (15)].v)[2], (yyvsp[(9) - (15)].d),
&extr, (yyval.l));