Skip to content
Snippets Groups Projects
Gmsh.tab.cpp 347 KiB
Newer Older
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        FixRelativePath((yyvsp[(8) - (9)].c), tmpstring2);
        FILE *fp = fopen(tmpstring2, (yyvsp[(7) - (9)].c));
        if(!fp){
          yymsg(0, "Unable to open file '%s'", tmpstring2);
        }
        else{
          fprintf(fp, "%s\n", tmpstring);
          fclose(fp);
        }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(3) - (9)].c));
      Free((yyvsp[(8) - (9)].c));
      List_Delete((yyvsp[(5) - (9)].l));
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!strcmp((yyvsp[(1) - (6)].c), "View") && ViewData->finalize()){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewData->setName((yyvsp[(2) - (6)].c));
        ViewData->setFileName(gmsh_yyname);
        ViewData->setFileIndex(gmsh_yyviewindex++);
        new PView(ViewData);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      else
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        delete ViewData;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (6)].c)); Free((yyvsp[(2) - (6)].c));
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!strcmp((yyvsp[(2) - (6)].c), "View")){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        int index = (int)(yyvsp[(4) - (6)].d);
        if(index >= 0 && index < (int)PView::list.size())
          new PView(PView::list[index], false);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(2) - (6)].c));
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!strcmp((yyvsp[(2) - (6)].c), "View")){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        int index = (int)(yyvsp[(4) - (6)].d);
        if(index >= 0 && index < (int)PView::list.size())
          new PView(PView::list[index], true);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(2) - (6)].c));
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 36:
    { ViewCoord.push_back((yyvsp[(1) - (1)].d)); ;}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 37:
#line 301 "Gmsh.y"
    { ViewCoord.push_back((yyvsp[(3) - (3)].d)); ;}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 38:
    { if(ViewValueList) ViewValueList->push_back((yyvsp[(1) - (1)].d)); ;}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 39:
#line 308 "Gmsh.y"
    { if(ViewValueList) ViewValueList->push_back((yyvsp[(3) - (3)].d)); ;}
    break;

  case 40:
#line 313 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      if(!strncmp((yyvsp[(1) - (1)].c), "SP", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->SP; ViewNumList = &ViewData->NbSP;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "VP", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->VP; ViewNumList = &ViewData->NbVP;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "TP", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->TP; ViewNumList = &ViewData->NbTP;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "SL", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->SL; ViewNumList = &ViewData->NbSL;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_LIN);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "VL", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->VL; ViewNumList = &ViewData->NbVL;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_LIN);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "TL", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->TL; ViewNumList = &ViewData->NbTL;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_LIN);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "ST", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->ST; ViewNumList = &ViewData->NbST;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TRI);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "VT", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->VT; ViewNumList = &ViewData->NbVT;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TRI);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "TT", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->TT; ViewNumList = &ViewData->NbTT;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TRI);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "SQ", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->SQ; ViewNumList = &ViewData->NbSQ;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_QUA);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "VQ", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->VQ; ViewNumList = &ViewData->NbVQ;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_QUA);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "TQ", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->TQ; ViewNumList = &ViewData->NbTQ;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_QUA);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "SS", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->SS; ViewNumList = &ViewData->NbSS;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TET);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "VS", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->VS; ViewNumList = &ViewData->NbVS;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TET);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "TS", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->TS; ViewNumList = &ViewData->NbTS;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TET);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "SH", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->SH; ViewNumList = &ViewData->NbSH;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_HEX);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "VH", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->VH; ViewNumList = &ViewData->NbVH;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_HEX);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "TH", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->TH; ViewNumList = &ViewData->NbTH;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_HEX);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "SI", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->SI; ViewNumList = &ViewData->NbSI;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PRI);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "VI", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->VI; ViewNumList = &ViewData->NbVI;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PRI);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "TI", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->TI; ViewNumList = &ViewData->NbTI;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PRI);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "SY", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->SY; ViewNumList = &ViewData->NbSY;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PYR);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "VY", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->VY; ViewNumList = &ViewData->NbVY;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PYR);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "TY", 2)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ViewValueList = &ViewData->TY; ViewNumList = &ViewData->NbTY;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PYR);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else{
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        yymsg(0, "Unknown element type '%s'", (yyvsp[(1) - (1)].c));    
        ViewValueList = 0; ViewNumList = 0;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
Christophe Geuzaine committed
      ViewCoord.clear();
      Free((yyvsp[(1) - (1)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(ViewValueList){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        for(int i = 0; i < 3; i++)
          for(unsigned int j = 0; j < ViewCoord.size() / 3; j++) 
            ViewValueList->push_back(ViewCoord[3 * j + i]);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(ViewValueList) (*ViewNumList)++;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { 
      for(int i = 0; i < (int)strlen((yyvsp[(1) - (1)].c)) + 1; i++) ViewData->T2C.push_back((yyvsp[(1) - (1)].c)[i]);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (1)].c));
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { 
      for(int i = 0; i < (int)strlen((yyvsp[(3) - (3)].c)) + 1; i++) ViewData->T2C.push_back((yyvsp[(3) - (3)].c)[i]);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(3) - (3)].c));
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { 
      ViewData->T2D.push_back((yyvsp[(3) - (8)].d)); 
      ViewData->T2D.push_back((yyvsp[(5) - (8)].d));
      ViewData->T2D.push_back((yyvsp[(7) - (8)].d)); 
      ViewData->T2D.push_back(ViewData->T2C.size()); 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      ViewData->NbT2++;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { 
      for(int i = 0; i < (int)strlen((yyvsp[(1) - (1)].c)) + 1; i++) ViewData->T3C.push_back((yyvsp[(1) - (1)].c)[i]);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (1)].c));
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { 
      for(int i = 0; i < (int)strlen((yyvsp[(3) - (3)].c)) + 1; i++) ViewData->T3C.push_back((yyvsp[(3) - (3)].c)[i]);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(3) - (3)].c));
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { 
      ViewData->T3D.push_back((yyvsp[(3) - (10)].d)); ViewData->T3D.push_back((yyvsp[(5) - (10)].d));
      ViewData->T3D.push_back((yyvsp[(7) - (10)].d)); ViewData->T3D.push_back((yyvsp[(9) - (10)].d));
      ViewData->T3D.push_back(ViewData->T3C.size()); 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      ViewData->NbT3++;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int type = 
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        (ViewData->NbSL || ViewData->NbVL) ? TYPE_LIN : 
        (ViewData->NbST || ViewData->NbVT) ? TYPE_TRI : 
        (ViewData->NbSQ || ViewData->NbVQ) ? TYPE_QUA : 
        (ViewData->NbSS || ViewData->NbVS) ? TYPE_TET : 
        (ViewData->NbSY || ViewData->NbVY) ? TYPE_PYR : 
        (ViewData->NbSI || ViewData->NbVI) ? TYPE_PRI : 
        (ViewData->NbSH || ViewData->NbVH) ? TYPE_HEX : 
        0;
      ViewData->setInterpolationMatrices(type, ListOfListOfDouble2Matrix((yyvsp[(3) - (8)].l)), 
                                         ListOfListOfDouble2Matrix((yyvsp[(6) - (8)].l)));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int type = 
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        (ViewData->NbSL || ViewData->NbVL) ? TYPE_LIN : 
        (ViewData->NbST || ViewData->NbVT) ? TYPE_TRI : 
        (ViewData->NbSQ || ViewData->NbVQ) ? TYPE_QUA : 
        (ViewData->NbSS || ViewData->NbVS) ? TYPE_TET : 
        (ViewData->NbSH || ViewData->NbVH) ? TYPE_HEX : 
        0;
      ViewData->setInterpolationMatrices(type, ListOfListOfDouble2Matrix((yyvsp[(3) - (14)].l)), 
                                         ListOfListOfDouble2Matrix((yyvsp[(6) - (14)].l)),
                                         ListOfListOfDouble2Matrix((yyvsp[(9) - (14)].l)), 
                                         ListOfListOfDouble2Matrix((yyvsp[(12) - (14)].l)));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { (yyval.i) = 0; ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { (yyval.i) = 1; ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { (yyval.i) = 2; ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { (yyval.i) = 3; ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { (yyval.i) = 4; ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { (yyval.i) = 1; ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { (yyval.i) = -1; ;}
    break;

    {
      if(!gmsh_yysymbols.count((yyvsp[(1) - (4)].c))){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        if(!(yyvsp[(2) - (4)].i))
          gmsh_yysymbols[(yyvsp[(1) - (4)].c)].push_back((yyvsp[(3) - (4)].d));
        else
          yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (4)].c));
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        switch((yyvsp[(2) - (4)].i)){
        case 0 : gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] = (yyvsp[(3) - (4)].d); break;
        case 1 : gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] += (yyvsp[(3) - (4)].d); break;
        case 2 : gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] -= (yyvsp[(3) - (4)].d); break;
        case 3 : gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] *= (yyvsp[(3) - (4)].d); break;
        case 4 : 
          if((yyvsp[(3) - (4)].d)) gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] /= (yyvsp[(3) - (4)].d); 
          else yymsg(0, "Division by zero in '%s /= %g'", (yyvsp[(1) - (4)].c), (yyvsp[(3) - (4)].d));
          break;
        }
      Free((yyvsp[(1) - (4)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      int index = (int)(yyvsp[(3) - (7)].d);
      if(!gmsh_yysymbols.count((yyvsp[(1) - (7)].c))){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        if(!(yyvsp[(5) - (7)].i)){
          gmsh_yysymbols[(yyvsp[(1) - (7)].c)].resize(index + 1, 0.);
          gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] = (yyvsp[(6) - (7)].d);
        }
        else
          yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (7)].c));
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        if((int)gmsh_yysymbols[(yyvsp[(1) - (7)].c)].size() < index + 1)
          gmsh_yysymbols[(yyvsp[(1) - (7)].c)].resize(index + 1, 0.);
        switch((yyvsp[(5) - (7)].i)){
        case 0 : gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] = (yyvsp[(6) - (7)].d); break;
        case 1 : gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] += (yyvsp[(6) - (7)].d); break;
        case 2 : gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] -= (yyvsp[(6) - (7)].d); break;
        case 3 : gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] *= (yyvsp[(6) - (7)].d); break;
        case 4 : 
          if((yyvsp[(6) - (7)].d)) gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] /= (yyvsp[(6) - (7)].d); 
          else yymsg(0, "Division by zero in '%s[%d] /= %g'", (yyvsp[(1) - (7)].c), index, (yyvsp[(6) - (7)].d));
          break;
        }
      Free((yyvsp[(1) - (7)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      if(List_Nbr((yyvsp[(4) - (9)].l)) != List_Nbr((yyvsp[(8) - (9)].l))){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        yymsg(0, "Incompatible array dimensions in affectation");
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        if(!gmsh_yysymbols.count((yyvsp[(1) - (9)].c))){
          if(!(yyvsp[(7) - (9)].i)){
            for(int i = 0; i < List_Nbr((yyvsp[(4) - (9)].l)); i++){
              int index = (int)(*(double*)List_Pointer((yyvsp[(4) - (9)].l), i));
              gmsh_yysymbols[(yyvsp[(1) - (9)].c)].resize(index + 1, 0.);
              gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] = *(double*)List_Pointer((yyvsp[(8) - (9)].l), i);
            }
          }
          else
            yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (9)].c));
        }
        else{
          for(int i = 0; i < List_Nbr((yyvsp[(4) - (9)].l)); i++){
            int index = (int)(*(double*)List_Pointer((yyvsp[(4) - (9)].l), i));
            double d = *(double*)List_Pointer((yyvsp[(8) - (9)].l), i);
            if((int)gmsh_yysymbols[(yyvsp[(1) - (9)].c)].size() < index + 1)
              gmsh_yysymbols[(yyvsp[(1) - (9)].c)].resize(index + 1, 0.);
            switch((yyvsp[(7) - (9)].i)){
            case 0 : gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] = d; break;
            case 1 : gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] += d; break;
            case 2 : gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] -= d; break;
            case 3 : gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] *= d; break;
            case 4 : 
              if((yyvsp[(8) - (9)].l)) gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] /= d; 
              else yymsg(0, "Division by zero in '%s[%d] /= %g'", (yyvsp[(1) - (9)].c), index, d);
              break;
            }
          }
        }
      Free((yyvsp[(1) - (9)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete((yyvsp[(4) - (9)].l));
      List_Delete((yyvsp[(8) - (9)].l));
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      if(gmsh_yysymbols.count((yyvsp[(1) - (6)].c)))
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        gmsh_yysymbols[(yyvsp[(1) - (6)].c)].clear();
      gmsh_yysymbols[(yyvsp[(1) - (6)].c)] = std::vector<double>();
      for(int i = 0; i < List_Nbr((yyvsp[(5) - (6)].l)); i++)
        gmsh_yysymbols[(yyvsp[(1) - (6)].c)].push_back(*(double*)List_Pointer((yyvsp[(5) - (6)].l), i));
      Free((yyvsp[(1) - (6)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete((yyvsp[(5) - (6)].l));
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      // appends to the list
      for(int i = 0; i < List_Nbr((yyvsp[(5) - (6)].l)); i++)
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        gmsh_yysymbols[(yyvsp[(1) - (6)].c)].push_back(*(double*)List_Pointer((yyvsp[(5) - (6)].l), i));
      Free((yyvsp[(1) - (6)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete((yyvsp[(5) - (6)].l));
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      if(!gmsh_yysymbols.count((yyvsp[(1) - (3)].c)))
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (3)].c)); 
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        gmsh_yysymbols[(yyvsp[(1) - (3)].c)][0] += (yyvsp[(2) - (3)].i);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (3)].c));
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      if(!gmsh_yysymbols.count((yyvsp[(1) - (6)].c)))
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (6)].c)); 
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        int index = (int)(yyvsp[(3) - (6)].d);
        if((int)gmsh_yysymbols[(yyvsp[(1) - (6)].c)].size() < index + 1)
          gmsh_yysymbols[(yyvsp[(1) - (6)].c)].resize(index + 1, 0.);
        gmsh_yysymbols[(yyvsp[(1) - (6)].c)][index] += (yyvsp[(5) - (6)].i);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (6)].c));
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { 
      gmsh_yystringsymbols[(yyvsp[(1) - (4)].c)] = std::string((yyvsp[(3) - (4)].c));
      Free((yyvsp[(1) - (4)].c));
      Free((yyvsp[(3) - (4)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      std::string tmp((yyvsp[(5) - (6)].c));
      StringOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (6)].c), 0, (yyvsp[(3) - (6)].c), tmp);
      Free((yyvsp[(1) - (6)].c)); Free((yyvsp[(3) - (6)].c)); Free((yyvsp[(5) - (6)].c))
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      std::string tmp((yyvsp[(8) - (9)].c));
      StringOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), tmp);
      Free((yyvsp[(1) - (9)].c)); Free((yyvsp[(6) - (9)].c)); Free((yyvsp[(8) - (9)].c))
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

    {
      double d = 0.;
      if(NumberOption(GMSH_GET, (yyvsp[(1) - (6)].c), 0, (yyvsp[(3) - (6)].c), d)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        switch((yyvsp[(4) - (6)].i)){
        case 0 : d = (yyvsp[(5) - (6)].d); break;
        case 1 : d += (yyvsp[(5) - (6)].d); break;
        case 2 : d -= (yyvsp[(5) - (6)].d); break;
        case 3 : d *= (yyvsp[(5) - (6)].d); break;
        case 4 : 
          if((yyvsp[(5) - (6)].d)) d /= (yyvsp[(5) - (6)].d); 
          else yymsg(0, "Division by zero in '%s.%s /= %g'", (yyvsp[(1) - (6)].c), (yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].d));
          break;
        }
        NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (6)].c), 0, (yyvsp[(3) - (6)].c), d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (6)].c)); Free((yyvsp[(3) - (6)].c));
    ;}
    break;

    {
      double d = 0.;
      if(NumberOption(GMSH_GET, (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), d)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        switch((yyvsp[(7) - (9)].i)){
        case 0 : d = (yyvsp[(8) - (9)].d); break;
        case 1 : d += (yyvsp[(8) - (9)].d); break;
        case 2 : d -= (yyvsp[(8) - (9)].d); break;
        case 3 : d *= (yyvsp[(8) - (9)].d); break;
        case 4 : 
          if((yyvsp[(8) - (9)].d)) d /= (yyvsp[(8) - (9)].d); 
          else yymsg(0, "Division by zero in '%s[%d].%s /= %g'", (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].d));
          break;
        }
        NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (9)].c)); Free((yyvsp[(6) - (9)].c));
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      double d = 0.;
      if(NumberOption(GMSH_GET, (yyvsp[(1) - (5)].c), 0, (yyvsp[(3) - (5)].c), d)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        d += (yyvsp[(4) - (5)].i);
        NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (5)].c), 0, (yyvsp[(3) - (5)].c), d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (5)].c)); Free((yyvsp[(3) - (5)].c));
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      double d = 0.;
      if(NumberOption(GMSH_GET, (yyvsp[(1) - (8)].c), (int)(yyvsp[(3) - (8)].d), (yyvsp[(6) - (8)].c), d)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        d += (yyvsp[(7) - (8)].i);
        NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (8)].c), (int)(yyvsp[(3) - (8)].d), (yyvsp[(6) - (8)].c), d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (8)].c)); Free((yyvsp[(6) - (8)].c));
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      ColorOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (8)].c), 0, (yyvsp[(5) - (8)].c), (yyvsp[(7) - (8)].u));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (8)].c)); Free((yyvsp[(5) - (8)].c));
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      ColorOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (11)].c), (int)(yyvsp[(3) - (11)].d), (yyvsp[(8) - (11)].c), (yyvsp[(10) - (11)].u));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (11)].c)); Free((yyvsp[(8) - (11)].c));
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      GmshColorTable *ct = GetColorTable(0);
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        yymsg(0, "View[%d] does not exist", 0);
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ct->size = List_Nbr((yyvsp[(5) - (6)].l));
        if(ct->size > COLORTABLE_NBMAX_COLOR)
          yymsg(0, "Too many (%d>%d) colors in View[%d].ColorTable", 
                ct->size, COLORTABLE_NBMAX_COLOR, 0);
        else
          for(int i = 0; i < ct->size; i++) List_Read((yyvsp[(5) - (6)].l), i, &ct->table[i]);
        if(ct->size == 1){
          ct->size = 2;
          ct->table[1] = ct->table[0];
        }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (6)].c));
      List_Delete((yyvsp[(5) - (6)].l));
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      GmshColorTable *ct = GetColorTable((int)(yyvsp[(3) - (9)].d));
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        yymsg(0, "View[%d] does not exist", (int)(yyvsp[(3) - (9)].d));
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        ct->size = List_Nbr((yyvsp[(8) - (9)].l));
        if(ct->size > COLORTABLE_NBMAX_COLOR)
          yymsg(0, "Too many (%d>%d) colors in View[%d].ColorTable", 
                   ct->size, COLORTABLE_NBMAX_COLOR, (int)(yyvsp[(3) - (9)].d));
        else
          for(int i = 0; i < ct->size; i++) List_Read((yyvsp[(8) - (9)].l), i, &ct->table[i]);
        if(ct->size == 1){
          ct->size = 2;
          ct->table[1] = ct->table[0];
        }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (9)].c));
      List_Delete((yyvsp[(8) - (9)].l));
    ;}
    break;

      if(!strcmp((yyvsp[(1) - (5)].c),"Background"))
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        GModel::current()->getFields()->background_field = (int)(yyvsp[(4) - (5)].d);
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        yymsg(0, "Unknown command %s Field", (yyvsp[(1) - (5)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
      if(!GModel::current()->getFields()->newField((int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c)))
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        yymsg(0, "Cannot create field %i of type '%s'", (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c));
      Free((yyvsp[(6) - (7)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      Field *field = GModel::current()->getFields()->get((int)(yyvsp[(3) - (9)].d));
      if(field){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        FieldOption *option = field->options[(yyvsp[(6) - (9)].c)];
        if(option){
          try { option->numericalValue((yyvsp[(8) - (9)].d)); }
          catch(...){
            yymsg(0, "Cannot assign a numerical value to option '%s' "
                  "in field %i of type '%s'", (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName());
          }
        }
        else
          yymsg(0, "Unknown option '%s' in field %i of type '%s'",
                (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName());
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (9)].d));
      Free((yyvsp[(6) - (9)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      Field *field = GModel::current()->getFields()->get((int)(yyvsp[(3) - (9)].d));
      if(field){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        FieldOption *option = field->options[(yyvsp[(6) - (9)].c)];
        if(option){
          try { option->string() = (yyvsp[(8) - (9)].c); }
          catch (...){
            yymsg(0, "Cannot assign a string value to  option '%s' "
                  "in field %i of type '%s'", (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName());
          }
        }
        else 
          yymsg(0, "Unknown option '%s' in field %i of type '%s'", 
                (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName());
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else 
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (9)].d));
      Free((yyvsp[(6) - (9)].c));
      Free((yyvsp[(8) - (9)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      Field *field = GModel::current()->getFields()->get((int)(yyvsp[(3) - (11)].d));
      if(field){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        FieldOption *option = field->options[(yyvsp[(6) - (11)].c)];
        if(option){
          std::list<int> &vl = option->list();
          vl.clear();
          for(int i = 0; i < List_Nbr((yyvsp[(9) - (11)].l)); i++){
            double id;
            List_Read((yyvsp[(9) - (11)].l), i, &id);
            vl.push_back((int)id);
          }
        }
        else
          yymsg(0, "Unknown option '%s' in field %i of type '%s'",
                (yyvsp[(6) - (11)].c), (int)(yyvsp[(3) - (11)].d), field->getName());
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else 
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (11)].d));
      Free((yyvsp[(6) - (11)].c));
      List_Delete((yyvsp[(9) - (11)].l));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      try {
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        PluginManager::instance()->setPluginOption((yyvsp[(3) - (9)].c), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].d)); 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      catch (...) {
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        yymsg(0, "Unknown option '%s' or plugin '%s'", (yyvsp[(6) - (9)].c), (yyvsp[(3) - (9)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(3) - (9)].c)); Free((yyvsp[(6) - (9)].c));
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      try {
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        PluginManager::instance()->setPluginOption((yyvsp[(3) - (9)].c), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].c)); 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      catch (...) {
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        yymsg(0, "Unknown option '%s' or plugin '%s'", (yyvsp[(6) - (9)].c), (yyvsp[(3) - (9)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      Free((yyvsp[(3) - (9)].c)); Free((yyvsp[(6) - (9)].c)); Free((yyvsp[(8) - (9)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { 
      (yyval.i) = (int)(yyvsp[(1) - (1)].d); 
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { 
      (yyval.i) = GModel::current()->setPhysicalName
        (std::string((yyvsp[(1) - (1)].c)), curPhysDim, 
         ++GModel::current()->getGEOInternals()->MaxPhysicalNum);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (1)].c));
    ;}
    break;

Christophe Geuzaine's avatar
Christophe Geuzaine committed
      (yyval.l) = List_Create(1, 1, sizeof(Vertex*));
      Vertex *v = FindPoint((int)(yyvsp[(4) - (5)].d));
      if(!v)
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        yymsg(0, "Unknown point %d", (int)(yyvsp[(4) - (5)].d));
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        List_Add((yyval.l), &v);
Christophe Geuzaine's avatar
Christophe Geuzaine committed
    {
      for(int i = 0; i < 4; i++) (yyval.v)[i] = 0.;
    ;}
    break;

Christophe Geuzaine's avatar
Christophe Geuzaine committed
    {
      for(int i = 0; i < 4; i++) (yyval.v)[i] = (yyvsp[(2) - (2)].v)[i];
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      int num = (int)(yyvsp[(3) - (7)].d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(FindPoint(num)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        yymsg(0, "Point %d already exists", num);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else{
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        double x = CTX::instance()->geom.scalingFactor * (yyvsp[(6) - (7)].v)[0];
        double y = CTX::instance()->geom.scalingFactor * (yyvsp[(6) - (7)].v)[1];
        double z = CTX::instance()->geom.scalingFactor * (yyvsp[(6) - (7)].v)[2];
        double lc = CTX::instance()->geom.scalingFactor * (yyvsp[(6) - (7)].v)[3];
        if(lc == 0.) lc = MAX_LC; // no mesh size given at the point
        Vertex *v;
        if(!myGmshSurface)
          v = Create_Vertex(num, x, y, z, lc, 1.0);
        else
          v = Create_Vertex(num, x, y, myGmshSurface, lc);
        Tree_Add(GModel::current()->getGEOInternals()->Points, &v);
        AddToTemporaryBoundingBox(v->Pos.X, v->Pos.Y, v->Pos.Z);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      (yyval.s).Type = MSH_POINT;
      (yyval.s).Num = num;
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(FindPhysicalGroup(num, MSH_PHYSICAL_POINT)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        yymsg(0, "Physical point %d already exists", num);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else{
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l));
        PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_POINT, temp);
        List_Delete(temp);
        List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      (yyval.s).Type = MSH_PHYSICAL_POINT;
      (yyval.s).Num = num;
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {      
      for(int i = 0; i < List_Nbr((yyvsp[(3) - (6)].l)); i++){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        double d;
        List_Read((yyvsp[(3) - (6)].l), i, &d);
        Vertex *v = FindPoint((int)d);   
        if(v)
          v->lc = (yyvsp[(5) - (6)].d);
        else{
          GVertex *gv = GModel::current()->getVertexByTag((int)d);
          if(gv) 
            gv->setPrescribedMeshSizeAtVertex((yyvsp[(5) - (6)].d));
        }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete((yyvsp[(3) - (6)].l));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      // dummy values
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      (yyval.s).Type = 0;
      (yyval.s).Num = 0;
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      int num = (int)(yyvsp[(3) - (7)].d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(FindCurve(num)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        yymsg(0, "Curve %d already exists", num);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      else{
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l));
        Curve *c = Create_Curve(num, MSH_SEGM_LINE, 1, temp, NULL,
                                -1, -1, 0., 1.);
        Tree_Add(GModel::current()->getGEOInternals()->Curves, &c);
        CreateReversedCurve(c);
        List_Delete(temp);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete((yyvsp[(6) - (7)].l));
      (yyval.s).Type = MSH_SEGM_LINE;
      (yyval.s).Num = num;
    ;}
    break;

    {
      for (int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        double dnum;
        List_Read((yyvsp[(3) - (4)].l), i, &dnum);
        int num = (int) fabs(dnum);
        Curve *c = FindCurve(num);
        if (c){
          c->degenerated = true;
        }
        else{
          GEdge *ge = GModel::current()->getEdgeByTag(num);
          if (!ge){
            yymsg(0, "Curve %d does not exist", num);
          }
          else{
            ge->setTooSmall(true);
          }
        }
      }
    ;}
    break;

  case 99:
#line 1096 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      int num = (int)(yyvsp[(3) - (7)].d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(FindCurve(num)){
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        yymsg(0, "Curve %d already exists", num);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else{
Christophe Geuzaine's avatar
pp  
Christophe Geuzaine committed
        List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l));
        Curve *c = Create_Curve(num, MSH_SEGM_SPLN, 3, temp, NULL,
                                -1, -1, 0., 1.);
        Tree_Add(GModel::current()->getGEOInternals()->Curves, &c);
        CreateReversedCurve(c);
        List_Delete(temp);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete((yyvsp[(6) - (7)].l));
      (yyval.s).Type = MSH_SEGM_SPLN;