From c7bb8e27de04857ae654ce8286350b28cda19a5f Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sat, 29 Aug 2009 12:13:15 +0000 Subject: [PATCH] pp --- Geo/GEdgeCompound.cpp | 75 +- Geo/GEdgeCompound.h | 7 +- Geo/GFaceCompound.cpp | 605 +++--- Geo/GFaceCompound.h | 21 +- Geo/GModelIO_Geo.cpp | 2 +- Geo/GModelIO_OCC.cpp | 188 +- Geo/GModelIO_OCC.h | 8 +- Geo/GRegionCompound.cpp | 32 +- Geo/GRegionCompound.h | 7 +- Geo/MElementCut.cpp | 86 +- Mesh/Generator.cpp | 42 +- Mesh/meshGFaceBDS.cpp | 18 +- Mesh/meshGFaceOptimize.cpp | 202 +- Mesh/meshGRegion.cpp | 65 +- Numeric/gmshAssembler.h | 10 +- Numeric/gmshLinearSystemCSR.cpp | 30 +- Numeric/gmshLinearSystemFull.h | 20 +- Parser/Gmsh.tab.cpp | 2248 ++++++++++----------- Parser/Gmsh.yy.cpp | 1888 ++++++++--------- benchmarks/stl/PelvisARTHUR_CLASS_GEO.geo | 9 +- doc/VERSIONS.txt | 4 +- doc/gmsh.html | 2 +- 22 files changed, 2727 insertions(+), 2842 deletions(-) diff --git a/Geo/GEdgeCompound.cpp b/Geo/GEdgeCompound.cpp index 46e821bc15..3321408162 100644 --- a/Geo/GEdgeCompound.cpp +++ b/Geo/GEdgeCompound.cpp @@ -12,16 +12,17 @@ #include "GEdgeCompound.h" #include "Numeric.h" -GEdgeCompound::GEdgeCompound(GModel *m, int tag, std::vector<GEdge*> &compound, std::vector<int> &orientation) - : GEdge(m, tag, 0 , 0), _compound(compound), _orientation(orientation) +GEdgeCompound::GEdgeCompound(GModel *m, int tag, std::vector<GEdge*> &compound, + std::vector<int> &orientation) + : GEdge(m, tag, 0, 0), _compound(compound), _orientation(orientation) { int N = _compound.size(); - v0 = _orientation[0] ? _compound[0]->getBeginVertex() : _compound[0]->getEndVertex(); - v1 = _orientation[N-1] ? _compound[N-1]->getEndVertex() : _compound[N-1]->getBeginVertex(); + v0 = _orientation[0] ? _compound[0]->getBeginVertex() : _compound[0]->getEndVertex(); + v1 = _orientation[N-1] ? _compound[N-1]->getEndVertex() : _compound[N-1]->getBeginVertex(); v0->addEdge(this); v1->addEdge(this); - for (unsigned int i=0;i<_compound.size();i++) + for (unsigned int i = 0; i < _compound.size(); i++) _compound[i]->setCompound(this); parametrize(); @@ -32,24 +33,23 @@ GEdgeCompound::GEdgeCompound(GModel *m, int tag, std::vector<GEdge*> &compound) { orderEdges (); int N = _compound.size(); - v0 = _orientation[0] ? _compound[0]->getBeginVertex() : _compound[0]->getEndVertex(); - v1 = _orientation[N-1] ? _compound[N-1]->getEndVertex() : _compound[N-1]->getBeginVertex(); + v0 = _orientation[0] ? _compound[0]->getBeginVertex() : _compound[0]->getEndVertex(); + v1 = _orientation[N-1] ? _compound[N-1]->getEndVertex() : _compound[N-1]->getBeginVertex(); v0->addEdge(this); v1->addEdge(this); - for (unsigned int i=0;i<_compound.size();i++) + for (unsigned int i = 0; i < _compound.size(); i++) _compound[i]->setCompound(this); parametrize(); } - void GEdgeCompound::orderEdges() { std::vector<GEdge*> _c ; std::list<GEdge*> edges ; - for (unsigned int i=0;i<_compound.size();i++){ + for (unsigned int i = 0; i < _compound.size(); i++){ edges.push_back(_compound[i]); } @@ -72,7 +72,7 @@ void GEdgeCompound::orderEdges() //find the first GEdge and erase it from the list edges GEdge *firstEdge; - if (tempv.size()==2){ // non periodic + if (tempv.size() == 2){ // non periodic firstEdge = (tempv.begin())->second; for (std::list<GEdge*>::iterator it = edges.begin() ; it != edges.end() ; ++it){ if (*it == firstEdge){ @@ -81,18 +81,16 @@ void GEdgeCompound::orderEdges() } } } - else if (tempv.size()==0) // periodic - { - firstEdge = *(edges.begin()); - edges.erase(edges.begin()); - } + else if (tempv.size() == 0){ // periodic + firstEdge = *(edges.begin()); + edges.erase(edges.begin()); + } else{ Msg::Error("EdgeCompound %d is wrong (it has %d end points)",tag(),tempv.size()); - Msg::Exit(1); - + return; } - //loop over all segments to order segments and store it in the list _c + // loop over all segments to order segments and store it in the list _c _c.push_back(firstEdge); _orientation.push_back(1); GVertex *first = _c[0]->getBeginVertex(); @@ -150,15 +148,13 @@ void GEdgeCompound::orderEdges() _orientation[i] = !_orientation[i] ; } } - - return; - } int GEdgeCompound::minimumMeshSegments() const { int N = 0; - for (unsigned int i = 0; i < _compound.size(); i++) N +=_compound[i]->minimumMeshSegments(); + for (unsigned int i = 0; i < _compound.size(); i++) + N +=_compound[i]->minimumMeshSegments(); return 3; } @@ -166,7 +162,7 @@ int GEdgeCompound::minimumDrawSegments() const { int N = 0; for (unsigned int i = 0; i < _compound.size(); i++) - N +=_compound[i]->minimumDrawSegments(); + N += _compound[i]->minimumDrawSegments(); return N; } @@ -185,13 +181,11 @@ Range<double> GEdgeCompound::parBounds(int i) const */ -void GEdgeCompound::getLocalParameter ( const double &t, - int &iEdge, - double & tLoc) const +void GEdgeCompound::getLocalParameter(const double &t, + int &iEdge, + double & tLoc) const { - for (iEdge = 0; iEdge < (int)_compound.size(); iEdge++){ - //printf("iEdge=%d tmin=%g\n",iEdge,_pars[iEdge]); double tmin = _pars[iEdge]; double tmax = _pars[iEdge+1]; if (t >= tmin && t <= tmax){ @@ -199,35 +193,28 @@ void GEdgeCompound::getLocalParameter ( const double &t, tLoc = _orientation[iEdge] ? b.low() + (t-tmin)/(tmax-tmin) * (b.high()-b.low()) : b.high() - (t-tmin)/(tmax-tmin) * (b.high()-b.low()) ; - //printf("bhigh=%g, blow=%g, global t=%g , tLoc=%g ,iEdge=%d\n",b.high(), b.low(), t,tLoc,iEdge); return; } } } -// give a GEdge and -void GEdgeCompound::getCompoundParameter ( GEdge *ge, - const double &tLoc, - double &t) const +void GEdgeCompound::getCompoundParameter(GEdge *ge, + const double &tLoc, + double &t) const { - for (int iEdge = 0; iEdge < (int)_compound.size(); iEdge++){ - //printf("iEdge=%d tmin=%g\n",iEdge,_pars[iEdge]); if (ge == _compound[iEdge]){ double tmin = _pars[iEdge]; double tmax = _pars[iEdge+1]; Range<double> b = _compound[iEdge]->parBounds(0); t = _orientation[iEdge] ? - tmin + (tLoc - b.low())/(b.high()-b.low()) * (tmax-tmin): - tmax - (tLoc - b.low())/(b.high()-b.low()) * (tmax-tmin); - //printf("bhigh=%g, blow=%g, global t=%g , tLoc=%g ,iEdge=%d\n",b.high(), b.low(), t,tLoc,iEdge); + tmin + (tLoc - b.low())/(b.high()-b.low()) * (tmax-tmin): + tmax - (tLoc - b.low())/(b.high()-b.low()) * (tmax-tmin); return; } } } - - void GEdgeCompound::parametrize() { _pars.push_back(0.0); @@ -235,11 +222,6 @@ void GEdgeCompound::parametrize() Range<double> b = _compound[i]->parBounds(0); _pars.push_back(_pars[_pars.size()-1]+(b.high() - b.low())); } - - // for (int i=0;i<_compound.size()+1;i++){ - // printf("_pars[%d]=%g\n",i, _pars[i] ); - //} - } double GEdgeCompound::curvature(double par) const @@ -256,7 +238,6 @@ GPoint GEdgeCompound::point(double par) const int iEdge; getLocalParameter(par,iEdge,tLoc); return _compound[iEdge]->point(tLoc); - } SVector3 GEdgeCompound::firstDer(double par) const diff --git a/Geo/GEdgeCompound.h b/Geo/GEdgeCompound.h index e16d04ab45..fe31fff112 100644 --- a/Geo/GEdgeCompound.h +++ b/Geo/GEdgeCompound.h @@ -9,9 +9,7 @@ #include "GFace.h" #include "GEdge.h" -/* -A GEdgeCompound is a model edge that is the compound of model edges. -*/ +// A GEdgeCompound is a model edge that is the compound of model edges. class GEdgeCompound : public GEdge { protected: @@ -24,7 +22,8 @@ public: void getLocalParameter(const double &t, int &iEdge, double & tLoc) const; void getCompoundParameter(GEdge *ge, const double &tLoc, double &t) const; GEdgeCompound(GModel *m, int tag, std::vector<GEdge*> &compound); - GEdgeCompound(GModel *m, int tag, std::vector<GEdge*> &compound, std::vector<int> &orientation); // confidence in the input + GEdgeCompound(GModel *m, int tag, std::vector<GEdge*> &compound, + std::vector<int> &orientation); // confidence in the input virtual ~GEdgeCompound(); Range<double> parBounds(int i) const; virtual GPoint point(double par) const; diff --git a/Geo/GFaceCompound.cpp b/Geo/GFaceCompound.cpp index 7a7c3f702f..5d5a0cb5ac 100644 --- a/Geo/GFaceCompound.cpp +++ b/Geo/GFaceCompound.cpp @@ -26,145 +26,84 @@ static void fixEdgeToValue(GEdge *ed, double value, gmshAssembler<double> &myAss { myAssembler.fixVertex(ed->getBeginVertex()->mesh_vertices[0], 0, 1, value); myAssembler.fixVertex(ed->getEndVertex()->mesh_vertices[0], 0, 1, value); - for (unsigned int i = 0; i < ed->mesh_vertices.size(); i++){ + for(unsigned int i = 0; i < ed->mesh_vertices.size(); i++){ myAssembler.fixVertex(ed->mesh_vertices[i], 0, 1, value); } } -static void computeCGKernelPolygon(std::map<MVertex*,SPoint3> &coordinates, std::vector<MVertex*> &cavV, double &ucg, double &vcg){ - - ucg = 0.0; - vcg = 0.0; - - //Place at CG KERNEL polygon - //-------------------------- +static void computeCGKernelPolygon(std::map<MVertex*,SPoint3> &coordinates, + std::vector<MVertex*> &cavV, double &ucg, double &vcg) +{ + ucg = 0.0; + vcg = 0.0; + + // place at CG KERNEL polygon int nbPts = cavV.size(); - //printf("COUCOU kernel polygon nbPts = %d\n", nbPts); gmshMatrix<double> u(100,2); - int i=0; - for (std::vector<MVertex*>::iterator it = cavV.begin(); it != cavV.end(); it++){ + int i = 0; + for(std::vector<MVertex*>::iterator it = cavV.begin(); it != cavV.end(); it++){ SPoint3 vsp = coordinates[*it]; u(i,0) = vsp[0]; u(i,1) = vsp[1]; - //printf("u(%d,0)=%g, u(%d, 1)=%g \n", i, vsp[0], i, vsp[1]); i++; } - - //cavity 1 - // mat(0,0) =0.4158; mat(0,1)=0.445671; -// mat(1,0) =0.39449; mat(1,1)= 0.473701; -// mat(2,0) =0.399136; mat(2,1)= 0.452657; -// mat(3,0) =0.424101; mat(3,1)= 0.435164; -// mat(4,0) =0.431606; mat(4,1)= 0.44255; -// mat(5,0) =0.42926; mat(5,1)= 0.442389; - - // //cavity 3 -// mat(0,0) = 0. ; mat(0,1) = 5.; -// mat(1,0) = -4. ; mat(1,1) = -4.; -// mat(2,0) = 0. ; mat(2,1) = 0.; -// mat(3,0) = 4. ; mat(3,1) = -4.; - -// //cavity 4 -// mat(0,0) =0.; mat(0,1)=5. ; -// mat(1,0) =-2.; mat(1,1)=1. ; -// mat(2,0) =-4.; mat(2,1)=1. ; -// mat(3,0) =-2.; mat(3,1)= -1.; -// mat(4,0) =2.; mat(4,1)=-1. ; -// mat(5,0) =4.; mat(5,1)=1. ; -// mat(6,0) =2.; mat(6,1)= 1.; - -// //cavity 5 -// mat(0,0) =0.; mat(0,1)=5. ; -// mat(1,0) =-2.; mat(1,1)=1. ; -// mat(2,0) =-4.; mat(2,1)=1. ; -// mat(3,0) =-2.; mat(3,1)= -1.; -// mat(4,0) =-4.; mat(4,1)=-5. ; -// mat(5,0) =0.; mat(5,1)=-3 ; -// mat(6,0) =4.; mat(6,1)=-5.; -// mat(7,0) =2.; mat(7,1)=-1. ; -// mat(8,0) =4.; mat(8,1)=1. ; -// mat(9,0) =2.; mat(9,1)= 1.; - -// //cavity 6 -// mat(0,0) =1.; mat(0,1)=0. ; -// mat(1,0) =1.;mat(1,1)=1. ; -// mat(2,0) =0.;mat(2,1)=1. ; -// mat(3,0) =0.;mat(3,1)=0. ; - - double eps=-5.e-7; - int N=nbPts; - + double eps = -5.e-7; + int N = nbPts; + std::set<int> setP; - for (int k=0; k< nbPts; k++) setP.insert(k); - //for(std::set<int>::iterator it =setP.begin(); it != setP.end(); it++) printf("setP =%d \n", *it); - - if(nbPts > 3){ - - for (int i=0; i< nbPts-2; i++){ - int next=i+1; - //printf("*** POINT i=%d next=%d\n", i, next); - //printf("-----------------------\n"); - double x1, x2, y1, y2; - x1=u(i,0); y1=u(i,1); - x2=u(next,0); y2=u(next,1); - for ( int j=i+2; j < nbPts; j++){ - int jnext = j+1; - if(j == nbPts-1) jnext = 0; - //printf("---> POINT j=%d jnext=%d\n", j, jnext); - double x3, x4, y3, y4, x,y; - double a, b, c, d; - x3=u(j,0); y3=u(j,1); - x4=u(jnext,0); y4=u(jnext,1); - a=(y2-y1)/(x2-x1); - c=(y4-y3)/(x4-x3); - b=y1-a*x1; - d=y3-c*x3; - if (fabs(a-c) > 1.e-5 && x2!=x1 && x4 !=x3 && jnext != i){ - x=(d-b)/(a-c); - y=a*x+b; - bool exist= false; - for (unsigned int k= 1; k < setP.size(); k++){ - if (x == u(k,0) && y == u(k,1)) exist = true; - } - if (!exist){ - //printf("---> intersection (%d)=%g %g %g %g\n", N, x, y, a, c); - u(N,0)=x; u(N,1)=y; - setP.insert(N); - N++; - } - } - } - + for(int k = 0; k < nbPts; k++) setP.insert(k); + + if(nbPts > 3){ + for(int i = 0; i < nbPts - 2; i++){ + int next = i + 1; + double x1, x2, y1, y2; + x1 = u(i, 0); y1 = u(i, 1); + x2 = u(next, 0); y2 = u(next, 1); + for( int j = i + 2; j < nbPts; j++){ + int jnext = j + 1; + if(j == nbPts - 1) jnext = 0; + double x3, x4, y3, y4, x,y; + double a, b, c, d; + x3 = u(j, 0); y3 = u(j, 1); + x4 = u(jnext, 0); y4 = u(jnext, 1); + a = (y2 - y1) / (x2 - x1); + c = (y4 - y3) / (x4 - x3); + b = y1 - a * x1; + d = y3 - c * x3; + if(fabs(a - c) > 1.e-5 && x2 !=x1 && x4 != x3 && jnext != i){ + x = (d - b) / (a - c); + y = a * x + b; + bool exist= false; + for(unsigned int k = 1; k < setP.size(); k++){ + if(x == u(k, 0) && y == u(k, 1)) exist = true; + } + if(!exist){ + u(N, 0) = x; u(N, 1) = y; + setP.insert(N); + N++; + } + } + } } - //for(std::set<int>::iterator it =setP.begin(); it != setP.end(); it++) printf("setP =%d \n", *it); - int nbAll = setP.size(); - //printf("LAST DELETE LOOP nball=%d\n", nbAll); - //printf("*********************\n"); - for (int i=0; i <nbPts; i++){ - int next=i+1; - if(next==nbPts) next=0; - //printf("*** POINT i=%d next=%d\n", i, next); - //printf("-----------------------\n"); - double p1[2]={u(next,0)-u(i,0), u(next,1)-u(i,1) }; - for (int k=0; k < nbAll; k++){ - double p2[2] ={u(k,0)-u(i,0), u(k,1)-u(i,1)}; - double crossProd = p1[0]*p2[1]-p2[0]*p1[1]; + for(int i = 0; i <nbPts; i++){ + int next = i + 1; + if(next == nbPts) next = 0; + double p1[2] = {u(next, 0) - u(i, 0), u(next, 1) - u(i, 1)}; + for(int k = 0; k < nbAll; k++){ + double p2[2] = {u(k, 0) - u(i, 0), u(k, 1) - u(i, 1)}; + double crossProd = p1[0] * p2[1] - p2[0] * p1[1]; if(crossProd < eps){ - //printf("delete node k=%d, cross=%d\n", k, crossProd); setP.erase(k); } } } - - //for(std::set<int>::iterator it =setP.begin(); it != setP.end(); it++) printf("setP =%d \n", *it); - } int nbFinal = setP.size(); - if (nbFinal > 0){ + if(nbFinal > 0){ for(std::set<int>::iterator it =setP.begin(); it != setP.end(); it++){ ucg += u(*it,0); vcg += u(*it,1); @@ -174,28 +113,26 @@ static void computeCGKernelPolygon(std::map<MVertex*,SPoint3> &coordinates, std: } else{ Msg::Info("----> No Kernel for polygon: place point at CG polygon."); - - //Place at CG polygon - //-------------------- - for (std::vector<MVertex*>::iterator it = cavV.begin() ; it != cavV.end() ; ++it){ + //place at CG polygon + for(std::vector<MVertex*>::iterator it = cavV.begin() ; it != cavV.end() ; ++it){ SPoint3 vsp = coordinates[*it]; - ucg+=vsp[0]; - vcg+=vsp[1]; + ucg += vsp[0]; + vcg += vsp[1]; } - ucg/=nbPts; - vcg/=nbPts; + ucg /= nbPts; + vcg /= nbPts; } } -static void myPolygon(std::vector<MElement*> &vTri, std::vector<MVertex*> &vPoly){ - +static void myPolygon(std::vector<MElement*> &vTri, std::vector<MVertex*> &vPoly) +{ std::vector<MEdge> ePoly; - for (unsigned int i = 0; i < vTri.size() ; i++) { + for(unsigned int i = 0; i < vTri.size() ; i++) { MTriangle *t = (MTriangle*) vTri[i]; - for (int iEdge = 0; iEdge < 3; iEdge++) { + for(int iEdge = 0; iEdge < 3; iEdge++) { MEdge tmp_edge = t->getEdge(iEdge); - if (std::find(ePoly.begin(), ePoly.end(), tmp_edge) == ePoly.end()) + if(std::find(ePoly.begin(), ePoly.end(), tmp_edge) == ePoly.end()) ePoly.push_back(tmp_edge); else ePoly.erase(std::find(ePoly.begin(), ePoly.end(),tmp_edge)); @@ -203,7 +140,7 @@ static void myPolygon(std::vector<MElement*> &vTri, std::vector<MVertex*> &vPoly } // printf("epoly.size=%d vTri=%d\n", ePoly.size(), vTri.size()); -// for (std::vector<MEdge>::iterator ite = ePoly.begin(); ite != ePoly.end(); ite++){ +// for(std::vector<MEdge>::iterator ite = ePoly.begin(); ite != ePoly.end(); ite++){ // MVertex *vB = ite->getVertex(0); // MVertex *vE = ite->getVertex(1); // printf("VB=%d vE=%d \n", vB->getNum(), vE->getNum()); @@ -215,17 +152,17 @@ static void myPolygon(std::vector<MElement*> &vTri, std::vector<MVertex*> &vPoly vPoly.push_back(ite->getVertex(1)); ePoly.erase(ite); - while (!ePoly.empty()){ - ite= ePoly.begin() ; - while (ite != ePoly.end()){ + while(!ePoly.empty()){ + ite = ePoly.begin() ; + while(ite != ePoly.end()){ MVertex *vB = ite->getVertex(0); MVertex *vE = ite->getVertex(1); if( vB == vPoly.back()){ - if (vE != vINIT) vPoly.push_back(vE); + if(vE != vINIT) vPoly.push_back(vE); ePoly.erase(ite); } else if( vE == vPoly.back()){ - if (vB != vINIT) vPoly.push_back(vB); + if(vB != vINIT) vPoly.push_back(vB); ePoly.erase(ite); } else ite++; @@ -233,16 +170,16 @@ static void myPolygon(std::vector<MElement*> &vTri, std::vector<MVertex*> &vPoly } // printf("epoly.size=%d vTri=%d, cavV.size =%d\n", ePoly.size(), vTri.size(), vPoly.size()); -// for (std::vector<MVertex*>::iterator itv = vPoly.begin(); itv != vPoly.end(); itv++){ +// for(std::vector<MVertex*>::iterator itv = vPoly.begin(); itv != vPoly.end(); itv++){ // printf("VV=%d \n", (*itv)->getNum()); // } } bool GFaceCompound::trivial() const { - if (_compound.size() == 1 && - (*(_compound.begin()))->getNativeType()==GEntity::OpenCascadeModel && - (*(_compound.begin()))->geomType() != GEntity::DiscreteSurface ){ + if (_compound.size() == 1 && + (*(_compound.begin()))->getNativeType()==GEntity::OpenCascadeModel && + (*(_compound.begin()))->geomType() != GEntity::DiscreteSurface ){ return true; } return false; @@ -253,9 +190,9 @@ bool GFaceCompound::checkOrientation() const std::list<GFace*>::const_iterator it = _compound.begin(); double a_old = 0, a_new; bool oriented = true; - for ( ; it != _compound.end(); ++it){ + for( ; it != _compound.end(); ++it){ int iter = 0; - for (unsigned int i = 0; i < (*it)->triangles.size(); ++i){ + for(unsigned int i = 0; i < (*it)->triangles.size(); ++i){ MTriangle *t = (*it)->triangles[i]; SPoint3 v1 = coordinates[t->getVertex(0)]; SPoint3 v2 = coordinates[t->getVertex(1)]; @@ -264,8 +201,8 @@ bool GFaceCompound::checkOrientation() const double p2[2] = {v2[0],v2[1]}; double p3[2] = {v3[0],v3[1]}; a_new = gmsh::orient2d(p1, p2, p3); - if (iter == 0) a_old=a_new; - if (a_new*a_old < 0.){ + if(iter == 0) a_old=a_new; + if(a_new*a_old < 0.){ oriented = false; break; } @@ -290,13 +227,13 @@ bool GFaceCompound::checkOrientation() const } -bool GFaceCompound::checkCavity(std::vector<MElement*> &vTri) const{ - +bool GFaceCompound::checkCavity(std::vector<MElement*> &vTri) const +{ bool badCavity = false; unsigned int nbV = vTri.size(); double a_old = 0, a_new; - for (unsigned int i = 0; i < nbV; ++i){ + for(unsigned int i = 0; i < nbV; ++i){ MTriangle *t = (MTriangle*) vTri[i]; SPoint3 v1 = coordinates[t->getVertex(0)]; SPoint3 v2 = coordinates[t->getVertex(1)]; @@ -305,52 +242,53 @@ bool GFaceCompound::checkCavity(std::vector<MElement*> &vTri) const{ double p2[2] = {v2[0],v2[1]}; double p3[2] = {v3[0],v3[1]}; //printf("p1=(%g %g) p2=(%g %g) p3=(%g %g)\n",v1[0],v1[1], v2[0],v2[1], v3[0],v3[1] ); - a_new = gmsh::orient2d(p1, p2, p3); - if (i == 0) a_old=a_new; - if (a_new*a_old < 0.) badCavity = true; - a_old = a_new; - } - - return badCavity; - + a_new = gmsh::orient2d(p1, p2, p3); + if(i == 0) a_old=a_new; + if(a_new*a_old < 0.) badCavity = true; + a_old = a_new; + } + + return badCavity; } -void GFaceCompound::one2OneMap() const{ - - if (!mapv2Tri){ +void GFaceCompound::one2OneMap() const +{ + if(!mapv2Tri){ std::vector<MTriangle*> allTri; std::list<GFace*>::const_iterator it = _compound.begin(); - for ( ; it != _compound.end(); ++it){ + for( ; it != _compound.end(); ++it){ allTri.insert(allTri.end(), (*it)->triangles.begin(), (*it)->triangles.end() ); } buildVertexToTriangle(allTri, adjv); mapv2Tri=true; } - - for (v2t_cont::iterator it = adjv.begin(); it!= adjv.end(); ++it){ - MVertex *v = it->first; - std::map<MVertex*,SPoint3>::iterator itV = coordinates.find(v); - - std::vector<MVertex*> cavV; - std::vector<MElement*> vTri = it->second; - bool badCavity = checkCavity(vTri); - if(badCavity){ - Msg::Info("Wrong cavity around vertex %d (onwhat=%d).", v->getNum(), v->onWhat()->dim()); - Msg::Info("--> Place vertex at center of gravity of %d-Polygon kernel." , vTri.size()); - - double u_cg, v_cg; - myPolygon(vTri, cavV); - computeCGKernelPolygon(coordinates, cavV, u_cg, v_cg); - SPoint3 p_cg(u_cg,v_cg,0); - coordinates[v] = p_cg; - + for(v2t_cont::iterator it = adjv.begin(); it!= adjv.end(); ++it){ + MVertex *v = it->first; + std::map<MVertex*,SPoint3>::iterator itV = coordinates.find(v); + + std::vector<MVertex*> cavV; + std::vector<MElement*> vTri = it->second; + bool badCavity = checkCavity(vTri); + + if(badCavity){ + Msg::Info("Wrong cavity around vertex %d (onwhat=%d).", + v->getNum(), v->onWhat()->dim()); + Msg::Info("--> Place vertex at center of gravity of %d-Polygon kernel." , + vTri.size()); + + double u_cg, v_cg; + myPolygon(vTri, cavV); + computeCGKernelPolygon(coordinates, cavV, u_cg, v_cg); + SPoint3 p_cg(u_cg,v_cg,0); + coordinates[v] = p_cg; + // printf("Kernel CG: ucg=%g vcg=%g \n", u_cg, v_cg); // bool testbadCavity = checkCavity(vTri); -// if (testbadCavity == true ) printf("**** New cavity is KO \n"); +// if(testbadCavity == true ) printf("**** New cavity is KO \n"); // else printf("-- New cavity is OK \n"); -// for (int i=0; i< vTri.size(); i++){ +// for(int i=0; i< vTri.size(); i++){ // MTriangle *t = (MTriangle*) vTri[i]; // SPoint3 v1 = coordinates[t->getVertex(0)]; // SPoint3 v2 = coordinates[t->getVertex(1)]; @@ -372,24 +310,20 @@ void GFaceCompound::one2OneMap() const{ // e2->getNum()+e3->getNum() , e3->getNum()+e1->getNum() ); // printf("//Area=%g \n", a_new); // } - - } - } - + + } + } } void GFaceCompound::parametrize() const { - if (trivial())return; + if(trivial()) return; - if (!oct){ + if(!oct){ coordinates.clear(); - parametrize(ITERU); parametrize(ITERV); - // checkOrientation(); - computeNormals(); buildOct(); } @@ -398,76 +332,76 @@ void GFaceCompound::parametrize() const void GFaceCompound::getBoundingEdges() { - for (std::list<GFace*>::iterator it = _compound.begin(); it != _compound.end(); ++it){ + for(std::list<GFace*>::iterator it = _compound.begin(); it != _compound.end(); ++it){ (*it)->setCompound(this); - } - + } + //in case the bounding edges are explicitely given - if (_U0.size()){ + if(_U0.size()){ std::list<GEdge*> :: const_iterator it = _U0.begin(); - for ( ; it != _U0.end() ; ++it){ + for( ; it != _U0.end() ; ++it){ l_edges.push_back(*it); (*it)->addFace(this); } it = _V0.begin(); - for ( ; it != _V0.end() ; ++it){ + for( ; it != _V0.end() ; ++it){ l_edges.push_back(*it); (*it)->addFace(this); } return; } - + std::set<GEdge*> _unique; - getUniqueEdges (_unique); + getUniqueEdges(_unique); std::set<GEdge*>::iterator itf = _unique.begin(); - for ( ; itf != _unique.end(); ++itf){ + for( ; itf != _unique.end(); ++itf){ l_edges.push_back(*itf); (*itf)->addFace(this); } // printf("%d in unique\n",_unique.size()); - computeALoop (_unique,_U0); + computeALoop(_unique,_U0); // printf("%d in unique\n",_unique.size()); while(!_unique.empty()){ - computeALoop (_unique,_U1); + computeALoop(_unique,_U1); // printf("%d in unique\n",_unique.size()); _interior_loops.push_back(_U1); } } -void GFaceCompound::getUniqueEdges(std::set<GEdge*> & _unique) +void GFaceCompound::getUniqueEdges(std::set<GEdge*> &_unique) { _unique.clear(); // in case the bounding edges are not given Boundary { {} }; std::multiset<GEdge*> _touched; std::list<GFace*>::iterator it = _compound.begin(); - for ( ; it != _compound.end(); ++it){ + for( ; it != _compound.end(); ++it){ std::list<GEdge*> ed = (*it)->edges(); std::list<GEdge*> :: iterator ite = ed.begin(); - for ( ; ite != ed.end(); ++ite){ + for( ; ite != ed.end(); ++ite){ _touched.insert(*ite); } } it = _compound.begin(); - for ( ; it != _compound.end(); ++it){ + for( ; it != _compound.end(); ++it){ std::list<GEdge*> ed = (*it)->edges(); std::list<GEdge*> :: iterator ite = ed.begin(); - for ( ; ite != ed.end() ; ++ite){ - if (!(*ite)->degenerate(0) && _touched.count(*ite) == 1) { + for( ; ite != ed.end() ; ++ite){ + if(!(*ite)->degenerate(0) && _touched.count(*ite) == 1) { _unique.insert(*ite); } } } std::set<GEdge*>::iterator itf = _unique.begin(); - for ( ; itf != _unique.end(); ++itf){ + for( ; itf != _unique.end(); ++itf){ l_edges.push_back(*itf); (*itf)->addFace(this); } } -void GFaceCompound::computeALoop(std::set<GEdge*> & _unique, std::list<GEdge*> & loop) +void GFaceCompound::computeALoop(std::set<GEdge*> &_unique, std::list<GEdge*> &loop) { std::list<GEdge*> _loop; - while (!_unique.empty()) { + while(!_unique.empty()) { std::set<GEdge*>::iterator it = _unique.begin(); GVertex *vB = (*it)->getBeginVertex(); GVertex *vE = (*it)->getEndVertex(); @@ -476,13 +410,14 @@ void GFaceCompound::computeALoop(std::set<GEdge*> & _unique, std::list<GEdge*> & it++; bool found = false; - for (int i=0; i<2; i++) { - for (std::set<GEdge*>::iterator itx = _unique.begin() ; itx != _unique.end(); ++itx){ + for(int i = 0; i < 2; i++) { + for(std::set<GEdge*>::iterator itx = _unique.begin(); + itx != _unique.end(); ++itx){ GVertex *v1 = (*itx)->getBeginVertex(); GVertex *v2 = (*itx)->getEndVertex(); std::set<GEdge*>::iterator itp; - if ( v1 == vE ){ + if(v1 == vE){ _loop.push_back(*itx); itp = itx; itx++; @@ -490,7 +425,7 @@ void GFaceCompound::computeALoop(std::set<GEdge*> & _unique, std::list<GEdge*> & vE = v2; i = -1; } - else if ( v2 == vE){ + else if(v2 == vE){ _loop.push_back(*itx); itp = itx; itx++; @@ -498,22 +433,22 @@ void GFaceCompound::computeALoop(std::set<GEdge*> & _unique, std::list<GEdge*> & vE = v1; i=-1; } - if (itx == _unique.end()) break; + if(itx == _unique.end()) break; } - if (vB == vE) { + if(vB == vE) { found = true; break; } - if (_unique.empty()) break; + if(_unique.empty()) break; GVertex *temp = vB; vB = vE; vE = temp; } - if (found == true) break; + if(found == true) break; } loop = _loop; @@ -525,20 +460,19 @@ GFaceCompound::GFaceCompound(GModel *m, int tag, std::list<GFace*> &compound, : GFace(m, tag), _compound(compound), _U0(U0), _U1(U1), _V0(V0), _V1(V1), oct(0) { - for (std::list<GFace*>::iterator it = _compound.begin(); it != _compound.end(); ++it){ - if (!(*it)){ + for(std::list<GFace*>::iterator it = _compound.begin(); it != _compound.end(); ++it){ + if(!(*it)){ Msg::Error("Incorrect face in compound surface %d\n", tag); Msg::Exit(1); } } getBoundingEdges(); - if (!_U0.size()) _type = UNITCIRCLE; - else if (!_V1.size()) _type = UNITCIRCLE; + if(!_U0.size()) _type = UNITCIRCLE; + else if(!_V1.size()) _type = UNITCIRCLE; else _type = SQUARE; mapv2Tri = false; - } GFaceCompound::~GFaceCompound() @@ -549,8 +483,6 @@ GFaceCompound::~GFaceCompound() } } - - static bool orderVertices(const std::list<GEdge*> &e, std::vector<MVertex*> &l, std::vector<double> &coord) { @@ -562,8 +494,8 @@ static bool orderVertices(const std::list<GEdge*> &e, std::vector<MVertex*> &l, std::list<GEdge*>::const_iterator it = e.begin(); std::list<MLine*> temp; double tot_length = 0; - for ( ; it != e.end(); ++it ){ - for (unsigned int i = 0; i < (*it)->lines.size(); i++ ){ + for( ; it != e.end(); ++it ){ + for(unsigned int i = 0; i < (*it)->lines.size(); i++ ){ temp.push_back((*it)->lines[i]); MVertex *v0 = (*it)->lines[i]->getVertex(0); MVertex *v1 = (*it)->lines[i]->getVertex(1); @@ -581,13 +513,13 @@ static bool orderVertices(const std::list<GEdge*> &e, std::vector<MVertex*> &l, coord.push_back(0.0); temp.erase(temp.begin()); - while (temp.size()){ + while(temp.size()){ bool found = false; - for (std::list<MLine*>::iterator itl = temp.begin(); itl != temp.end(); ++itl){ + for(std::list<MLine*>::iterator itl = temp.begin(); itl != temp.end(); ++itl){ MLine *ll = *itl; MVertex *v0 = ll->getVertex(0); MVertex *v1 = ll->getVertex(1); - if (v0 == current_v){ + if(v0 == current_v){ found = true; l.push_back(current_v); current_v = v1; @@ -598,7 +530,7 @@ static bool orderVertices(const std::list<GEdge*> &e, std::vector<MVertex*> &l, coord.push_back(coord[coord.size()-1] + length / tot_length); break; } - else if (v1 == current_v){ + else if(v1 == current_v){ found = true; l.push_back(current_v); current_v = v0; @@ -617,7 +549,7 @@ static bool orderVertices(const std::list<GEdge*> &e, std::vector<MVertex*> &l, SPoint2 GFaceCompound::getCoordinates(MVertex *v) const { - if (trivial()){ + if(trivial()){ SPoint2 param; reparamMeshVertexOnFace(v, (*(_compound.begin())),param); return param; @@ -643,7 +575,7 @@ SPoint2 GFaceCompound::getCoordinates(MVertex *v) const GEdgeCompound *gec = dynamic_cast<GEdgeCompound*>(v->onWhat()); //printf("tag compound=%d, beginvertex=%d, endvertex=%d \n", gec->tag(), gec->getBeginVertex()->tag(), gec->getEndVertex()->tag()); - if (gec){ + if(gec){ //compute local parameter on Edge gec->getLocalParameter(tGlob,iEdge,tLoc); @@ -667,18 +599,18 @@ SPoint2 GFaceCompound::getCoordinates(MVertex *v) const int j = 0; tL=tB; bool found = false; - while (j < (int)ge->mesh_vertices.size()){ + while(j < (int)ge->mesh_vertices.size()){ vR = ge->mesh_vertices[j]; vR->getParameter(0,tR); - if (!vR->getParameter(0,tR)) { + if(!vR->getParameter(0,tR)) { Msg::Error("vertex vr %p not medgevertex \n", vR); Msg::Exit(1); } //printf("***tLoc=%g tL=%g, tR=%g L=%p (%g,%g,%g) et R= %p (%g,%g,%g)\n", tLoc, tL, tR, vL, vL->x(),vL->y(),vL->z(),vR, vR->x(), vR->y(), vR->z()); - if (tLoc >= tL && tLoc <= tR){ + if(tLoc >= tL && tLoc <= tR){ found = true; itR = coordinates.find(vR); - if (itR == coordinates.end()){ + if(itR == coordinates.end()){ Msg::Error("vertex %p (%g %g %g) not found\n", vR, vR->x(), vR->y(), vR->z()); Msg::Exit(1); } @@ -692,7 +624,7 @@ SPoint2 GFaceCompound::getCoordinates(MVertex *v) const j++; //printf("in while j =%d, vL (%g,%g,%g), -> uv= (%g,%g)\n",j, vL->x(), vL->y(), vL->z(), itL->second.x(), itL->second.y()); } - if (!found) { + if(!found) { vR = v1; tR = tE; } @@ -730,50 +662,50 @@ void GFaceCompound::parametrize(iterationStep step) const gmshFunction<double> ONE(1.0); - if (_type == UNITCIRCLE){ + if(_type == UNITCIRCLE){ // maps the boundary onto a circle std::vector<MVertex*> ordered; std::vector<double> coords; bool success = orderVertices(_U0, ordered, coords); - if (!success){ + if(!success){ Msg::Error("Could not order vertices on boundary"); return; } - for (unsigned int i = 0; i < ordered.size(); i++){ + for(unsigned int i = 0; i < ordered.size(); i++){ MVertex *v = ordered[i]; const double theta = 2 * M_PI * coords[i]; - if (step == ITERU) myAssembler.fixVertex(v, 0, 1, cos(theta)); - else if (step == ITERV) myAssembler.fixVertex(v, 0, 1, sin(theta)); + if(step == ITERU) myAssembler.fixVertex(v, 0, 1, cos(theta)); + else if(step == ITERV) myAssembler.fixVertex(v, 0, 1, sin(theta)); } } - else if (_type == SQUARE){ - if (step == ITERU){ + else if(_type == SQUARE){ + if(step == ITERU){ std::list<GEdge*> :: const_iterator it = _U0.begin(); - for ( ; it != _U0.end(); ++it){ + for( ; it != _U0.end(); ++it){ fixEdgeToValue(*it, 0.0, myAssembler); } it = _U1.begin(); - for ( ; it != _U1.end(); ++it){ + for( ; it != _U1.end(); ++it){ fixEdgeToValue(*it, 1.0, myAssembler); } } - else if (step == ITERV){ + else if(step == ITERV){ std::list<GEdge*> :: const_iterator it = _V0.begin(); - for ( ; it != _V0.end(); ++it){ - fixEdgeToValue (*it, 0.0, myAssembler); + for( ; it != _V0.end(); ++it){ + fixEdgeToValue(*it, 0.0, myAssembler); } it = _V1.begin(); - for ( ; it != _V1.end(); ++it){ - fixEdgeToValue (*it, 1.0, myAssembler); + for( ; it != _V1.end(); ++it){ + fixEdgeToValue(*it, 1.0, myAssembler); } } } else throw; std::list<GFace*>::const_iterator it = _compound.begin(); - for ( ; it != _compound.end(); ++it){ - for (unsigned int i = 0; i < (*it)->triangles.size(); ++i){ + for( ; it != _compound.end(); ++it){ + for(unsigned int i = 0; i < (*it)->triangles.size(); ++i){ MTriangle *t = (*it)->triangles[i]; myAssembler.numberVertex(t->getVertex(0), 0, 1); myAssembler.numberVertex(t->getVertex(1), 0, 1); @@ -787,8 +719,8 @@ void GFaceCompound::parametrize(iterationStep step) const //gmshConvexCombinationTerm laplace(model(), &ONE, 1); gmshLaplaceTerm laplace(model(), &ONE, 1); it = _compound.begin(); - for ( ; it != _compound.end() ; ++it){ - for (unsigned int i = 0; i < (*it)->triangles.size(); ++i){ + for( ; it != _compound.end() ; ++it){ + for(unsigned int i = 0; i < (*it)->triangles.size(); ++i){ MTriangle *t = (*it)->triangles[i]; laplace.addToMatrix(myAssembler, t); } @@ -801,20 +733,20 @@ void GFaceCompound::parametrize(iterationStep step) const it = _compound.begin(); std::set<MVertex *>allNodes; - for ( ; it != _compound.end() ; ++it){ - for (unsigned int i = 0; i < (*it)->triangles.size(); ++i){ + for( ; it != _compound.end() ; ++it){ + for(unsigned int i = 0; i < (*it)->triangles.size(); ++i){ MTriangle *t = (*it)->triangles[i]; - for (int j = 0; j < 3; j++){ + for(int j = 0; j < 3; j++){ allNodes.insert(t->getVertex(j)); } } } - for (std::set<MVertex *>::iterator itv = allNodes.begin(); itv !=allNodes.end() ; ++itv){ + for(std::set<MVertex *>::iterator itv = allNodes.begin(); itv !=allNodes.end() ; ++itv){ MVertex *v = *itv; double value = myAssembler.getDofValue(v,0,1); std::map<MVertex*,SPoint3>::iterator itf = coordinates.find(v); - if (itf == coordinates.end()){ + if(itf == coordinates.end()){ SPoint3 p(0,0,0); p[step] = value; coordinates[v] = p; @@ -822,15 +754,13 @@ void GFaceCompound::parametrize(iterationStep step) const else{ itf->second[step]= value; } - - + } } - void GFaceCompound::parametrize_conformal() const { - if (oct) return; + if(oct) return; Msg::Info("Parametrizing Surface %d", tag()); @@ -847,12 +777,12 @@ void GFaceCompound::parametrize_conformal() const std::vector<MVertex*> ordered; std::vector<double> coords; bool success = orderVertices(_U0, ordered, coords); - if (!success){ + if(!success){ Msg::Error("Could not order vertices on boundary"); return; } - for (unsigned int i = 0; i < ordered.size(); i++){ + for(unsigned int i = 0; i < ordered.size(); i++){ MVertex *v = ordered[i]; // printf("coucou\n"); const double theta = 2 * M_PI * coords[i]; @@ -868,8 +798,8 @@ void GFaceCompound::parametrize_conformal() const } std::list<GFace*>::const_iterator it = _compound.begin(); - for ( ; it != _compound.end(); ++it){ - for (unsigned int i = 0; i < (*it)->triangles.size(); ++i){ + for( ; it != _compound.end(); ++it){ + for(unsigned int i = 0; i < (*it)->triangles.size(); ++i){ MTriangle *t = (*it)->triangles[i]; myAssembler.numberVertex(t->getVertex(0), 0, 1); myAssembler.numberVertex(t->getVertex(1), 0, 1); @@ -883,7 +813,7 @@ void GFaceCompound::parametrize_conformal() const #if 0 Msg::Debug("Creating term %d dofs numbered %d fixed", myAssembler.sizeOfR(), myAssembler.sizeOfF()); - for (unsigned int i = 0; i < ordered.size(); i++){ + for(unsigned int i = 0; i < ordered.size(); i++){ MVertex *v1 = ordered[i]; MVertex *v2 = ordered[(i+1)%ordered.size()]; myAssembler.assemble(v1,0,2,v1,0,1, 0.5); @@ -896,14 +826,14 @@ void GFaceCompound::parametrize_conformal() const myAssembler.assemble(v2,0,1,v2,0,2,-0.5); } // internal BC's - for ( std::list<std::list<GEdge*> >::const_iterator itc = _interior_loops.begin(); - itc != _interior_loops.end() ; ++itc){ + for(std::list<std::list<GEdge*> >::const_iterator itc = _interior_loops.begin(); + itc != _interior_loops.end(); ++itc){ success = orderVertices(*itc, ordered, coords); - if (!success){ + if(!success){ Msg::Error("Could not order vertices on boundary"); return; } - for (unsigned int i = 0; i < ordered.size(); i++){ + for(unsigned int i = 0; i < ordered.size(); i++){ MVertex *v1 = ordered[i]; MVertex *v2 = ordered[(i+1)%ordered.size()]; myAssembler.assemble(v1,0,2,v1,0,1, 0.5); @@ -922,13 +852,13 @@ void GFaceCompound::parametrize_conformal() const gmshFunction<double> ONE(1.0); gmshFunction<double> P5( .5); gmshFunction<double> M5(-0.5); - gmshLaplaceTerm laplace1 (model(), &ONE, 1); - gmshLaplaceTerm laplace2 (model(), &ONE, 2); + gmshLaplaceTerm laplace1(model(), &ONE, 1); + gmshLaplaceTerm laplace2(model(), &ONE, 2); gmshLaplaceTerm laplace12(model(), &M5, 1 , 2); gmshLaplaceTerm laplace21(model(), &P5, 2 , 1); it = _compound.begin(); - for ( ; it != _compound.end() ; ++it){ - for (unsigned int i = 0; i < (*it)->triangles.size(); ++i){ + for( ; it != _compound.end() ; ++it){ + for(unsigned int i = 0; i < (*it)->triangles.size(); ++i){ MTriangle *t = (*it)->triangles[i]; laplace1.addToMatrix(myAssembler, t); laplace2.addToMatrix(myAssembler, t); @@ -941,19 +871,18 @@ void GFaceCompound::parametrize_conformal() const lsys.systemSolve(); Msg::Debug("System solved"); - it = _compound.begin(); std::set<MVertex *>allNodes; - for ( ; it != _compound.end() ; ++it){ - for (unsigned int i = 0; i < (*it)->triangles.size(); ++i){ + for( ; it != _compound.end() ; ++it){ + for(unsigned int i = 0; i < (*it)->triangles.size(); ++i){ MTriangle *t = (*it)->triangles[i]; - for (int j = 0; j < 3; j++){ + for(int j = 0; j < 3; j++){ allNodes.insert(t->getVertex(j)); } } } - for (std::set<MVertex *>::iterator itv = allNodes.begin(); itv !=allNodes.end() ; ++itv){ + for(std::set<MVertex *>::iterator itv = allNodes.begin(); itv !=allNodes.end() ; ++itv){ MVertex *v = *itv; double value1 = myAssembler.getDofValue(v,0,1); double value2 = myAssembler.getDofValue(v,0,2); @@ -964,25 +893,21 @@ void GFaceCompound::parametrize_conformal() const computeNormals(); buildOct(); - } - - -void GFaceCompound::computeNormals (std::map<MVertex*,SVector3> &normals) const +void GFaceCompound::computeNormals(std::map<MVertex*,SVector3> &normals) const { - computeNormals (); normals = _normals; - } -void GFaceCompound::computeNormals () const + +void GFaceCompound::computeNormals() const { _normals.clear(); std::list<GFace*>::const_iterator it = _compound.begin(); double J[3][3]; - for ( ; it != _compound.end() ; ++it){ - for (unsigned int i = 0; i < (*it)->triangles.size(); ++i){ + for( ; it != _compound.end() ; ++it){ + for(unsigned int i = 0; i < (*it)->triangles.size(); ++i){ MTriangle *t = (*it)->triangles[i]; t->getJacobian(0, 0, 0, J); // SVector3 n (J[2][0],J[2][1],J[2][2]); @@ -990,32 +915,31 @@ void GFaceCompound::computeNormals () const SVector3 d2(J[1][0], J[1][1], J[1][2]); SVector3 n = crossprod(d1, d2); n.normalize(); - for (int j = 0; j < 3; j++){ + for(int j = 0; j < 3; j++){ std::map<MVertex*, SVector3>::iterator itn = _normals.find(t->getVertex(j)); - if (itn == _normals.end())_normals[t->getVertex(j)] = n; + if(itn == _normals.end())_normals[t->getVertex(j)] = n; else itn->second += n; } } } std::map<MVertex*,SVector3>::iterator itn = _normals.begin(); - for ( ; itn != _normals.end() ; ++itn) itn->second.normalize(); + for( ; itn != _normals.end() ; ++itn) itn->second.normalize(); } double GFaceCompound::curvatureMax(const SPoint2 ¶m) const { - if (trivial()){ + if(trivial()){ return (*(_compound.begin()))->curvatureMax(param); } parametrize(); - double U,V; + double U, V; GFaceCompoundTriangle *lt; - getTriangle (param.x(),param.y(), <, U,V); - if (!lt){ - // printf("oops\n"); + getTriangle(param.x(), param.y(), <, U,V); + if(!lt){ return 0.0; } - if (lt->gf && lt->gf->geomType() != GEntity::DiscreteSurface){ + if(lt->gf && lt->gf->geomType() != GEntity::DiscreteSurface){ SPoint2 pv = lt->gfp1*(1.-U-V) + lt->gfp2*U + lt->gfp3*V; return lt->gf->curvatureMax(pv); } @@ -1024,20 +948,19 @@ double GFaceCompound::curvatureMax(const SPoint2 ¶m) const double GFaceCompound::curvature(MTriangle *t, double u, double v) const { - SVector3 n1 = _normals[t->getVertex(0)]; SVector3 n2 = _normals[t->getVertex(1)]; SVector3 n3 = _normals[t->getVertex(2)]; - double val[9] = {n1.x(),n2.x(),n3.x(), - n1.y(),n2.y(),n3.y(), - n1.z(),n2.z(),n3.z()}; - return fabs(t->interpolateDiv (val,u,v,0.0)); + double val[9] = {n1.x(), n2.x(), n3.x(), + n1.y(), n2.y(), n3.y(), + n1.z(), n2.z(), n3.z()}; + return fabs(t->interpolateDiv(val, u, v, 0.0)); return 0.; } GPoint GFaceCompound::point(double par1, double par2) const { - if (trivial()){ + if(trivial()){ return (*(_compound.begin()))->point(par1,par2); } @@ -1047,19 +970,19 @@ GPoint GFaceCompound::point(double par1, double par2) const GFaceCompoundTriangle *lt; getTriangle (par1, par2, <, U,V); SPoint3 p(3, 3, 0); - if (!lt){ + if(!lt){ GPoint gp (p.x(),p.y(),p.z(),this); gp.setNoSuccess(); return gp; } - if (lt->gf && lt->gf->geomType() != GEntity::DiscreteSurface){ + if(lt->gf && lt->gf->geomType() != GEntity::DiscreteSurface){ SPoint2 pv = lt->gfp1*(1.-U-V) + lt->gfp2*U + lt->gfp3*V; return lt->gf->point(pv.x(),pv.y()); } const bool LINEARMESH = false; - if (LINEARMESH){ + if(LINEARMESH){ //linear Lagrange mesh //------------------------- @@ -1112,15 +1035,15 @@ GPoint GFaceCompound::point(double par1, double par2) const Pair<SVector3,SVector3> GFaceCompound::firstDer(const SPoint2 ¶m) const { - if (trivial()){ + if(trivial()){ return (*(_compound.begin()))->firstDer(param); } parametrize(); - double U,V; + double U, V; GFaceCompoundTriangle *lt; - getTriangle (param.x(), param.y(), <, U,V); - if (!lt) + getTriangle(param.x(), param.y(), <, U,V); + if(!lt) return Pair<SVector3, SVector3>(SVector3(1, 0, 0), SVector3(0, 1, 0)); double mat[2][2] = {{lt->p2.x() - lt->p1.x(), lt->p3.x() - lt->p1.x()}, @@ -1128,11 +1051,11 @@ Pair<SVector3,SVector3> GFaceCompound::firstDer(const SPoint2 ¶m) const double inv[2][2]; inv2x2(mat,inv); - SVector3 dXdxi (lt->v2 - lt->v1); - SVector3 dXdeta (lt->v3 - lt->v1); + SVector3 dXdxi(lt->v2 - lt->v1); + SVector3 dXdeta(lt->v3 - lt->v1); - SVector3 dXdu (dXdxi*inv[0][0]+dXdeta*inv[1][0]); - SVector3 dXdv (dXdxi*inv[0][1]+dXdeta*inv[1][1]); + SVector3 dXdu(dXdxi * inv[0][0] + dXdeta * inv[1][0]); + SVector3 dXdv(dXdxi * inv[0][1] + dXdeta * inv[1][1]); return Pair<SVector3, SVector3>(dXdu,dXdv); } @@ -1185,7 +1108,7 @@ static int GFaceCompoundInEle(void *a, double*c) R[0] = (c[0] - p0.x()); R[1] = (c[1] - p0.y()); sys2x2(M,R,X); - if (X[0] > -eps && X[1] > -eps && 1. - X[0] - X[1] > -eps){ + if(X[0] > -eps && X[1] > -eps && 1. - X[0] - X[1] > -eps){ return 1; } return 0; @@ -1199,15 +1122,15 @@ void GFaceCompound::getTriangle(double u, double v, double uv[3] = {u, v, 0}; *lt = (GFaceCompoundTriangle*)Octree_Search(uv, oct); - // if (!(*lt)) { -// for (int i=0;i<nbT;i++){ -// if (GFaceCompoundInEle (&_gfct[i],uv)){ + // if(!(*lt)) { +// for(int i=0;i<nbT;i++){ +// if(GFaceCompoundInEle (&_gfct[i],uv)){ // *lt = &_gfct[i]; // break; // } // } // } - if (!(*lt)){ + if(!(*lt)){ return; } @@ -1226,8 +1149,6 @@ void GFaceCompound::getTriangle(double u, double v, _v = X[1]; } - - void GFaceCompound::buildOct() const { // printStuff(); @@ -1236,10 +1157,10 @@ void GFaceCompound::buildOct() const int count = 0; std::list<GFace*> :: const_iterator it = _compound.begin(); - for ( ; it != _compound.end() ; ++it){ - for (unsigned int i = 0; i < (*it)->triangles.size(); ++i){ + for( ; it != _compound.end() ; ++it){ + for(unsigned int i = 0; i < (*it)->triangles.size(); ++i){ MTriangle *t = (*it)->triangles[i]; - for (int j=0;j<3;j++){ + for(int j = 0; j < 3; j++){ std::map<MVertex*,SPoint3>::const_iterator itj = coordinates.find(t->getVertex(j)); bb += SPoint3(itj->second.x(),itj->second.y(),0.0); @@ -1253,14 +1174,14 @@ void GFaceCompound::buildOct() const bb.max().y() - bb.min().y(), bb.max().z() - bb.min().z()}; const int maxElePerBucket = 11; - oct = Octree_Create(maxElePerBucket, origin, ssize, GFaceCompoundBB, GFaceCompoundCentroid, - GFaceCompoundInEle); + oct = Octree_Create(maxElePerBucket, origin, ssize, GFaceCompoundBB, + GFaceCompoundCentroid, GFaceCompoundInEle); it = _compound.begin(); count = 0; - for ( ; it != _compound.end() ; ++it){ - for (unsigned int i = 0; i < (*it)->triangles.size(); ++i){ + for( ; it != _compound.end() ; ++it){ + for(unsigned int i = 0; i < (*it)->triangles.size(); ++i){ MTriangle *t = (*it)->triangles[i]; std::map<MVertex*,SPoint3>::const_iterator it0 = coordinates.find(t->getVertex(0)); @@ -1271,14 +1192,17 @@ void GFaceCompound::buildOct() const _gfct[count].p1 = it0->second; _gfct[count].p2 = it1->second; _gfct[count].p3 = it2->second; - if ((*it)->geomType() != GEntity::DiscreteSurface){ + if((*it)->geomType() != GEntity::DiscreteSurface){ reparamMeshVertexOnFace(t->getVertex(0), *it, _gfct[count].gfp1); reparamMeshVertexOnFace(t->getVertex(1), *it, _gfct[count].gfp2); reparamMeshVertexOnFace(t->getVertex(2), *it, _gfct[count].gfp3); } - _gfct[count].v1 = SPoint3(t->getVertex(0)->x(),t->getVertex(0)->y(),t->getVertex(0)->z()); - _gfct[count].v2 = SPoint3(t->getVertex(1)->x(),t->getVertex(1)->y(),t->getVertex(1)->z()); - _gfct[count].v3 = SPoint3(t->getVertex(2)->x(),t->getVertex(2)->y(),t->getVertex(2)->z()); + _gfct[count].v1 = SPoint3(t->getVertex(0)->x(), t->getVertex(0)->y(), + t->getVertex(0)->z()); + _gfct[count].v2 = SPoint3(t->getVertex(1)->x(), t->getVertex(1)->y(), + t->getVertex(1)->z()); + _gfct[count].v3 = SPoint3(t->getVertex(2)->x(), t->getVertex(2)->y(), + t->getVertex(2)->z()); _gfct[count].gf = *it; _gfct[count].tri = t; Octree_Insert(&_gfct[count], oct); @@ -1289,18 +1213,18 @@ void GFaceCompound::buildOct() const Octree_Arrange(oct); } -int GFaceCompound::genusGeom () +int GFaceCompound::genusGeom() { std::list<GFace*> :: const_iterator it = _compound.begin(); std::set<MEdge, Less_Edge> es; std::set<MVertex*> vs; int N = 0; - for ( ; it != _compound.end() ; ++it){ - for (unsigned int i = 0; i < (*it)->triangles.size(); ++i){ + for( ; it != _compound.end() ; ++it){ + for(unsigned int i = 0; i < (*it)->triangles.size(); ++i){ N++; MTriangle *e = (*it)->triangles[i]; - for (int j=0;j<e->getNumVertices();j++)vs.insert(e->getVertex(j)); - for (int j=0;j<e->getNumEdges();j++)es.insert(e->getEdge(j)); + for(int j = 0; j < e->getNumVertices(); j++) vs.insert(e->getVertex(j)); + for(int j = 0; j < e->getNumEdges(); j++) es.insert(e->getEdge(j)); } } int poincare = vs.size() - es.size() + N;// = 2g + 2 - b @@ -1308,7 +1232,6 @@ int GFaceCompound::genusGeom () return (poincare - 2 + edgeLoops.size())/2; } - void GFaceCompound::printStuff() const { std::list<GFace*> :: const_iterator it = _compound.begin(); @@ -1343,8 +1266,8 @@ void GFaceCompound::printStuff() const fprintf(xyzv,"View \"\"{\n"); fprintf(xyzc,"View \"\"{\n"); - for ( ; it != _compound.end() ; ++it){ - for (unsigned int i = 0; i < (*it)->triangles.size(); ++i){ + for( ; it != _compound.end() ; ++it){ + for(unsigned int i = 0; i < (*it)->triangles.size(); ++i){ MTriangle *t = (*it)->triangles[i]; std::map<MVertex*,SPoint3>::const_iterator it0 = coordinates.find(t->getVertex(0)); @@ -1410,5 +1333,3 @@ void GFaceCompound::printStuff() const fprintf(xyzc,"};\n"); fclose(xyzc); } - - diff --git a/Geo/GFaceCompound.h b/Geo/GFaceCompound.h index 88db962743..e7c58505e5 100644 --- a/Geo/GFaceCompound.h +++ b/Geo/GFaceCompound.h @@ -31,22 +31,21 @@ generator of gmsh! */ class GFaceCompoundTriangle { -public: + public: SPoint3 p1, p2, p3; SPoint2 gfp1, gfp2, gfp3; SPoint3 v1, v2, v3; GFace *gf; MTriangle *tri; - GFaceCompoundTriangle () : gf(0), tri(0) - {} -} ; + GFaceCompoundTriangle() : gf(0), tri(0) {} +}; class Octree; class GFaceCompound : public GFace { public: typedef enum {ITERU=0,ITERV=1,ITERD=2} iterationStep; - void computeNormals (std::map<MVertex*,SVector3> &normals) const; + void computeNormals(std::map<MVertex*, SVector3> &normals) const; protected: std::list<GFace*> _compound; std::list<GEdge*> _U0, _U1, _V0, _V1; @@ -56,8 +55,8 @@ class GFaceCompound : public GFace { mutable Octree *oct; mutable v2t_cont adjv; mutable bool mapv2Tri; - mutable std::map<MVertex*,SPoint3> coordinates; - mutable std::map<MVertex*,SVector3> _normals; + mutable std::map<MVertex*, SPoint3> coordinates; + mutable std::map<MVertex*, SVector3> _normals; void buildOct() const ; void parametrize() const ; void parametrize_conformal() const ; @@ -74,8 +73,7 @@ class GFaceCompound : public GFace { virtual double curvature(MTriangle *t, double u, double v) const; void printStuff() const; bool trivial() const ; - -public: + public: typedef enum {UNITCIRCLE, SQUARE} typeOfIsomorphism; GFaceCompound(GModel *m, int tag, std::list<GFace*> &compound, @@ -84,7 +82,8 @@ public: std::list<GEdge*> &V0, std::list<GEdge*> &V1); virtual ~GFaceCompound(); - Range<double> parBounds(int i) const { return trivial() ? (*(_compound.begin()))->parBounds(i) : Range<double>(-1, 1); } + Range<double> parBounds(int i) const + { return trivial() ? (*(_compound.begin()))->parBounds(i) : Range<double>(-1, 1); } virtual GPoint point(double par1, double par2) const; virtual Pair<SVector3,SVector3> firstDer(const SPoint2 ¶m) const; virtual void secondDer(const SPoint2 &, SVector3 *, SVector3 *, SVector3 *) const; @@ -95,7 +94,7 @@ public: virtual bool buildRepresentationCross(){ return false; } virtual double curvatureMax(const SPoint2 ¶m) const; virtual int genusGeom (); -private: + private: typeOfIsomorphism _type; }; diff --git a/Geo/GModelIO_Geo.cpp b/Geo/GModelIO_Geo.cpp index d6e5a39705..5937c3452d 100644 --- a/Geo/GModelIO_Geo.cpp +++ b/Geo/GModelIO_Geo.cpp @@ -74,7 +74,7 @@ int GModel::importGEOInternals() e->resetMeshAttributes(); if(!c->Visible) e->setVisibility(0); if(c->Color.type) e->setColor(c->Color.mesh); - if(c->degenerated)e->setTooSmall(true); + if(c->degenerated)e->setTooSmall(true); } } List_Delete(curves); diff --git a/Geo/GModelIO_OCC.cpp b/Geo/GModelIO_OCC.cpp index 066171a1e1..81baf013d2 100644 --- a/Geo/GModelIO_OCC.cpp +++ b/Geo/GModelIO_OCC.cpp @@ -675,104 +675,104 @@ void OCC_Internals::applyBooleanOperator(TopoDS_Shape tool, const BooleanOperato if (isOnlySolids) theNewShape = GlueFaces(C, Precision::Confusion()); else - theNewShape = C; + theNewShape = C; } - shape = theNewShape; + shape = theNewShape; } break; case OCC_Internals::Cut : { TopoDS_Shape theNewShape; - BRep_Builder B; - TopoDS_Compound C; - B.MakeCompound(C); - - TopTools_ListOfShape listShapes, listTools; - addSimpleShapes(shape, listShapes); - addSimpleShapes(tool, listTools); - - Standard_Boolean isCompound = (listShapes.Extent() > 1); - - TopTools_ListIteratorOfListOfShape itSub1 (listShapes); - for (; itSub1.More(); itSub1.Next()) { - TopoDS_Shape aCut = itSub1.Value(); - // tools - TopTools_ListIteratorOfListOfShape itSub2 (listTools); - for (; itSub2.More(); itSub2.Next()) { - TopoDS_Shape aTool = itSub2.Value(); - BRepAlgoAPI_Cut BO (aCut, aTool); - if (!BO.IsDone()) { - Msg::Error("Cut operation can not be performed on the given shapes"); - return; - } - aCut = BO.Shape(); - } - if (isCompound) { - if (aCut.ShapeType() == TopAbs_COMPOUND) { - TopoDS_Iterator aCompIter (aCut); - for (; aCompIter.More(); aCompIter.Next()) { - B.Add(C, aCompIter.Value()); - } - } - else { - B.Add(C, aCut); - } - } - else - theNewShape = aCut; - } - - if (isCompound) { - TopTools_ListOfShape listShapeC; - addSimpleShapes(C, listShapeC); - TopTools_ListIteratorOfListOfShape itSubC (listShapeC); - bool isOnlySolids = true; - for (; itSubC.More(); itSubC.Next()) { - TopoDS_Shape aValueC = itSubC.Value(); - if (aValueC.ShapeType() != TopAbs_SOLID) isOnlySolids = false; - } - if (isOnlySolids) - theNewShape = GlueFaces(C, Precision::Confusion()); - else - theNewShape = C; - } - shape = theNewShape; + BRep_Builder B; + TopoDS_Compound C; + B.MakeCompound(C); + + TopTools_ListOfShape listShapes, listTools; + addSimpleShapes(shape, listShapes); + addSimpleShapes(tool, listTools); + + Standard_Boolean isCompound = (listShapes.Extent() > 1); + + TopTools_ListIteratorOfListOfShape itSub1 (listShapes); + for (; itSub1.More(); itSub1.Next()) { + TopoDS_Shape aCut = itSub1.Value(); + // tools + TopTools_ListIteratorOfListOfShape itSub2 (listTools); + for (; itSub2.More(); itSub2.Next()) { + TopoDS_Shape aTool = itSub2.Value(); + BRepAlgoAPI_Cut BO (aCut, aTool); + if (!BO.IsDone()) { + Msg::Error("Cut operation can not be performed on the given shapes"); + return; + } + aCut = BO.Shape(); + } + if (isCompound) { + if (aCut.ShapeType() == TopAbs_COMPOUND) { + TopoDS_Iterator aCompIter (aCut); + for (; aCompIter.More(); aCompIter.Next()) { + B.Add(C, aCompIter.Value()); + } + } + else { + B.Add(C, aCut); + } + } + else + theNewShape = aCut; + } + + if (isCompound) { + TopTools_ListOfShape listShapeC; + addSimpleShapes(C, listShapeC); + TopTools_ListIteratorOfListOfShape itSubC (listShapeC); + bool isOnlySolids = true; + for (; itSubC.More(); itSubC.Next()) { + TopoDS_Shape aValueC = itSubC.Value(); + if (aValueC.ShapeType() != TopAbs_SOLID) isOnlySolids = false; + } + if (isOnlySolids) + theNewShape = GlueFaces(C, Precision::Confusion()); + else + theNewShape = C; + } + shape = theNewShape; } break; case OCC_Internals::Fuse : { - BRepAlgoAPI_Fuse BO (tool, shape); - if (!BO.IsDone()) { - Msg::Error("Fuse operation can not be performed on the given shapes"); - } - shape = BO.Shape(); + BRepAlgoAPI_Fuse BO (tool, shape); + if (!BO.IsDone()) { + Msg::Error("Fuse operation can not be performed on the given shapes"); + } + shape = BO.Shape(); } break; case OCC_Internals::Section : { - TopoDS_Shape theNewShape; - BRep_Builder B; - TopoDS_Compound C; - B.MakeCompound(C); - - TopTools_ListOfShape listShapes, listTools; - addSimpleShapes(shape, listShapes); - addSimpleShapes(tool, listTools); - - Standard_Boolean isCompound = (listShapes.Extent() > 1); - TopTools_ListIteratorOfListOfShape itSub1 (listShapes); - for (; itSub1.More(); itSub1.Next()) { - TopoDS_Shape aValue1 = itSub1.Value(); - TopTools_ListIteratorOfListOfShape itSub2 (listTools); - for (; itSub2.More(); itSub2.Next()) { - TopoDS_Shape aValue2 = itSub2.Value(); - BRepAlgoAPI_Section BO (aValue1, aValue2, Standard_False); - BO.Approximation(Standard_True); - BO.Build(); - if (!BO.IsDone()) { - Msg::Error("Section operation can not be performed on the given shapes"); - return; - } + TopoDS_Shape theNewShape; + BRep_Builder B; + TopoDS_Compound C; + B.MakeCompound(C); + + TopTools_ListOfShape listShapes, listTools; + addSimpleShapes(shape, listShapes); + addSimpleShapes(tool, listTools); + + Standard_Boolean isCompound = (listShapes.Extent() > 1); + TopTools_ListIteratorOfListOfShape itSub1 (listShapes); + for (; itSub1.More(); itSub1.Next()) { + TopoDS_Shape aValue1 = itSub1.Value(); + TopTools_ListIteratorOfListOfShape itSub2 (listTools); + for (; itSub2.More(); itSub2.Next()) { + TopoDS_Shape aValue2 = itSub2.Value(); + BRepAlgoAPI_Section BO (aValue1, aValue2, Standard_False); + BO.Approximation(Standard_True); + BO.Build(); + if (!BO.IsDone()) { + Msg::Error("Section operation can not be performed on the given shapes"); + return; + } if (isCompound) { TopoDS_Shape aStepResult = BO.Shape(); if (aStepResult.ShapeType() == TopAbs_COMPOUND) { @@ -787,11 +787,11 @@ void OCC_Internals::applyBooleanOperator(TopoDS_Shape tool, const BooleanOperato } else theNewShape = BO.Shape(); - } - } - if (isCompound) - theNewShape = C; - shape = theNewShape; + } + } + if (isCompound) + theNewShape = C; + shape = theNewShape; } break; default : @@ -812,7 +812,7 @@ void OCC_Internals::Sphere(const SPoint3 ¢er, const double &radius, } void OCC_Internals::Cylinder(const SPoint3 &p, const SVector3 &d, double R, double H, - const BooleanOperator &op) + const BooleanOperator &op) { gp_Pnt aP(p.x(), p.y(), p.z()); gp_Vec aV(d.x(), d.y(), d.z()); @@ -829,7 +829,7 @@ void OCC_Internals::Cylinder(const SPoint3 &p, const SVector3 &d, double R, doub } void OCC_Internals::Torus(const SPoint3 &p, const SVector3 &d, double R1, double R2, - const BooleanOperator &op) + const BooleanOperator &op) { gp_Pnt aP(p.x(),p.y(),p.z()); gp_Vec aV(d.x(),d.y(),d.z()); @@ -846,7 +846,7 @@ void OCC_Internals::Torus(const SPoint3 &p, const SVector3 &d, double R1, double } void OCC_Internals::Torus(const SPoint3 &p, const SVector3 &d, double R1, double R2, - double angle, const BooleanOperator &op) + double angle, const BooleanOperator &op) { gp_Pnt aP(p.x(), p.y(), p.z()); gp_Vec aV(d.x(), d.y(), d.z()); @@ -880,7 +880,7 @@ void OCC_Internals::Cone(const SPoint3 &p, const SVector3 &d, double R1, } void OCC_Internals::Box(const SPoint3 &p1, const SPoint3 &p2, - const BooleanOperator &op) + const BooleanOperator &op) { gp_Pnt P1(p1.x(), p1.y(), p1.z()); gp_Pnt P2(p2.x(), p2.y(), p2.z()); @@ -895,7 +895,7 @@ void OCC_Internals::Box(const SPoint3 &p1, const SPoint3 &p2, } void OCC_Internals::Fillet(std::vector<TopoDS_Edge> &edgesToFillet, - double Radius){ + double Radius){ // create a tool for fillet BRepFilletAPI_MakeFillet fill(shape); diff --git a/Geo/GModelIO_OCC.h b/Geo/GModelIO_OCC.h index 563b7dea7d..b889dfbd27 100644 --- a/Geo/GModelIO_OCC.h +++ b/Geo/GModelIO_OCC.h @@ -51,13 +51,13 @@ class OCC_Internals { void Box(const SPoint3 &p1, const SPoint3 &p2, const BooleanOperator &op); void Sphere(const SPoint3 ¢er, const double &radius, const BooleanOperator &op); void Cylinder(const SPoint3 &bottom_center, const SVector3 &dir, double R, double H, - const BooleanOperator &op); + const BooleanOperator &op); void Cone(const SPoint3 &bottom_center, const SVector3 &dir, double R1, double R2, - double H, const BooleanOperator &op); + double H, const BooleanOperator &op); void Torus(const SPoint3 &bottom_center, const SVector3 &dir, double R1, double R2, - const BooleanOperator &op); + const BooleanOperator &op); void Torus(const SPoint3 &bottom_center, const SVector3 &dir, double R1, double R2, - double angle, const BooleanOperator &op); + double angle, const BooleanOperator &op); void Fillet(std::vector<TopoDS_Edge> &shapes, double radius); void applyBooleanOperator(TopoDS_Shape tool, const BooleanOperator &op); }; diff --git a/Geo/GRegionCompound.cpp b/Geo/GRegionCompound.cpp index 723a0c2ce0..79192e234d 100644 --- a/Geo/GRegionCompound.cpp +++ b/Geo/GRegionCompound.cpp @@ -13,9 +13,8 @@ #include "Numeric.h" GRegionCompound::GRegionCompound(GModel *m, int tag, std::vector<GRegion*> &compound) - : GRegion(m, tag), _compound(compound) + : GRegion(m, tag), _compound(compound) { - //printf("********* In GRegion compound size =%d \n", _compound.size()); getBoundingFaces(); } @@ -23,47 +22,44 @@ GRegionCompound::~GRegionCompound() { } -void GRegionCompound::getBoundingFaces(){ - +void GRegionCompound::getBoundingFaces() +{ std::set<GFace*> _unique; std::multiset<GFace*> _touched; std::vector<GRegion*>::iterator it = _compound.begin(); for ( ; it != _compound.end(); ++it){ - //printf("face %d \n", (*it)->tag()); std::list<GFace*> ed = (*it)->faces(); - std::list<GFace*> :: iterator ite = ed.begin(); + std::list<GFace*> :: iterator ite = ed.begin(); for ( ; ite != ed.end(); ++ite){ - _touched.insert(*ite); - } - } + _touched.insert(*ite); + } + } it = _compound.begin(); for ( ; it != _compound.end(); ++it){ std::list<GFace*> ed = (*it)->faces(); std::list<GFace*> :: iterator ite = ed.begin(); for ( ; ite != ed.end() ; ++ite){ if (!(*ite)->degenerate(0) && _touched.count(*ite) == 1) { - _unique.insert(*ite); } + _unique.insert(*ite); + } } } - + std::set<GFace*>::iterator itf = _unique.begin(); for ( ; itf != _unique.end(); ++itf){ l_faces.push_back(*itf); - //printf("for face %d, add region %d \n", (*itf)->tag(), this->tag()); (*itf)->addRegion(this); } - } - -SBoundingBox3d GRegionCompound::bounds() const { +SBoundingBox3d GRegionCompound::bounds() const +{ Msg::Error("Cannot evaluate bounds on GRegion Compound"); - return SBoundingBox3d(SPoint3()); + return SBoundingBox3d(SPoint3()); } double GRegionCompound::curvature(double par) const { - double k = 0.0; Msg::Error("Cannot evaluate curvature on GRegionCompound"); return k; @@ -71,14 +67,12 @@ double GRegionCompound::curvature(double par) const GPoint GRegionCompound::point(double par) const { - Msg::Error("Cannot evaluate point on GRegionCompound"); return GPoint(); } SVector3 GRegionCompound::firstDer(double par) const { - Msg::Error("Cannot evaluate firstDeriv on GRegionCompound"); return SVector3(); } diff --git a/Geo/GRegionCompound.h b/Geo/GRegionCompound.h index 13ae88ffc3..a69d6edabe 100644 --- a/Geo/GRegionCompound.h +++ b/Geo/GRegionCompound.h @@ -18,7 +18,7 @@ A GRegionCompound is a model region that is the compound of model regions. It is assumed that all the regions of the compound have been meshed first and that all the faces of the compound region are compound surfaces. -The compound can therefore be re-meshed using any surface mesh +The compound can therefore be re-meshed using any volume mesh generator of gmsh! */ @@ -35,9 +35,8 @@ class GRegionCompound : public GRegion { void * getNativePtr() const { return 0; } protected: - std::vector<GRegion*> _compound; -void getBoundingFaces(); - + std::vector<GRegion*> _compound; + void getBoundingFaces(); }; #endif diff --git a/Geo/MElementCut.cpp b/Geo/MElementCut.cpp index 16a29bcb5f..44ad5151f0 100644 --- a/Geo/MElementCut.cpp +++ b/Geo/MElementCut.cpp @@ -529,37 +529,37 @@ static void elementCutMesh(MElement *e, gLevelset *ls, GEntity *ge, GModel *GM, std::vector<DI_IntegrationPoint> ipS; if(eType == MSH_TET_4) { - DI_Tetra T(e->getVertex(0)->x(), e->getVertex(0)->y(), e->getVertex(0)->z(), - e->getVertex(1)->x(), e->getVertex(1)->y(), e->getVertex(1)->z(), - e->getVertex(2)->x(), e->getVertex(2)->y(), e->getVertex(2)->z(), - e->getVertex(3)->x(), e->getVertex(3)->y(), e->getVertex(3)->z()); - T.cut(*ls, ipV, ipS, cp, integOrder, integOrder, integOrder, + DI_Tetra T(e->getVertex(0)->x(), e->getVertex(0)->y(), e->getVertex(0)->z(), + e->getVertex(1)->x(), e->getVertex(1)->y(), e->getVertex(1)->z(), + e->getVertex(2)->x(), e->getVertex(2)->y(), e->getVertex(2)->z(), + e->getVertex(3)->x(), e->getVertex(3)->y(), e->getVertex(3)->z()); + T.cut(*ls, ipV, ipS, cp, integOrder, integOrder, integOrder, subTetras, surfQuads, surfTriangles); } else if(eType == MSH_HEX_8){ - DI_Hexa H(e->getVertex(0)->x(), e->getVertex(0)->y(), e->getVertex(0)->z(), - e->getVertex(1)->x(), e->getVertex(1)->y(), e->getVertex(1)->z(), - e->getVertex(2)->x(), e->getVertex(2)->y(), e->getVertex(2)->z(), - e->getVertex(3)->x(), e->getVertex(3)->y(), e->getVertex(3)->z(), - e->getVertex(4)->x(), e->getVertex(4)->y(), e->getVertex(4)->z(), - e->getVertex(5)->x(), e->getVertex(5)->y(), e->getVertex(5)->z(), - e->getVertex(6)->x(), e->getVertex(6)->y(), e->getVertex(6)->z(), - e->getVertex(7)->x(), e->getVertex(7)->y(), e->getVertex(7)->z()); - H.cut(*ls, ipV, ipS, cp, integOrder, integOrder, integOrder, integOrder, + DI_Hexa H(e->getVertex(0)->x(), e->getVertex(0)->y(), e->getVertex(0)->z(), + e->getVertex(1)->x(), e->getVertex(1)->y(), e->getVertex(1)->z(), + e->getVertex(2)->x(), e->getVertex(2)->y(), e->getVertex(2)->z(), + e->getVertex(3)->x(), e->getVertex(3)->y(), e->getVertex(3)->z(), + e->getVertex(4)->x(), e->getVertex(4)->y(), e->getVertex(4)->z(), + e->getVertex(5)->x(), e->getVertex(5)->y(), e->getVertex(5)->z(), + e->getVertex(6)->x(), e->getVertex(6)->y(), e->getVertex(6)->z(), + e->getVertex(7)->x(), e->getVertex(7)->y(), e->getVertex(7)->z()); + H.cut(*ls, ipV, ipS, cp, integOrder, integOrder, integOrder, integOrder, subHexas, subTetras, surfQuads, surfTriangles, boundLines); } else if(eType == MSH_PRI_6){ DI_Tetra T1(e->getVertex(0)->x(), e->getVertex(0)->y(), e->getVertex(0)->z(), - e->getVertex(1)->x(), e->getVertex(1)->y(), e->getVertex(1)->z(), - e->getVertex(2)->x(), e->getVertex(2)->y(), e->getVertex(2)->z(), + e->getVertex(1)->x(), e->getVertex(1)->y(), e->getVertex(1)->z(), + e->getVertex(2)->x(), e->getVertex(2)->y(), e->getVertex(2)->z(), e->getVertex(5)->x(), e->getVertex(5)->y(), e->getVertex(5)->z()); DI_Tetra T2(e->getVertex(0)->x(), e->getVertex(0)->y(), e->getVertex(0)->z(), - e->getVertex(4)->x(), e->getVertex(4)->y(), e->getVertex(4)->z(), - e->getVertex(1)->x(), e->getVertex(1)->y(), e->getVertex(1)->z(), + e->getVertex(4)->x(), e->getVertex(4)->y(), e->getVertex(4)->z(), + e->getVertex(1)->x(), e->getVertex(1)->y(), e->getVertex(1)->z(), e->getVertex(5)->x(), e->getVertex(5)->y(), e->getVertex(5)->z()); DI_Tetra T3(e->getVertex(0)->x(), e->getVertex(0)->y(), e->getVertex(0)->z(), - e->getVertex(3)->x(), e->getVertex(3)->y(), e->getVertex(3)->z(), - e->getVertex(4)->x(), e->getVertex(4)->y(), e->getVertex(4)->z(), + e->getVertex(3)->x(), e->getVertex(3)->y(), e->getVertex(3)->z(), + e->getVertex(4)->x(), e->getVertex(4)->y(), e->getVertex(4)->z(), e->getVertex(5)->x(), e->getVertex(5)->y(), e->getVertex(5)->z()); T1.cut(*ls, ipV, ipS, cp, integOrder, integOrder, integOrder, subTetras, surfQuads, surfTriangles); @@ -570,13 +570,13 @@ static void elementCutMesh(MElement *e, gLevelset *ls, GEntity *ge, GModel *GM, } else if(eType == MSH_PYR_5){ DI_Tetra T1(e->getVertex(0)->x(), e->getVertex(0)->y(), e->getVertex(0)->z(), - e->getVertex(1)->x(), e->getVertex(1)->y(), e->getVertex(1)->z(), - e->getVertex(2)->x(), e->getVertex(2)->y(), e->getVertex(2)->z(), - e->getVertex(4)->x(), e->getVertex(4)->y(), e->getVertex(4)->z()); + e->getVertex(1)->x(), e->getVertex(1)->y(), e->getVertex(1)->z(), + e->getVertex(2)->x(), e->getVertex(2)->y(), e->getVertex(2)->z(), + e->getVertex(4)->x(), e->getVertex(4)->y(), e->getVertex(4)->z()); DI_Tetra T2(e->getVertex(0)->x(), e->getVertex(0)->y(), e->getVertex(0)->z(), e->getVertex(2)->x(), e->getVertex(2)->y(), e->getVertex(2)->z(), - e->getVertex(3)->x(), e->getVertex(3)->y(), e->getVertex(3)->z(), - e->getVertex(4)->x(), e->getVertex(4)->y(), e->getVertex(4)->z()); + e->getVertex(3)->x(), e->getVertex(3)->y(), e->getVertex(3)->z(), + e->getVertex(4)->x(), e->getVertex(4)->y(), e->getVertex(4)->z()); T1.cut(*ls, ipV, ipS, cp, integOrder, integOrder, integOrder, subTetras, surfQuads, surfTriangles); T2.cut(*ls, ipV, ipS, cp, integOrder, integOrder, integOrder, @@ -586,9 +586,9 @@ static void elementCutMesh(MElement *e, gLevelset *ls, GEntity *ge, GModel *GM, for(int i = 0; i < e->getNumChildren(); i++) { MTetrahedron *t = (MTetrahedron*) e->getChild(i); DI_Tetra Tet(t->getVertex(0)->x(), t->getVertex(0)->y(), t->getVertex(0)->z(), - t->getVertex(1)->x(), t->getVertex(1)->y(), t->getVertex(1)->z(), - t->getVertex(2)->x(), t->getVertex(2)->y(), t->getVertex(2)->z(), - t->getVertex(3)->x(), t->getVertex(3)->y(), t->getVertex(3)->z()); + t->getVertex(1)->x(), t->getVertex(1)->y(), t->getVertex(1)->z(), + t->getVertex(2)->x(), t->getVertex(2)->y(), t->getVertex(2)->z(), + t->getVertex(3)->x(), t->getVertex(3)->y(), t->getVertex(3)->z()); Tet.cut(*ls, ipV, ipS, cp, integOrder, integOrder, integOrder, subTetras, surfQuads, surfTriangles); } @@ -602,7 +602,7 @@ static void elementCutMesh(MElement *e, gLevelset *ls, GEntity *ge, GModel *GM, (eType == MSH_POLYH_ && subTetras.size() > e->getNumChildren())) { std::vector<MTetrahedron*> poly[2]; - for (unsigned int i = 0; i < subTetras.size(); i++){ + for (unsigned int i = 0; i < subTetras.size(); i++){ MVertex *mv[4] = {NULL, NULL, NULL, NULL}; for(int j = 0; j < 4; j++){ int numV = getElementVertexNum(subTetras[i].pt(j), e); @@ -708,26 +708,26 @@ static void elementCutMesh(MElement *e, gLevelset *ls, GEntity *ge, GModel *GM, std::vector<DI_IntegrationPoint> ipS; if(eType == MSH_TRI_3) { - DI_Triangle T(e->getVertex(0)->x(), e->getVertex(0)->y(), e->getVertex(0)->z(), - e->getVertex(1)->x(), e->getVertex(1)->y(), e->getVertex(1)->z(), - e->getVertex(2)->x(), e->getVertex(2)->y(), e->getVertex(2)->z()); - T.cut(*ls, ipV, ipS, cp, integOrder, integOrder, integOrder, + DI_Triangle T(e->getVertex(0)->x(), e->getVertex(0)->y(), e->getVertex(0)->z(), + e->getVertex(1)->x(), e->getVertex(1)->y(), e->getVertex(1)->z(), + e->getVertex(2)->x(), e->getVertex(2)->y(), e->getVertex(2)->z()); + T.cut(*ls, ipV, ipS, cp, integOrder, integOrder, integOrder, subQuads, subTriangles, boundLines); } else if(eType == MSH_QUA_4){ - DI_Quad Q(e->getVertex(0)->x(), e->getVertex(0)->y(), e->getVertex(0)->z(), - e->getVertex(1)->x(), e->getVertex(1)->y(), e->getVertex(1)->z(), - e->getVertex(2)->x(), e->getVertex(2)->y(), e->getVertex(2)->z(), - e->getVertex(3)->x(), e->getVertex(3)->y(), e->getVertex(3)->z()); - Q.cut(*ls, ipV, ipS, cp, integOrder,integOrder,integOrder, + DI_Quad Q(e->getVertex(0)->x(), e->getVertex(0)->y(), e->getVertex(0)->z(), + e->getVertex(1)->x(), e->getVertex(1)->y(), e->getVertex(1)->z(), + e->getVertex(2)->x(), e->getVertex(2)->y(), e->getVertex(2)->z(), + e->getVertex(3)->x(), e->getVertex(3)->y(), e->getVertex(3)->z()); + Q.cut(*ls, ipV, ipS, cp, integOrder,integOrder,integOrder, subQuads, subTriangles, boundLines); } else if(eType == MSH_POLYG_){ for(int i = 0; i < e->getNumChildren(); i++) { MTriangle *t = (MTriangle*) e->getChild(i); DI_Triangle Tri(t->getVertex(0)->x(), t->getVertex(0)->y(), t->getVertex(0)->z(), - t->getVertex(1)->x(), t->getVertex(1)->y(), t->getVertex(1)->z(), - t->getVertex(2)->x(), t->getVertex(2)->y(), t->getVertex(2)->z()); + t->getVertex(1)->x(), t->getVertex(1)->y(), t->getVertex(1)->z(), + t->getVertex(2)->x(), t->getVertex(2)->y(), t->getVertex(2)->z()); Tri.cut(*ls, ipV, ipS, cp, integOrder, integOrder, integOrder, subQuads, subTriangles, boundLines); } @@ -739,7 +739,7 @@ static void elementCutMesh(MElement *e, gLevelset *ls, GEntity *ge, GModel *GM, (eType == MSH_POLYG_ && subTriangles.size() > e->getNumChildren())) { std::vector<MTriangle*> poly[2]; - for (unsigned int i = 0; i < subTriangles.size(); i++){ + for (unsigned int i = 0; i < subTriangles.size(); i++){ MVertex *mv[3] = {NULL, NULL, NULL}; for(int j = 0; j < 3; j++){ int numV = getElementVertexNum(subTriangles[i].pt(j), e); @@ -831,11 +831,11 @@ static void elementCutMesh(MElement *e, gLevelset *ls, GEntity *ge, GModel *GM, int integOrder = 1; std::vector<DI_IntegrationPoint> ip; DI_Line L(e->getVertex(0)->x(), e->getVertex(0)->y(), e->getVertex(0)->z(), - e->getVertex(1)->x(), e->getVertex(1)->y(), e->getVertex(1)->z()); + e->getVertex(1)->x(), e->getVertex(1)->y(), e->getVertex(1)->z()); L.cut(*ls, ip, cp, integOrder, lines); if(lines.size() > 1) { - for (unsigned int i = 0; i < lines.size(); i++){ + for (unsigned int i = 0; i < lines.size(); i++){ MVertex *mv[2] = {NULL, NULL}; for(int j = 0; j < 2; j++){ int numV = getElementVertexNum(lines[i].pt(j), e); diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp index 1782257c86..d6735e1855 100644 --- a/Mesh/Generator.cpp +++ b/Mesh/Generator.cpp @@ -119,27 +119,27 @@ geomTresholdVertexEquivalence::geomTresholdVertexEquivalence(GModel *g) g->mesh_vertices.push_back(other); std::list<GEdge*> ed = g->edges(); for (std::list<GEdge*>::iterator ite = ed.begin() ; ite != ed.end() ; ++ite){ - std::vector<MLine*> newl; - for (unsigned int i = 0; i < (*ite)->lines.size(); ++i){ - MLine *l = (*ite)->lines[i]; - MVertex *v1 = l->getVertex(0); - MVertex *v2 = l->getVertex(1); - if (v1 == v && v2 != other){ - delete l; - l = new MLine(other,v2); - newl.push_back(l); - } - else if (v1 != other && v2 == v){ - delete l; - l = new MLine(v1,other); - newl.push_back(l); - } - else if (v1 != v && v2 != v) - newl.push_back(l); - else - delete l; - } - (*ite)->lines = newl; + std::vector<MLine*> newl; + for (unsigned int i = 0; i < (*ite)->lines.size(); ++i){ + MLine *l = (*ite)->lines[i]; + MVertex *v1 = l->getVertex(0); + MVertex *v2 = l->getVertex(1); + if (v1 == v && v2 != other){ + delete l; + l = new MLine(other,v2); + newl.push_back(l); + } + else if (v1 != other && v2 == v){ + delete l; + l = new MLine(v1,other); + newl.push_back(l); + } + else if (v1 != v && v2 != v) + newl.push_back(l); + else + delete l; + } + (*ite)->lines = newl; } } } diff --git a/Mesh/meshGFaceBDS.cpp b/Mesh/meshGFaceBDS.cpp index 8693a8aae4..aaaee3c204 100644 --- a/Mesh/meshGFaceBDS.cpp +++ b/Mesh/meshGFaceBDS.cpp @@ -61,7 +61,7 @@ inline double computeEdgeLinearLength_new(BDS_Point *p1, BDS_Point *p2, GFace * for (int i = 1; i < nbSb; i++){ double xi = (double)i / nbSb; GP[i-1] = f->point(SPoint2(((1-xi) * p1->u + xi * p2->u) * SCALINGU, - ((1-xi) * p1->v + xi * p2->v) * SCALINGV)); + ((1-xi) * p1->v + xi * p2->v) * SCALINGV)); if (!GP[i-1].succeeded()) return computeEdgeLinearLength(p1,p2); } @@ -108,7 +108,7 @@ inline double computeEdgeMiddleCoord_new(BDS_Point *p1, BDS_Point *p2, GFace *f, if (LPLUS > L*.5){ double XIMINUS, LPLUS, LMINUS; if (i==1){ - XIMINUS=0; + XIMINUS=0; } return XIMINUS + (LPLUS - L*.5)/(LPLUS-LMINUS)/(nbSb-1); } @@ -462,7 +462,7 @@ void splitEdgePassUnsorted(GFace *gf, BDS_Mesh &m, double MAXE_, int &nb_split) if ((*it)->numfaces() == 2 && (lone > MAXE_)){ const double coord = 0.5; //const double coord = computeEdgeMiddleCoord((*it)->p1, (*it)->p2, gf, - // m.scalingU, m.scalingV); + // m.scalingU, m.scalingV); BDS_Point *mid; GPoint gpp = gf->point @@ -499,8 +499,8 @@ static void midpointsphere(GFace *gf, double u1, double v1, double u2, v12 = guess[1]; double d = sqrt((p1.x() - p2.x()) * (p1.x() - p2.x()) + - (p1.y() - p2.y()) * (p1.y() - p2.y()) + - (p1.z() - p2.z()) * (p1.z() - p2.z())); + (p1.y() - p2.y()) * (p1.y() - p2.y()) + + (p1.z() - p2.z()) * (p1.z() - p2.z())); if (d > r/3){ return; @@ -547,12 +547,12 @@ void splitEdgePass(GFace *gf, BDS_Mesh &m, double MAXE_, int &nb_split) double U, V; if (0 && gf->geomType() == GEntity::Sphere){ - midpointsphere(gf,e->p1->u,e->p1->v,e->p2->u,e->p2->v,U,V, - gf-> getSurfaceParams().radius); + midpointsphere(gf,e->p1->u,e->p1->v,e->p2->u,e->p2->v,U,V, + gf-> getSurfaceParams().radius); } else{ - U = coord * e->p1->u + (1 - coord) * e->p2->u; - V = coord * e->p1->v + (1 - coord) * e->p2->v; + U = coord * e->p1->u + (1 - coord) * e->p2->u; + V = coord * e->p1->v + (1 - coord) * e->p2->v; } GPoint gpp = gf->point(m.scalingU*U,m.scalingV*V); diff --git a/Mesh/meshGFaceOptimize.cpp b/Mesh/meshGFaceOptimize.cpp index 6cd2547914..a7f3b14645 100644 --- a/Mesh/meshGFaceOptimize.cpp +++ b/Mesh/meshGFaceOptimize.cpp @@ -18,8 +18,8 @@ static void setLcsInit(MTriangle *t, std::map<MVertex*, double> &vSizes) { - for (int i = 0; i < 3; i++){ - for (int j = i + 1; j < 3; j++){ + for(int i = 0; i < 3; i++){ + for(int j = i + 1; j < 3; j++){ MVertex *vi = t->getVertex(i); MVertex *vj = t->getVertex(j); vSizes[vi] = -1; @@ -30,8 +30,8 @@ static void setLcsInit(MTriangle *t, std::map<MVertex*, double> &vSizes) static void setLcs(MTriangle *t, std::map<MVertex*, double> &vSizes) { - for (int i = 0; i < 3; i++){ - for (int j = i + 1; j < 3; j++){ + for(int i = 0; i < 3; i++){ + for(int j = i + 1; j < 3; j++){ MVertex *vi = t->getVertex(i); MVertex *vj = t->getVertex(j); double dx = vi->x() - vj->x(); @@ -40,8 +40,8 @@ static void setLcs(MTriangle *t, std::map<MVertex*, double> &vSizes) double l = sqrt(dx * dx + dy * dy + dz * dz); std::map<MVertex*,double>::iterator iti = vSizes.find(vi); std::map<MVertex*,double>::iterator itj = vSizes.find(vj); - if (iti->second < 0 || iti->second > l) iti->second = l; - if (itj->second < 0 || itj->second > l) itj->second = l; + if(iti->second < 0 || iti->second > l) iti->second = l; + if(itj->second < 0 || itj->second > l) itj->second = l; } } } @@ -57,10 +57,10 @@ void buildMeshGenerationDataStructures(GFace *gf, std::map<MVertex*, double> vSizesMap; std::list<GEdge*> edges = gf->edges(); - for (unsigned int i = 0;i < gf->triangles.size(); i++) + for(unsigned int i = 0;i < gf->triangles.size(); i++) setLcsInit(gf->triangles[i], vSizesMap); - for (unsigned int i = 0;i < gf->triangles.size(); i++) + for(unsigned int i = 0;i < gf->triangles.size(); i++) setLcs(gf->triangles[i], vSizesMap); // take care of embedded vertices @@ -75,7 +75,7 @@ void buildMeshGenerationDataStructures(GFace *gf, } int NUM = 0; - for (std::map<MVertex*, double>::iterator it = vSizesMap.begin(); + for(std::map<MVertex*, double>::iterator it = vSizesMap.begin(); it != vSizesMap.end(); ++it){ // FIXME: this vertex-stored indexing makes the optimization // routines not thread-safe (we cannot concurrently optimize two @@ -103,9 +103,9 @@ void transferDataStructure(GFace *gf, std::set<MTri3*, compareTri3Ptr> &AllTris, std::vector<double> &Us, std::vector<double> &Vs) { while (1) { - if (AllTris.begin() == AllTris.end()) break; + if(AllTris.begin() == AllTris.end()) break; MTri3 *worst = *AllTris.begin(); - if (worst->isDeleted()) + if(worst->isDeleted()) delete worst->tri(); else gf->triangles.push_back(worst->tri()); @@ -139,12 +139,12 @@ void transferDataStructure(GFace *gf, std::set<MTri3*, compareTri3Ptr> &AllTris, template <class T> void buildVertexToElement(std::vector<T*> &eles, v2t_cont &adj) { - for (unsigned int i = 0; i < eles.size(); i++){ + for(unsigned int i = 0; i < eles.size(); i++){ T *t = eles[i]; - for (int j = 0; j < t->getNumVertices(); j++){ + for(int j = 0; j < t->getNumVertices(); j++){ MVertex *v = t->getVertex(j); v2t_cont :: iterator it = adj.find(v); - if (it == adj.end()){ + if(it == adj.end()){ std::vector<MElement*> one; one.push_back(t); adj[v] = one; @@ -165,12 +165,12 @@ void buildVertexToTriangle(std::vector<MTriangle*> &eles, v2t_cont &adj) template <class T> void buildEdgeToElement(std::vector<T*> &elements, e2t_cont &adj) { - for (unsigned int i = 0; i < elements.size(); i++){ + for(unsigned int i = 0; i < elements.size(); i++){ T *t = elements[i]; - for (int j = 0; j < t->getNumEdges(); j++){ + for(int j = 0; j < t->getNumEdges(); j++){ MEdge e = t->getEdge(j); e2t_cont::iterator it = adj.find(e); - if (it == adj.end()){ + if(it == adj.end()){ std::pair<MElement*, MElement*> one = std::make_pair(t, (MElement*)0); adj[e] = one; } @@ -196,7 +196,7 @@ void buildEdgeToTriangle(std::vector<MTriangle*> &tris, e2t_cont &adj) void parametricCoordinates(MElement *t, GFace *gf, double u[4], double v[4]) { - for (int j = 0; j < t->getNumVertices(); j++){ + for(int j = 0; j < t->getNumVertices(); j++){ MVertex *ver = t->getVertex(j); SPoint2 param; reparamMeshVertexOnFace(ver, gf, param); @@ -211,13 +211,13 @@ void laplaceSmoothing(GFace *gf) buildVertexToElement(gf->triangles, adj); buildVertexToElement(gf->quadrangles, adj); - for (int i = 0; i < 5; i++){ + for(int i = 0; i < 5; i++){ v2t_cont :: iterator it = adj.begin(); while (it != adj.end()){ MVertex *ver= it->first; GEntity *ge = ver->onWhat(); // this vertex in internal to the face - if (ge->dim() == 2){ + if(ge->dim() == 2){ double initu,initv; ver->getParameter(0, initu); ver->getParameter(1, initv); @@ -225,22 +225,22 @@ void laplaceSmoothing(GFace *gf) double cu = 0, cv = 0; double pu[4], pv[4]; double fact = 0.0; - for (unsigned int i = 0; i < lt.size(); i++){ + for(unsigned int i = 0; i < lt.size(); i++){ parametricCoordinates(lt[i], gf, pu, pv); cu += (pu[0] + pu[1] + pu[2]); cv += (pv[0] + pv[1] + pv[2]); - if (lt[i]->getNumVertices() == 4){ + if(lt[i]->getNumVertices() == 4){ cu += pu[3]; cv += pv[3]; } fact += lt[i]->getNumVertices(); // have to test validity ! } - if (fact != 0.0){ + if(fact != 0.0){ ver->setParameter(0, cu / fact); ver->setParameter(1, cv / fact); GPoint pt = gf->point(SPoint2(cu / fact, cv / fact)); - if (pt.succeeded()){ + if(pt.succeeded()){ ver->x() = pt.x(); ver->y() = pt.y(); ver->z() = pt.z(); @@ -269,18 +269,18 @@ bool gmshEdgeSwap(std::set<swapquad> &configs, MTri3 *t1, GFace *gf, int iLocalE const std::vector<double> &vSizes, const std::vector<double> &vSizesBGM) { MTri3 *t2 = t1->getNeigh(iLocalEdge); - if (!t2) return false; + if(!t2) return false; MVertex *v1 = t1->tri()->getVertex(iLocalEdge == 0 ? 2 : iLocalEdge - 1); MVertex *v2 = t1->tri()->getVertex((iLocalEdge) % 3); MVertex *v3 = t1->tri()->getVertex((iLocalEdge + 1) % 3); MVertex *v4 = 0; - for (int i = 0; i < 3; i++) - if (t2->tri()->getVertex(i) != v1 && t2->tri()->getVertex(i) != v2) + for(int i = 0; i < 3; i++) + if(t2->tri()->getVertex(i) != v1 && t2->tri()->getVertex(i) != v2) v4 = t2->tri()->getVertex(i); swapquad sq (v1, v2, v3, v4); - if (configs.find(sq) != configs.end()) return false; + if(configs.find(sq) != configs.end()) return false; configs.insert(sq); const double volumeRef = surfaceTriangleUV(v1, v2, v3, Us, Vs) + @@ -291,7 +291,7 @@ bool gmshEdgeSwap(std::set<swapquad> &configs, MTri3 *t1, GFace *gf, int iLocalE const double v1b = surfaceTriangleUV(v2, v3, v4, Us, Vs); const double v2b = surfaceTriangleUV(v4, v3, v1, Us, Vs); const double volume = v1b + v2b; - if (fabs(volume - volumeRef) > 1.e-10 * (volume + volumeRef) || + if(fabs(volume - volumeRef) > 1.e-10 * (volume + volumeRef) || v1b < 1.e-8 * (volume + volumeRef) || v2b < 1.e-8 * (volume + volumeRef)){ delete t1b; @@ -306,7 +306,7 @@ bool gmshEdgeSwap(std::set<swapquad> &configs, MTri3 *t1, GFace *gf, int iLocalE qmTriangle(t2->tri(), QMTRI_RHO)); const double triQuality = std::min(qmTriangle(t1b, QMTRI_RHO), qmTriangle(t2b, QMTRI_RHO)); - if (triQuality < triQualityRef){ + if(triQuality < triQualityRef){ delete t1b; delete t2b; return false; @@ -322,7 +322,7 @@ bool gmshEdgeSwap(std::set<swapquad> &configs, MTri3 *t1, GFace *gf, int iLocalE double uv4[2] ={Us[v4->getIndex()], Vs[v4->getIndex()]}; double metric[3]; buildMetric(gf, edgeCenter, metric); - if (!inCircumCircleAniso(gf, t1->tri(), uv4, metric, Us, Vs)){ + if(!inCircumCircleAniso(gf, t1->tri(), uv4, metric, Us, Vs)){ delete t1b; delete t2b; return false; @@ -344,7 +344,7 @@ bool gmshEdgeSwap(std::set<swapquad> &configs, MTri3 *t1, GFace *gf, int iLocalE (avg1[1]-gp1.y()) + (avg1[2] - gp1.z()) * (avg1[2] - gp1.z()); double d2 = (avg2[0] - gp2.x()) * (avg2[0] - gp2.x()) + (avg2[1] - gp2.y()) * (avg2[1] - gp2.y()) + (avg2[2] - gp2.z()) * (avg2[2] - gp2.z()); - if (d1 < d2){ + if(d1 < d2){ delete t1b; delete t2b; return false; @@ -358,21 +358,21 @@ bool gmshEdgeSwap(std::set<swapquad> &configs, MTri3 *t1, GFace *gf, int iLocalE std::list<MTri3*> cavity; for(int i = 0; i < 3; i++){ - if (t1->getNeigh(i) && t1->getNeigh(i) != t2){ + if(t1->getNeigh(i) && t1->getNeigh(i) != t2){ bool found = false; - for (std::list<MTri3*>::iterator it = cavity.begin(); it != cavity.end(); it++){ - if (*it == t1->getNeigh(i)) found = true; + for(std::list<MTri3*>::iterator it = cavity.begin(); it != cavity.end(); it++){ + if(*it == t1->getNeigh(i)) found = true; } - if (!found)cavity.push_back(t1->getNeigh(i)); + if(!found)cavity.push_back(t1->getNeigh(i)); } } for(int i = 0; i < 3; i++){ - if (t2->getNeigh(i) && t2->getNeigh(i) != t1){ + if(t2->getNeigh(i) && t2->getNeigh(i) != t1){ bool found = false; - for (std::list<MTri3*>::iterator it = cavity.begin(); it != cavity.end(); it++){ - if (*it == t2->getNeigh(i)) found = true; + for(std::list<MTri3*>::iterator it = cavity.begin(); it != cavity.end(); it++){ + if(*it == t2->getNeigh(i)) found = true; } - if (!found)cavity.push_back(t2->getNeigh(i)); + if(!found)cavity.push_back(t2->getNeigh(i)); } } double lc1 = 0.3333333333 * (vSizes[t1b->getVertex(0)->getIndex()] + @@ -421,7 +421,7 @@ inline double computeEdgeAdimLength(MVertex *v1, MVertex *v2, GFace *f, const double dy2 = v2->y() - GP.y(); const double dz2 = v2->z() - GP.z(); const double l2 = sqrt(dx2 * dx2 + dy2 * dy2 + dz2 * dz2); - if (Extend1dMeshIn2dSurfaces()) + if(Extend1dMeshIn2dSurfaces()) return 2 * (l1 + l2) / (std::min(vSizes[v1->getIndex()], vSizesBGM[v1->getIndex()]) + std::min(vSizes[v2->getIndex()], vSizesBGM[v2->getIndex()])); return 2 * (l1 + l2) / (vSizesBGM[v1->getIndex()] + vSizesBGM[v2->getIndex()]); @@ -433,7 +433,7 @@ bool gmshEdgeSplit(const double lMax, MTri3 *t1, GFace *gf, int iLocalEdge, std::vector<double> &vSizes, std::vector<double> &vSizesBGM) { MTri3 *t2 = t1->getNeigh(iLocalEdge); - if (!t2) return false; + if(!t2) return false; MVertex *v1 = t1->tri()->getVertex(iLocalEdge == 0 ? 2 : iLocalEdge - 1); MVertex *v2 = t1->tri()->getVertex(iLocalEdge % 3); @@ -441,12 +441,12 @@ bool gmshEdgeSplit(const double lMax, MTri3 *t1, GFace *gf, int iLocalEdge, (Vs[v1->getIndex()] + Vs[v2->getIndex()]) * .5}; double al = computeEdgeAdimLength(v1, v2, gf,Us, Vs, vSizes, vSizesBGM); - if (al <= lMax) return false; + if(al <= lMax) return false; MVertex *v3 = t1->tri()->getVertex((iLocalEdge + 1) % 3); MVertex *v4 = 0; - for (int i = 0; i < 3; i++) - if (t2->tri()->getVertex(i) != v1 && t2->tri()->getVertex(i) != v2) + for(int i = 0; i < 3; i++) + if(t2->tri()->getVertex(i) != v1 && t2->tri()->getVertex(i) != v2) v4 = t2->tri()->getVertex(i); GPoint p = gf->point(edgeCenter[0], edgeCenter[1]); @@ -468,7 +468,7 @@ bool gmshEdgeSplit(const double lMax, MTri3 *t1, GFace *gf, int iLocalEdge, qmTriangle(t2b, QMTRI_RHO)), qmTriangle(t3b, QMTRI_RHO)), qmTriangle(t4b, QMTRI_RHO)); - if (triQuality < triQualityRef){ + if(triQuality < triQualityRef){ delete t1b; delete t2b; delete t3b; @@ -497,21 +497,21 @@ bool gmshEdgeSplit(const double lMax, MTri3 *t1, GFace *gf, int iLocalEdge, std::list<MTri3*> cavity; for(int i = 0; i < 3; i++){ - if (t1->getNeigh(i) && t1->getNeigh(i) != t2){ + if(t1->getNeigh(i) && t1->getNeigh(i) != t2){ bool found = false; - for (std::list<MTri3*>::iterator it = cavity.begin();it != cavity.end(); it++){ - if (*it == t1->getNeigh(i)) found = true; + for(std::list<MTri3*>::iterator it = cavity.begin();it != cavity.end(); it++){ + if(*it == t1->getNeigh(i)) found = true; } - if (!found) cavity.push_back(t1->getNeigh(i)); + if(!found) cavity.push_back(t1->getNeigh(i)); } } for(int i = 0; i < 3; i++){ - if (t2->getNeigh(i) && t2->getNeigh(i) != t1){ + if(t2->getNeigh(i) && t2->getNeigh(i) != t1){ bool found = false; - for (std::list<MTri3*>::iterator it = cavity.begin(); it != cavity.end(); it++){ - if (*it == t2->getNeigh(i))found = true; + for(std::list<MTri3*>::iterator it = cavity.begin(); it != cavity.end(); it++){ + if(*it == t2->getNeigh(i))found = true; } - if (!found) cavity.push_back(t2->getNeigh(i)); + if(!found) cavity.push_back(t2->getNeigh(i)); } } double lc1 = 0.3333333333 * (vSizes[t1b->getVertex(0)->getIndex()] + @@ -562,8 +562,8 @@ void computeNeighboringTrisOfACavity(const std::vector<MTri3*> &cavity, std::vector<MTri3*> &outside) { outside.clear(); - for (unsigned int i = 0; i < cavity.size(); i++){ - for (int j = 0; j < 3; j++){ + for(unsigned int i = 0; i < cavity.size(); i++){ + for(int j = 0; j < 3; j++){ MTri3 * neigh = cavity[i]->getNeigh(j); if(neigh){ bool found = false; @@ -574,7 +574,7 @@ void computeNeighboringTrisOfACavity(const std::vector<MTri3*> &cavity, } } if(!found){ - for (unsigned int k = 0; k < cavity.size(); k++){ + for(unsigned int k = 0; k < cavity.size(); k++){ if(cavity[k] == neigh){ found = true; } @@ -601,25 +601,25 @@ bool gmshBuildVertexCavity(MTri3 *t, int iLocalVertex, MVertex **v1, while (1){ int iEdge = -1; - for (int i = 0; i < 3; i++){ + for(int i = 0; i < 3; i++){ MVertex *v2 = t->tri()->getVertex((i + 2) % 3); MVertex *v3 = t->tri()->getVertex(i); - if ((v2 == *v1 && v3 == lastinring) || + if((v2 == *v1 && v3 == lastinring) || (v2 == lastinring && v3 == *v1)){ iEdge = i; t = t->getNeigh(i); - if (t == cavity[0]) { + if(t == cavity[0]) { computeNeighboringTrisOfACavity(cavity, outside); return true; } - if (!t) return false; - if (t->isDeleted()){ + if(!t) return false; + if(t->isDeleted()){ Msg::Error("Impossible to build vertex cavity"); return false; } cavity.push_back(t); - for (int j = 0; j < 3; j++){ - if (t->tri()->getVertex(j) !=lastinring && t->tri()->getVertex(j) != *v1){ + for(int j = 0; j < 3; j++){ + if(t->tri()->getVertex(j) !=lastinring && t->tri()->getVertex(j) != *v1){ lastinring = t->tri()->getVertex(j); ring.push_back(lastinring); j = 100; @@ -628,7 +628,7 @@ bool gmshBuildVertexCavity(MTri3 *t, int iLocalVertex, MVertex **v1, break; } } - if (iEdge == -1) { + if(iEdge == -1) { Msg::Error("Impossible to build vertex cavity"); return false; } @@ -645,13 +645,13 @@ bool gmshVertexCollapse(const double lMin, MTri3 *t1, GFace *gf, std::vector<MTri3*> outside; std::vector<MVertex*> ring; - if (!gmshBuildVertexCavity(t1, iLocalVertex, &v, cavity, outside, ring)) return false; + if(!gmshBuildVertexCavity(t1, iLocalVertex, &v, cavity, outside, ring)) return false; double l_min = lMin; int iMin = -1; - for (unsigned int i = 0; i < ring.size(); i++){ + for(unsigned int i = 0; i < ring.size(); i++){ double l = computeEdgeAdimLength(v, ring[i], gf, Us, Vs, vSizes, vSizesBGM); - if (l < l_min){ + if(l < l_min){ iMin = i; } } @@ -698,22 +698,22 @@ bool gmshVertexCollapse(const double lMin, MTri3 *t1, GFace *gf, return true; } -int edgeSwapPass (GFace *gf, std::set<MTri3*, compareTri3Ptr> &allTris, - const gmshSwapCriterion &cr, - const std::vector<double> &Us, const std::vector<double> &Vs, - const std::vector<double> &vSizes, const std::vector<double> &vSizesBGM) +int edgeSwapPass(GFace *gf, std::set<MTri3*, compareTri3Ptr> &allTris, + const gmshSwapCriterion &cr, + const std::vector<double> &Us, const std::vector<double> &Vs, + const std::vector<double> &vSizes, const std::vector<double> &vSizesBGM) { typedef std::set<MTri3*, compareTri3Ptr> CONTAINER; int nbSwapTot = 0; std::set<swapquad> configs; - for (int iter = 0; iter < 1200; iter++){ + for(int iter = 0; iter < 1200; iter++){ int nbSwap = 0; std::vector<MTri3*> newTris; - for (CONTAINER::iterator it = allTris.begin(); it != allTris.end(); ++it){ - if (!(*it)->isDeleted()){ - for (int i = 0; i < 3; i++){ - if (gmshEdgeSwap(configs, *it, gf, i, newTris, cr, Us, Vs, vSizes, vSizesBGM)){ + for(CONTAINER::iterator it = allTris.begin(); it != allTris.end(); ++it){ + if(!(*it)->isDeleted()){ + for(int i = 0; i < 3; i++){ + if(gmshEdgeSwap(configs, *it, gf, i, newTris, cr, Us, Vs, vSizes, vSizesBGM)){ nbSwap++; break; } @@ -724,12 +724,12 @@ int edgeSwapPass (GFace *gf, std::set<MTri3*, compareTri3Ptr> &allTris, CONTAINER::iterator itb = it; ++it; allTris.erase(itb); - if (it == allTris.end()) break; + if(it == allTris.end()) break; } } allTris.insert(newTris.begin(), newTris.end()); nbSwapTot += nbSwap; - if (nbSwap == 0) break; + if(nbSwap == 0) break; } return nbSwapTot; } @@ -744,10 +744,10 @@ int edgeSplitPass(double maxLC, GFace *gf, std::set<MTri3*,compareTri3Ptr> &allT int nbSplit = 0; - for (CONTAINER::iterator it = allTris.begin(); it != allTris.end(); ++it){ - if (!(*it)->isDeleted()){ - for (int i = 0; i < 3; i++){ - if (gmshEdgeSplit(maxLC, *it, gf, i, newTris, cr, Us, Vs, vSizes, vSizesBGM)) { + for(CONTAINER::iterator it = allTris.begin(); it != allTris.end(); ++it){ + if(!(*it)->isDeleted()){ + for(int i = 0; i < 3; i++){ + if(gmshEdgeSplit(maxLC, *it, gf, i, newTris, cr, Us, Vs, vSizes, vSizesBGM)) { nbSplit++; break; } @@ -758,7 +758,7 @@ int edgeSplitPass(double maxLC, GFace *gf, std::set<MTri3*,compareTri3Ptr> &allT delete *it; ++it; allTris.erase(itb); - if (it == allTris.end()) break; + if(it == allTris.end()) break; } } printf("B %d %d tris ", (int)allTris.size(), (int)newTris.size()); @@ -776,10 +776,10 @@ int edgeCollapsePass(double minLC, GFace *gf, std::set<MTri3*,compareTri3Ptr> &a int nbCollapse = 0; - for (CONTAINER::reverse_iterator it = allTris.rbegin(); it != allTris.rend(); ++it){ - if (!(*it)->isDeleted()){ - for (int i = 0; i < 3; i++){ - if (gmshVertexCollapse(minLC, *it, gf, i, newTris, Us, Vs, vSizes, vSizesBGM)) { + for(CONTAINER::reverse_iterator it = allTris.rbegin(); it != allTris.rend(); ++it){ + if(!(*it)->isDeleted()){ + for(int i = 0; i < 3; i++){ + if(gmshVertexCollapse(minLC, *it, gf, i, newTris, Us, Vs, vSizes, vSizesBGM)) { nbCollapse++; break; } @@ -790,9 +790,9 @@ int edgeCollapsePass(double minLC, GFace *gf, std::set<MTri3*,compareTri3Ptr> &a // delete *it; // ++it; // allTris.rerase(itb); -// if (it == allTris.rend())break; +// if(it == allTris.rend())break; // } -// if (nbCollapse == 114)break; +// if(nbCollapse == 114)break; } printf("B %d %d tris ", (int)allTris.size(), (int)newTris.size()); allTris.insert(newTris.begin(),newTris.end()); @@ -813,12 +813,12 @@ struct RecombineTriangle n1 = me.getVertex(0); n2 = me.getVertex(1); - if (t1->getVertex(0) != n1 && t1->getVertex(0) != n2) n3 = t1->getVertex(0); - else if (t1->getVertex(1) != n1 && t1->getVertex(1) != n2) n3 = t1->getVertex(1); - else if (t1->getVertex(2) != n1 && t1->getVertex(2) != n2) n3 = t1->getVertex(2); - if (t2->getVertex(0) != n1 && t2->getVertex(0) != n2) n4 = t2->getVertex(0); - else if (t2->getVertex(1) != n1 && t2->getVertex(1) != n2) n4 = t2->getVertex(1); - else if (t2->getVertex(2) != n1 && t2->getVertex(2) != n2) n4 = t2->getVertex(2); + if(t1->getVertex(0) != n1 && t1->getVertex(0) != n2) n3 = t1->getVertex(0); + else if(t1->getVertex(1) != n1 && t1->getVertex(1) != n2) n3 = t1->getVertex(1); + else if(t1->getVertex(2) != n1 && t1->getVertex(2) != n2) n3 = t1->getVertex(2); + if(t2->getVertex(0) != n1 && t2->getVertex(0) != n2) n4 = t2->getVertex(0); + else if(t2->getVertex(1) != n1 && t2->getVertex(1) != n2) n4 = t2->getVertex(1); + else if(t2->getVertex(2) != n1 && t2->getVertex(2) != n2) n4 = t2->getVertex(2); double a1 = 180 * angle3Points(n1, n4, n2) / M_PI; double a2 = 180 * angle3Points(n4, n2, n3) / M_PI; @@ -858,8 +858,8 @@ static void _gmshRecombineIntoQuads(GFace *gf) buildEdgeToElement(gf->triangles, adj); std::set<RecombineTriangle> pairs; - for (e2t_cont::iterator it = adj.begin(); it!= adj.end(); ++it){ - if (it->second.second && + for(e2t_cont::iterator it = adj.begin(); it!= adj.end(); ++it){ + if(it->second.second && it->second.first->getNumVertices() == 3 && it->second.second->getNumVertices() == 3 && (emb_edgeverts.find(it->first.getVertex(0)) == emb_edgeverts.end() || @@ -877,7 +877,7 @@ static void _gmshRecombineIntoQuads(GFace *gf) if(itp->angle < gf->meshAttributes.recombineAngle){ MElement *t1 = itp->t1; MElement *t2 = itp->t2; - if (touched.find(t1) == touched.end() && + if(touched.find(t1) == touched.end() && touched.find(t2) == touched.end()){ touched.insert(t1); touched.insert(t2); @@ -904,8 +904,8 @@ static void _gmshRecombineIntoQuads(GFace *gf) } std::vector<MTriangle*> triangles2; - for (unsigned int i = 0; i < gf->triangles.size(); i++){ - if (touched.find(gf->triangles[i]) == touched.end()){ + for(unsigned int i = 0; i < gf->triangles.size(); i++){ + if(touched.find(gf->triangles[i]) == touched.end()){ triangles2.push_back(gf->triangles[i]); } else { diff --git a/Mesh/meshGRegion.cpp b/Mesh/meshGRegion.cpp index 4e3b8fa0b6..f0fd73a19b 100644 --- a/Mesh/meshGRegion.cpp +++ b/Mesh/meshGRegion.cpp @@ -54,12 +54,12 @@ void buildTetgenStructure(GRegion *gr, tetgenio &in, std::vector<MVertex*> &numb in.pointlist = new REAL[in.numberofpoints * 3]; in.pointmarkerlist = NULL; - std::set<MVertex*>::iterator itv = allBoundingVertices.begin(); + std::set<MVertex*>::iterator itv = allBoundingVertices.begin(); int I = 1; while(itv != allBoundingVertices.end()){ - in.pointlist[(I-1)*3 + 0] = (*itv)->x(); - in.pointlist[(I-1)*3 + 1] = (*itv)->y(); - in.pointlist[(I-1)*3 + 2] = (*itv)->z(); + in.pointlist[(I - 1) * 3 + 0] = (*itv)->x(); + in.pointlist[(I - 1) * 3 + 1] = (*itv)->y(); + in.pointlist[(I - 1) * 3 + 2] = (*itv)->z(); (*itv)->setIndex(I++); numberedV.push_back(*itv); ++itv; @@ -106,11 +106,10 @@ void buildTetgenStructure(GRegion *gr, tetgenio &in, std::vector<MVertex*> &numb void TransferTetgenMesh(GRegion *gr, tetgenio &in, tetgenio &out, std::vector<MVertex*> &numberedV) { - // Improvement has to be done here : - // tetgen splits some of the existing edges of the - // mesh. If those edges are classified on some - // model faces, new points SHOULD be classified - // on the model face and get the right set of parametric coordinates. + // improvement has to be done here : tetgen splits some of the + // existing edges of the mesh. If those edges are classified on some + // model faces, new points SHOULD be classified on the model face + // and get the right set of parametric coordinates. for(int i = numberedV.size(); i < out.numberofpoints; i++){ MVertex *v = new MVertex(out.pointlist[i * 3 + 0], @@ -148,7 +147,7 @@ void TransferTetgenMesh(GRegion *gr, tetgenio &in, tetgenio &out, // re-create the triangular meshes FIXME: this can lead to hanging // nodes for non manifold geometries (single surface connected to // volume) - for (int i = 0; i < out.numberoftrifaces; i++){ + for(int i = 0; i < out.numberoftrifaces; i++){ MVertex *v[3]; v[0] = numberedV[out.trifacelist[i * 3 + 0] - 1]; v[1] = numberedV[out.trifacelist[i * 3 + 1] - 1]; @@ -169,7 +168,7 @@ void TransferTetgenMesh(GRegion *gr, tetgenio &in, tetgenio &out, guess[1] += vv; Count++; } - else if (v[j]->onWhat()->dim() == 1){ + else if(v[j]->onWhat()->dim() == 1){ GEdge *ge = (GEdge*)v[j]->onWhat(); double UU; v[j]->getParameter(0, UU); @@ -179,7 +178,7 @@ void TransferTetgenMesh(GRegion *gr, tetgenio &in, tetgenio &out, guess[1] += param.y(); Count++; } - else if (v[j]->onWhat()->dim() == 0){ + else if(v[j]->onWhat()->dim() == 0){ SPoint2 param; GVertex *gv = (GVertex*)v[j]->onWhat(); param = gv->reparamOnFace(gf,1); @@ -188,7 +187,7 @@ void TransferTetgenMesh(GRegion *gr, tetgenio &in, tetgenio &out, Count++; } } - if (Count != 0){ + if(Count != 0){ guess[0] /= Count; guess[1] /= Count; } @@ -200,13 +199,13 @@ void TransferTetgenMesh(GRegion *gr, tetgenio &in, tetgenio &out, v[j]->onWhat()->mesh_vertices.end(), v[j])); MVertex *v1b; - if (CTX::instance()->mesh.order > 1 && - CTX::instance()->mesh.secondOrderExperimental){ + if(CTX::instance()->mesh.order > 1 && + CTX::instance()->mesh.secondOrderExperimental){ // parametric coordinates should be set for the vertex ! // (this is not 100 % safe yet, so we reserve that operation // for high order meshes) GPoint gp = gf->closestPoint(SPoint3(v[j]->x(), v[j]->y(), v[j]->z()),guess); - if (gp.g()){ + if(gp.g()){ v1b = new MFaceVertex(gp.x(), gp.y(), gp.z(), gf, gp.u(), gp.v()); } else{ @@ -284,7 +283,7 @@ void MeshDelaunayVolume(std::vector<GRegion*> ®ions) try{ tetrahedralize(opts, &in, &out); Msg::Info("%d faces self-intersect", out.numberoftrifaces); - for (int i = 0; i < out.numberoftrifaces; i++){ + for(int i = 0; i < out.numberoftrifaces; i++){ Msg::Info("face (%d %d %d) on model face %d", numberedV[out.trifacelist[i * 3 + 0] - 1]->getNum(), numberedV[out.trifacelist[i * 3 + 1] - 1]->getNum(), @@ -435,7 +434,7 @@ void deMeshGRegion::operator() (GRegion *gr) } int intersect_line_triangle(double X[3], double Y[3], double Z[3] , - double P[3], double N[3] ) + double P[3], double N[3]) { double mat[3][3], det; double b[3], res[3]; @@ -480,7 +479,7 @@ int intersect_line_triangle(double X[3], double Y[3], double Z[3] , void setRand(double r[6]) { - for (int i=0;i<6;i++) + for(int i = 0; i < 6; i++) r[i] = 0.0001 * ((double)rand() / (double)RAND_MAX); } @@ -500,9 +499,11 @@ void meshNormalsPointOutOfTheRegion(GRegion *gr) double X[3] = {t->getVertex(0)->x(), t->getVertex(1)->x(), t->getVertex(2)->x()}; double Y[3] = {t->getVertex(0)->y(), t->getVertex(1)->y(), t->getVertex(2)->y()}; double Z[3] = {t->getVertex(0)->z(), t->getVertex(1)->z(), t->getVertex(2)->z()}; - double P[3] = {(X[0]+X[1]+X[2])/3., (Y[0]+Y[1]+Y[2])/3., (Z[0]+Z[1]+Z[2])/3.}; - double v1[3] = {X[0]-X[1], Y[0]-Y[1], Z[0]-Z[1]}; - double v2[3] = {X[2]-X[1], Y[2]-Y[1], Z[2]-Z[1]}; + double P[3] = {(X[0] + X[1] + X[2]) / 3., + (Y[0] + Y[1] + Y[2]) / 3., + (Z[0] + Z[1] + Z[2]) / 3.}; + double v1[3] = {X[0] - X[1], Y[0] - Y[1], Z[0] - Z[1]}; + double v2[3] = {X[2] - X[1], Y[2] - Y[1], Z[2] - Z[1]}; double N[3]; prodve(v1, v2, N); norme(v1); @@ -540,7 +541,7 @@ void meshNormalsPointOutOfTheRegion(GRegion *gr) else{ if(nb_intersect % 2 == 1){ // odd nb of intersections: the normal points inside the region - for (unsigned int i = 0; i < gf->triangles.size(); i++){ + for(unsigned int i = 0; i < gf->triangles.size(); i++){ gf->triangles[i]->revert(); } } @@ -577,7 +578,6 @@ void meshGRegion::operator() (GRegion *gr) std::list<GFace*> faces = gr->faces(); - // sanity check for(std::list<GFace*>::iterator it = faces.begin(); it != faces.end(); it++){ if((*it)->quadrangles.size()){ @@ -586,27 +586,22 @@ void meshGRegion::operator() (GRegion *gr) } } - //replace discreteFaces by their compounds - if (gr->geomType() == GEntity::CompoundVolume){ + // replace discreteFaces by their compounds + if(gr->geomType() == GEntity::CompoundVolume){ std::set<GFace*> mySet; std::list<GFace*>::iterator it = faces.begin(); while(it != faces.end()){ - if ((*it)->getCompound()){ + if((*it)->getCompound()) mySet.insert((*it)->getCompound()); - printf("compound face %d found in face %d\n",(*it)->getCompound()->tag(), (*it)->tag()); - } else mySet.insert(*it); ++it; } - printf("replacing %d edges by %d in the GFaceCompound %d\n", - (int)faces.size(), (int)mySet.size(), gr->tag()); faces.clear(); faces.insert(faces.begin(), mySet.begin(), mySet.end()); gr->set(faces); } - std::list<GFace*> myface = gr->faces(); if(CTX::instance()->mesh.algo3d == ALGO_3D_DELAUNAY){ @@ -621,7 +616,7 @@ void meshGRegion::operator() (GRegion *gr) meshNormalsPointOutOfTheRegion(gr); std::vector<MVertex*> numberedV; Ng_Mesh *ngmesh = buildNetgenStructure(gr, false, numberedV); - NgAddOn_GenerateVolumeMesh(ngmesh, CTX::instance()->lc); // does not optimize + NgAddOn_GenerateVolumeMesh(ngmesh, CTX::instance()->lc); TransferVolumeMesh(gr, ngmesh, numberedV); Ng_DeleteMesh(ngmesh); Ng_Exit(); @@ -737,8 +732,8 @@ GEdge *findInEdgeSearchStructure(MVertex *p1, MVertex *p2, const es_cont &search ++it){ MLine *l = it->second.first; GEdge *ge = it->second.second; - if ((l->getVertex(0) == p1 || l->getVertex(0) == p2) && - (l->getVertex(1) == p1 || l->getVertex(1) == p2)) + if((l->getVertex(0) == p1 || l->getVertex(0) == p2) && + (l->getVertex(1) == p1 || l->getVertex(1) == p2)) return ge; } return 0; diff --git a/Numeric/gmshAssembler.h b/Numeric/gmshAssembler.h index fb346bc98c..3a6710ba3b 100644 --- a/Numeric/gmshAssembler.h +++ b/Numeric/gmshAssembler.h @@ -124,20 +124,20 @@ class gmshAssembler { std::map<gmshDofKey, int>::iterator itC = numbering.find(gmshDofKey(vC, iCompC, iFieldC)); typename std::map<gmshDofKey, scalar>::iterator - itFF = fixedFULL.find(gmshDofKey(vR, iCompR, iFieldR)); + itFF = fixedFULL.find(gmshDofKey(vR, iCompR, iFieldR)); if (itC != numbering.end() && itFF == fixedFULL.end()){ lsys->addToMatrix(itR->second, itC->second, val); } else if (itFF != fixedFULL.end()){ - //printf("RHS = %g, ligne=%d \n", itFF->second, itR->second); - lsys->addToMatrix(itR->second,itR->second, 1. ); - lsys->addToRightHandSide(itR->second, itFF->second); + //printf("RHS = %g, ligne=%d \n", itFF->second, itR->second); + lsys->addToMatrix(itR->second,itR->second, 1. ); + lsys->addToRightHandSide(itR->second, itFF->second); } else { typename std::map<gmshDofKey, scalar>::iterator itF = fixed.find(gmshDofKey(vC, iCompC, iFieldC)); if (itF != fixed.end()){ - //printf("RHS = val%g itF=%g \n", val, itF->second); + //printf("RHS = val%g itF=%g \n", val, itF->second); lsys->addToRightHandSide(itR->second, -val*itF->second); } else{ diff --git a/Numeric/gmshLinearSystemCSR.cpp b/Numeric/gmshLinearSystemCSR.cpp index 0e364b437a..d43f678873 100644 --- a/Numeric/gmshLinearSystemCSR.cpp +++ b/Numeric/gmshLinearSystemCSR.cpp @@ -289,11 +289,11 @@ int gmshLinearSystemCSRGmm<double>::systemSolve() { if (!sorted) sortColumns(_b->size(), - CSRList_Nbr(a_), - (INDEX_TYPE *) ptr_->array, - (INDEX_TYPE *) jptr_->array, - (INDEX_TYPE *) ai_->array, - (double*) a_->array); + CSRList_Nbr(a_), + (INDEX_TYPE *) ptr_->array, + (INDEX_TYPE *) jptr_->array, + (INDEX_TYPE *) ai_->array, + (double*) a_->array); sorted = true; gmm::csr_matrix_ref<double*,INDEX_TYPE *,INDEX_TYPE *, 0> @@ -318,11 +318,11 @@ int gmshLinearSystemCSRGmm<double>::checkSystem() { if(!sorted) sortColumns(_b->size(), - CSRList_Nbr(a_), - (INDEX_TYPE *) ptr_->array, - (INDEX_TYPE *) jptr_->array, - (INDEX_TYPE *) ai_->array, - (double*) a_->array); + CSRList_Nbr(a_), + (INDEX_TYPE *) ptr_->array, + (INDEX_TYPE *) jptr_->array, + (INDEX_TYPE *) ai_->array, + (double*) a_->array); sorted = true; printf("Coucou check system \n"); @@ -341,11 +341,11 @@ int gmshLinearSystemCSRTaucs<double>::systemSolve() { if(!sorted) sortColumns(_b->size(), - CSRList_Nbr(a_), - (INDEX_TYPE *) ptr_->array, - (INDEX_TYPE *) jptr_->array, - (INDEX_TYPE *) ai_->array, - (double*) a_->array); + CSRList_Nbr(a_), + (INDEX_TYPE *) ptr_->array, + (INDEX_TYPE *) jptr_->array, + (INDEX_TYPE *) ai_->array, + (double*) a_->array); sorted = true; taucs_ccs_matrix myVeryCuteTaucsMatrix; diff --git a/Numeric/gmshLinearSystemFull.h b/Numeric/gmshLinearSystemFull.h index 269bfeda5e..ef3fda9a83 100644 --- a/Numeric/gmshLinearSystemFull.h +++ b/Numeric/gmshLinearSystemFull.h @@ -85,20 +85,20 @@ class gmshLinearSystemFull : public gmshLinearSystem<scalar> { bool convex = true; std::set<int> Ni; for(int j = 0; j < _b->size(); j++){ - if ( (j !=i) && (*_a)(i, j) > 0.0 ) convex = false; - if ( j !=i && (*_a)(i, j) != 0.0){ - offDiag += (*_a)(i, j); - Ni.insert(j); - } + if ( (j !=i) && (*_a)(i, j) > 0.0 ) convex = false; + if ( j !=i && (*_a)(i, j) != 0.0){ + offDiag += (*_a)(i, j); + Ni.insert(j); + } } if (fabs(offDiag+diag) > 1.e-10 && fabs(offDiag) > 1.e-10 ) convex= false; if (convex == false){ - nbNonConvex+=1; - printf("*** WARNING NON CONVEX LINE !!!!!\n"); - printf("*** i=%d : diag=%g offDiag=%g diff=%g convex=%s size Ni=%d\n", i , diag, offDiag, fabs(offDiag+diag), (convex)?"true":"false", Ni.size()); - for (std::set<int>::iterator it = Ni.begin(); it != Ni.end(); ++it) (*_a)(i, *it) = -1.0; - (*_a)(i, i) = Ni.size(); + nbNonConvex+=1; + printf("*** WARNING NON CONVEX LINE !!!!!\n"); + printf("*** i=%d : diag=%g offDiag=%g diff=%g convex=%s size Ni=%d\n", i , diag, offDiag, fabs(offDiag+diag), (convex)?"true":"false", Ni.size()); + for (std::set<int>::iterator it = Ni.begin(); it != Ni.end(); ++it) (*_a)(i, *it) = -1.0; + (*_a)(i, i) = Ni.size(); } } diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp index 5c9b9a5e97..303bc545d9 100644 --- a/Parser/Gmsh.tab.cpp +++ b/Parser/Gmsh.tab.cpp @@ -434,7 +434,7 @@ typedef union YYSTYPE } /* Line 193 of yacc.c. */ #line 437 "Gmsh.tab.cpp" - YYSTYPE; + YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -578,7 +578,7 @@ YYID (i) # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 @@ -604,7 +604,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc @@ -629,13 +629,13 @@ union yyalloc # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ while (YYID (0)) # endif # endif @@ -645,15 +645,15 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ while (YYID (0)) #endif @@ -676,7 +676,7 @@ union yyalloc #define YYUNDEFTOK 2 #define YYMAXUTOK 380 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ @@ -3040,44 +3040,44 @@ static const yytype_uint8 yystos[] = 6, 6, 6, 223, 6 }; -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ -#define YYFAIL goto yyerrlab +#define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ + YYERROR; \ + } \ while (YYID (0)) -#define YYTERROR 1 -#define YYERRCODE 256 +#define YYTERROR 1 +#define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. @@ -3086,22 +3086,22 @@ while (YYID (0)) #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ while (YYID (0)) #endif @@ -3112,10 +3112,10 @@ while (YYID (0)) #ifndef YY_LOCATION_PRINT # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif @@ -3138,21 +3138,21 @@ while (YYID (0)) # define YYFPRINTF fprintf # endif -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ } while (YYID (0)) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ } while (YYID (0)) @@ -3184,7 +3184,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) switch (yytype) { default: - break; + break; } } @@ -3236,10 +3236,10 @@ yy_stack_print (bottom, top) YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) @@ -3262,21 +3262,21 @@ yy_reduce_print (yyvsp, yyrule) int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); + yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); fprintf (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) @@ -3292,7 +3292,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -3379,27 +3379,27 @@ yytnamerr (char *yyres, const char *yystr) char const *yyp = yystr; for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } do_not_strip_quotes: ; } @@ -3437,7 +3437,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar) # if 0 /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ + constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); @@ -3450,13 +3450,13 @@ yysyntax_error (char *yyresult, int yystate, int yychar) static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ + YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ @@ -3468,22 +3468,22 @@ yysyntax_error (char *yyresult, int yystate, int yychar) yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); @@ -3491,29 +3491,29 @@ yysyntax_error (char *yyresult, int yystate, int yychar) yysize = yysize1; if (yysize_overflow) - return YYSIZE_MAXIMUM; + return YYSIZE_MAXIMUM; if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } return yysize; } } @@ -3547,7 +3547,7 @@ yydestruct (yymsg, yytype, yyvaluep) { default: - break; + break; } } @@ -3660,7 +3660,7 @@ yyparse () yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack @@ -3690,25 +3690,25 @@ yyparse () #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); + &yystacksize); - yyss = yyss1; - yyvs = yyvs1; + yyss = yyss1; + yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE @@ -3716,23 +3716,23 @@ yyparse () # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ @@ -3742,10 +3742,10 @@ yyparse () YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); @@ -3794,7 +3794,7 @@ yybackup: if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; + goto yyerrlab; yyn = -yyn; goto yyreduce; } @@ -3960,11 +3960,11 @@ yyreduce: FixRelativePath((yyvsp[(6) - (7)].c), tmpstring); FILE *fp = fopen(tmpstring, (yyvsp[(5) - (7)].c)); if(!fp){ - yymsg(0, "Unable to open file '%s'", tmpstring); + yymsg(0, "Unable to open file '%s'", tmpstring); } else{ - fprintf(fp, "%s\n", (yyvsp[(3) - (7)].c)); - fclose(fp); + fprintf(fp, "%s\n", (yyvsp[(3) - (7)].c)); + fclose(fp); } Free((yyvsp[(3) - (7)].c)); Free((yyvsp[(6) - (7)].c)); @@ -3977,11 +3977,11 @@ yyreduce: char tmpstring[1024]; int i = PrintListOfDouble((yyvsp[(3) - (7)].c), (yyvsp[(5) - (7)].l), tmpstring); if(i < 0) - yymsg(0, "Too few arguments in Printf"); + yymsg(0, "Too few arguments in Printf"); else if(i > 0) - yymsg(0, "%d extra argument%s in Printf", i, (i > 1) ? "s" : ""); + yymsg(0, "%d extra argument%s in Printf", i, (i > 1) ? "s" : ""); else - Msg::Direct(tmpstring); + Msg::Direct(tmpstring); Free((yyvsp[(3) - (7)].c)); List_Delete((yyvsp[(5) - (7)].l)); ;} @@ -3993,20 +3993,20 @@ yyreduce: char tmpstring[1024]; int i = PrintListOfDouble((yyvsp[(3) - (9)].c), (yyvsp[(5) - (9)].l), tmpstring); if(i < 0) - yymsg(0, "Too few arguments in Printf"); + yymsg(0, "Too few arguments in Printf"); else if(i > 0) - yymsg(0, "%d extra argument%s in Printf", i, (i > 1) ? "s" : ""); + yymsg(0, "%d extra argument%s in Printf", i, (i > 1) ? "s" : ""); else{ - char tmpstring2[1024]; - 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); - } + char tmpstring2[1024]; + 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); + } } Free((yyvsp[(3) - (9)].c)); Free((yyvsp[(8) - (9)].c)); @@ -4019,13 +4019,13 @@ yyreduce: { #if !defined(HAVE_NO_POST) if(!strcmp((yyvsp[(1) - (6)].c), "View") && ViewData->finalize()){ - ViewData->setName((yyvsp[(2) - (6)].c)); - ViewData->setFileName(gmsh_yyname); - ViewData->setFileIndex(gmsh_yyviewindex++); - new PView(ViewData); + ViewData->setName((yyvsp[(2) - (6)].c)); + ViewData->setFileName(gmsh_yyname); + ViewData->setFileIndex(gmsh_yyviewindex++); + new PView(ViewData); } else - delete ViewData; + delete ViewData; #endif Free((yyvsp[(1) - (6)].c)); Free((yyvsp[(2) - (6)].c)); ;} @@ -4036,9 +4036,9 @@ yyreduce: { #if !defined(HAVE_NO_POST) if(!strcmp((yyvsp[(2) - (6)].c), "View")){ - int index = (int)(yyvsp[(4) - (6)].d); - if(index >= 0 && index < (int)PView::list.size()) - new PView(PView::list[index], false); + int index = (int)(yyvsp[(4) - (6)].d); + if(index >= 0 && index < (int)PView::list.size()) + new PView(PView::list[index], false); } #endif Free((yyvsp[(2) - (6)].c)); @@ -4050,9 +4050,9 @@ yyreduce: { #if !defined(HAVE_NO_POST) if(!strcmp((yyvsp[(2) - (6)].c), "View")){ - int index = (int)(yyvsp[(4) - (6)].d); - if(index >= 0 && index < (int)PView::list.size()) - new PView(PView::list[index], true); + int index = (int)(yyvsp[(4) - (6)].d); + if(index >= 0 && index < (int)PView::list.size()) + new PView(PView::list[index], true); } #endif Free((yyvsp[(2) - (6)].c)); @@ -4093,101 +4093,101 @@ yyreduce: { #if !defined(HAVE_NO_POST) if(!strncmp((yyvsp[(1) - (1)].c), "SP", 2)){ - ViewValueList = &ViewData->SP; ViewNumList = &ViewData->NbSP; + ViewValueList = &ViewData->SP; ViewNumList = &ViewData->NbSP; } else if(!strncmp((yyvsp[(1) - (1)].c), "VP", 2)){ - ViewValueList = &ViewData->VP; ViewNumList = &ViewData->NbVP; + ViewValueList = &ViewData->VP; ViewNumList = &ViewData->NbVP; } else if(!strncmp((yyvsp[(1) - (1)].c), "TP", 2)){ - ViewValueList = &ViewData->TP; ViewNumList = &ViewData->NbTP; + ViewValueList = &ViewData->TP; ViewNumList = &ViewData->NbTP; } else if(!strncmp((yyvsp[(1) - (1)].c), "SL", 2)){ - ViewValueList = &ViewData->SL; ViewNumList = &ViewData->NbSL; + ViewValueList = &ViewData->SL; ViewNumList = &ViewData->NbSL; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_LIN); } else if(!strncmp((yyvsp[(1) - (1)].c), "VL", 2)){ - ViewValueList = &ViewData->VL; ViewNumList = &ViewData->NbVL; + ViewValueList = &ViewData->VL; ViewNumList = &ViewData->NbVL; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_LIN); } else if(!strncmp((yyvsp[(1) - (1)].c), "TL", 2)){ - ViewValueList = &ViewData->TL; ViewNumList = &ViewData->NbTL; + ViewValueList = &ViewData->TL; ViewNumList = &ViewData->NbTL; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_LIN); } else if(!strncmp((yyvsp[(1) - (1)].c), "ST", 2)){ - ViewValueList = &ViewData->ST; ViewNumList = &ViewData->NbST; + ViewValueList = &ViewData->ST; ViewNumList = &ViewData->NbST; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TRI); } else if(!strncmp((yyvsp[(1) - (1)].c), "VT", 2)){ - ViewValueList = &ViewData->VT; ViewNumList = &ViewData->NbVT; + ViewValueList = &ViewData->VT; ViewNumList = &ViewData->NbVT; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TRI); } else if(!strncmp((yyvsp[(1) - (1)].c), "TT", 2)){ - ViewValueList = &ViewData->TT; ViewNumList = &ViewData->NbTT; + ViewValueList = &ViewData->TT; ViewNumList = &ViewData->NbTT; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TRI); } else if(!strncmp((yyvsp[(1) - (1)].c), "SQ", 2)){ - ViewValueList = &ViewData->SQ; ViewNumList = &ViewData->NbSQ; + ViewValueList = &ViewData->SQ; ViewNumList = &ViewData->NbSQ; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_QUA); } else if(!strncmp((yyvsp[(1) - (1)].c), "VQ", 2)){ - ViewValueList = &ViewData->VQ; ViewNumList = &ViewData->NbVQ; + ViewValueList = &ViewData->VQ; ViewNumList = &ViewData->NbVQ; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_QUA); } else if(!strncmp((yyvsp[(1) - (1)].c), "TQ", 2)){ - ViewValueList = &ViewData->TQ; ViewNumList = &ViewData->NbTQ; + ViewValueList = &ViewData->TQ; ViewNumList = &ViewData->NbTQ; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_QUA); } else if(!strncmp((yyvsp[(1) - (1)].c), "SS", 2)){ - ViewValueList = &ViewData->SS; ViewNumList = &ViewData->NbSS; + ViewValueList = &ViewData->SS; ViewNumList = &ViewData->NbSS; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TET); } else if(!strncmp((yyvsp[(1) - (1)].c), "VS", 2)){ - ViewValueList = &ViewData->VS; ViewNumList = &ViewData->NbVS; + ViewValueList = &ViewData->VS; ViewNumList = &ViewData->NbVS; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TET); } else if(!strncmp((yyvsp[(1) - (1)].c), "TS", 2)){ - ViewValueList = &ViewData->TS; ViewNumList = &ViewData->NbTS; + ViewValueList = &ViewData->TS; ViewNumList = &ViewData->NbTS; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TET); } else if(!strncmp((yyvsp[(1) - (1)].c), "SH", 2)){ - ViewValueList = &ViewData->SH; ViewNumList = &ViewData->NbSH; + ViewValueList = &ViewData->SH; ViewNumList = &ViewData->NbSH; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_HEX); } else if(!strncmp((yyvsp[(1) - (1)].c), "VH", 2)){ - ViewValueList = &ViewData->VH; ViewNumList = &ViewData->NbVH; + ViewValueList = &ViewData->VH; ViewNumList = &ViewData->NbVH; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_HEX); } else if(!strncmp((yyvsp[(1) - (1)].c), "TH", 2)){ - ViewValueList = &ViewData->TH; ViewNumList = &ViewData->NbTH; + ViewValueList = &ViewData->TH; ViewNumList = &ViewData->NbTH; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_HEX); } else if(!strncmp((yyvsp[(1) - (1)].c), "SI", 2)){ - ViewValueList = &ViewData->SI; ViewNumList = &ViewData->NbSI; + ViewValueList = &ViewData->SI; ViewNumList = &ViewData->NbSI; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PRI); } else if(!strncmp((yyvsp[(1) - (1)].c), "VI", 2)){ - ViewValueList = &ViewData->VI; ViewNumList = &ViewData->NbVI; + ViewValueList = &ViewData->VI; ViewNumList = &ViewData->NbVI; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PRI); } else if(!strncmp((yyvsp[(1) - (1)].c), "TI", 2)){ - ViewValueList = &ViewData->TI; ViewNumList = &ViewData->NbTI; + ViewValueList = &ViewData->TI; ViewNumList = &ViewData->NbTI; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PRI); } else if(!strncmp((yyvsp[(1) - (1)].c), "SY", 2)){ - ViewValueList = &ViewData->SY; ViewNumList = &ViewData->NbSY; + ViewValueList = &ViewData->SY; ViewNumList = &ViewData->NbSY; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PYR); } else if(!strncmp((yyvsp[(1) - (1)].c), "VY", 2)){ - ViewValueList = &ViewData->VY; ViewNumList = &ViewData->NbVY; + ViewValueList = &ViewData->VY; ViewNumList = &ViewData->NbVY; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PYR); } else if(!strncmp((yyvsp[(1) - (1)].c), "TY", 2)){ - ViewValueList = &ViewData->TY; ViewNumList = &ViewData->NbTY; + ViewValueList = &ViewData->TY; ViewNumList = &ViewData->NbTY; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PYR); } else{ - yymsg(0, "Unknown element type '%s'", (yyvsp[(1) - (1)].c)); - ViewValueList = 0; ViewNumList = 0; + yymsg(0, "Unknown element type '%s'", (yyvsp[(1) - (1)].c)); + ViewValueList = 0; ViewNumList = 0; } #endif ViewCoord.clear(); @@ -4200,9 +4200,9 @@ yyreduce: { #if !defined(HAVE_NO_POST) if(ViewValueList){ - for(int i = 0; i < 3; i++) - for(unsigned int j = 0; j < ViewCoord.size() / 3; j++) - ViewValueList->push_back(ViewCoord[3 * j + i]); + for(int i = 0; i < 3; i++) + for(unsigned int j = 0; j < ViewCoord.size() / 3; j++) + ViewValueList->push_back(ViewCoord[3 * j + i]); } #endif ;} @@ -4303,14 +4303,14 @@ yyreduce: { #if !defined(HAVE_NO_POST) int type = - (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->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))); #endif @@ -4322,12 +4322,12 @@ yyreduce: { #if !defined(HAVE_NO_POST) int type = - (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->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)), @@ -4390,22 +4390,22 @@ yyreduce: #line 574 "Gmsh.y" { if(!gmsh_yysymbols.count((yyvsp[(1) - (4)].c))){ - 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)); + 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)); } else{ - 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; - } + 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)); ;} @@ -4416,26 +4416,26 @@ yyreduce: { int index = (int)(yyvsp[(3) - (7)].d); if(!gmsh_yysymbols.count((yyvsp[(1) - (7)].c))){ - 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)); + 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)); } else{ - 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; - } + 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)); ;} @@ -4445,38 +4445,38 @@ yyreduce: #line 623 "Gmsh.y" { if(List_Nbr((yyvsp[(4) - (9)].l)) != List_Nbr((yyvsp[(8) - (9)].l))){ - yymsg(0, "Incompatible array dimensions in affectation"); + yymsg(0, "Incompatible array dimensions in affectation"); } else{ - 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; - } - } - } + 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)); List_Delete((yyvsp[(4) - (9)].l)); @@ -4488,7 +4488,7 @@ yyreduce: #line 663 "Gmsh.y" { if(gmsh_yysymbols.count((yyvsp[(1) - (6)].c))) - gmsh_yysymbols[(yyvsp[(1) - (6)].c)].clear(); + 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)); @@ -4502,7 +4502,7 @@ yyreduce: { // appends to the list 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)); + gmsh_yysymbols[(yyvsp[(1) - (6)].c)].push_back(*(double*)List_Pointer((yyvsp[(5) - (6)].l), i)); Free((yyvsp[(1) - (6)].c)); List_Delete((yyvsp[(5) - (6)].l)); ;} @@ -4512,9 +4512,9 @@ yyreduce: #line 681 "Gmsh.y" { if(!gmsh_yysymbols.count((yyvsp[(1) - (3)].c))) - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (3)].c)); + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (3)].c)); else - gmsh_yysymbols[(yyvsp[(1) - (3)].c)][0] += (yyvsp[(2) - (3)].i); + gmsh_yysymbols[(yyvsp[(1) - (3)].c)][0] += (yyvsp[(2) - (3)].i); Free((yyvsp[(1) - (3)].c)); ;} break; @@ -4523,12 +4523,12 @@ yyreduce: #line 689 "Gmsh.y" { if(!gmsh_yysymbols.count((yyvsp[(1) - (6)].c))) - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (6)].c)); + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (6)].c)); else{ - 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); + 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); } Free((yyvsp[(1) - (6)].c)); ;} @@ -4566,17 +4566,17 @@ yyreduce: { double d = 0.; if(NumberOption(GMSH_GET, (yyvsp[(1) - (6)].c), 0, (yyvsp[(3) - (6)].c), d)){ - 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); + 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); } Free((yyvsp[(1) - (6)].c)); Free((yyvsp[(3) - (6)].c)); ;} @@ -4587,17 +4587,17 @@ yyreduce: { double d = 0.; if(NumberOption(GMSH_GET, (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), d)){ - 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); + 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); } Free((yyvsp[(1) - (9)].c)); Free((yyvsp[(6) - (9)].c)); ;} @@ -4608,8 +4608,8 @@ yyreduce: { double d = 0.; if(NumberOption(GMSH_GET, (yyvsp[(1) - (5)].c), 0, (yyvsp[(3) - (5)].c), d)){ - d += (yyvsp[(4) - (5)].i); - NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (5)].c), 0, (yyvsp[(3) - (5)].c), d); + d += (yyvsp[(4) - (5)].i); + NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (5)].c), 0, (yyvsp[(3) - (5)].c), d); } Free((yyvsp[(1) - (5)].c)); Free((yyvsp[(3) - (5)].c)); ;} @@ -4620,8 +4620,8 @@ yyreduce: { double d = 0.; if(NumberOption(GMSH_GET, (yyvsp[(1) - (8)].c), (int)(yyvsp[(3) - (8)].d), (yyvsp[(6) - (8)].c), d)){ - d += (yyvsp[(7) - (8)].i); - NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (8)].c), (int)(yyvsp[(3) - (8)].d), (yyvsp[(6) - (8)].c), d); + d += (yyvsp[(7) - (8)].i); + NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (8)].c), (int)(yyvsp[(3) - (8)].d), (yyvsp[(6) - (8)].c), d); } Free((yyvsp[(1) - (8)].c)); Free((yyvsp[(6) - (8)].c)); ;} @@ -4648,18 +4648,18 @@ yyreduce: { GmshColorTable *ct = GetColorTable(0); if(!ct) - yymsg(0, "View[%d] does not exist", 0); + yymsg(0, "View[%d] does not exist", 0); else{ - 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]; - } + 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]; + } } Free((yyvsp[(1) - (6)].c)); List_Delete((yyvsp[(5) - (6)].l)); @@ -4671,18 +4671,18 @@ yyreduce: { GmshColorTable *ct = GetColorTable((int)(yyvsp[(3) - (9)].d)); if(!ct) - yymsg(0, "View[%d] does not exist", (int)(yyvsp[(3) - (9)].d)); + yymsg(0, "View[%d] does not exist", (int)(yyvsp[(3) - (9)].d)); else{ - 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]; - } + 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]; + } } Free((yyvsp[(1) - (9)].c)); List_Delete((yyvsp[(8) - (9)].l)); @@ -4693,9 +4693,9 @@ yyreduce: #line 838 "Gmsh.y" { if(!strcmp((yyvsp[(1) - (5)].c),"Background")) - GModel::current()->getFields()->background_field = (int)(yyvsp[(4) - (5)].d); + GModel::current()->getFields()->background_field = (int)(yyvsp[(4) - (5)].d); else - yymsg(0, "Unknown command %s Field", (yyvsp[(1) - (5)].c)); + yymsg(0, "Unknown command %s Field", (yyvsp[(1) - (5)].c)); ;} break; @@ -4703,7 +4703,7 @@ yyreduce: #line 845 "Gmsh.y" { if(!GModel::current()->getFields()->newField((int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c))) - yymsg(0, "Cannot create field %i of type '%s'", (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c)); + yymsg(0, "Cannot create field %i of type '%s'", (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c)); Free((yyvsp[(6) - (7)].c)); ;} break; @@ -4713,20 +4713,20 @@ yyreduce: { Field *field = GModel::current()->getFields()->get((int)(yyvsp[(3) - (9)].d)); if(field){ - 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()); + 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()); } else - yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (9)].d)); + yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (9)].d)); Free((yyvsp[(6) - (9)].c)); ;} break; @@ -4736,20 +4736,20 @@ yyreduce: { Field *field = GModel::current()->getFields()->get((int)(yyvsp[(3) - (9)].d)); if(field){ - 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()); + 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()); } else - yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (9)].d)); + yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (9)].d)); Free((yyvsp[(6) - (9)].c)); Free((yyvsp[(8) - (9)].c)); ;} @@ -4760,22 +4760,22 @@ yyreduce: { Field *field = GModel::current()->getFields()->get((int)(yyvsp[(3) - (11)].d)); if(field){ - 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()); + 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()); } else - yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (11)].d)); + yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (11)].d)); Free((yyvsp[(6) - (11)].c)); List_Delete((yyvsp[(9) - (11)].l)); ;} @@ -4786,10 +4786,10 @@ yyreduce: { #if !defined(HAVE_NO_POST) try { - PluginManager::instance()->setPluginOption((yyvsp[(3) - (9)].c), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].d)); + PluginManager::instance()->setPluginOption((yyvsp[(3) - (9)].c), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].d)); } catch (...) { - yymsg(0, "Unknown option '%s' or plugin '%s'", (yyvsp[(6) - (9)].c), (yyvsp[(3) - (9)].c)); + yymsg(0, "Unknown option '%s' or plugin '%s'", (yyvsp[(6) - (9)].c), (yyvsp[(3) - (9)].c)); } #endif Free((yyvsp[(3) - (9)].c)); Free((yyvsp[(6) - (9)].c)); @@ -4801,10 +4801,10 @@ yyreduce: { #if !defined(HAVE_NO_POST) try { - PluginManager::instance()->setPluginOption((yyvsp[(3) - (9)].c), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].c)); + PluginManager::instance()->setPluginOption((yyvsp[(3) - (9)].c), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].c)); } catch (...) { - yymsg(0, "Unknown option '%s' or plugin '%s'", (yyvsp[(6) - (9)].c), (yyvsp[(3) - (9)].c)); + yymsg(0, "Unknown option '%s' or plugin '%s'", (yyvsp[(6) - (9)].c), (yyvsp[(3) - (9)].c)); } #endif Free((yyvsp[(3) - (9)].c)); Free((yyvsp[(6) - (9)].c)); Free((yyvsp[(8) - (9)].c)); @@ -4841,9 +4841,9 @@ yyreduce: (yyval.l) = List_Create(1, 1, sizeof(Vertex*)); Vertex *v = FindPoint((int)(yyvsp[(4) - (5)].d)); if(!v) - yymsg(0, "Unknown point %d", (int)(yyvsp[(4) - (5)].d)); + yymsg(0, "Unknown point %d", (int)(yyvsp[(4) - (5)].d)); else{ - List_Add((yyval.l), &v); + List_Add((yyval.l), &v); } ;} break; @@ -4867,21 +4867,21 @@ yyreduce: { int num = (int)(yyvsp[(3) - (7)].d); if(FindPoint(num)){ - yymsg(0, "Point %d already exists", num); + yymsg(0, "Point %d already exists", num); } else{ - 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); + 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); } (yyval.s).Type = MSH_POINT; (yyval.s).Num = num; @@ -4900,13 +4900,13 @@ yyreduce: { int num = (int)(yyvsp[(5) - (9)].i); if(FindPhysicalGroup(num, MSH_PHYSICAL_POINT)){ - yymsg(0, "Physical point %d already exists", num); + yymsg(0, "Physical point %d already exists", num); } else{ - 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); + 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); } List_Delete((yyvsp[(8) - (9)].l)); (yyval.s).Type = MSH_PHYSICAL_POINT; @@ -4918,16 +4918,16 @@ yyreduce: #line 1034 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(3) - (6)].l)); i++){ - 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)); - } + 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)); + } } List_Delete((yyvsp[(3) - (6)].l)); // dummy values @@ -4941,15 +4941,15 @@ yyreduce: { int num = (int)(yyvsp[(3) - (7)].d); if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); + yymsg(0, "Curve %d already exists", num); } else{ - 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); + 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); } List_Delete((yyvsp[(6) - (7)].l)); (yyval.s).Type = MSH_SEGM_LINE; @@ -4961,22 +4961,22 @@ yyreduce: #line 1074 "Gmsh.y" { for (int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){ - 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); - } - } + 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; @@ -4986,15 +4986,15 @@ yyreduce: { int num = (int)(yyvsp[(3) - (7)].d); if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); + yymsg(0, "Curve %d already exists", num); } else{ - 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); + 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); } List_Delete((yyvsp[(6) - (7)].l)); (yyval.s).Type = MSH_SEGM_SPLN; @@ -5007,27 +5007,27 @@ yyreduce: { int num = (int)(yyvsp[(3) - (8)].d); if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); + yymsg(0, "Curve %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (8)].l)); - Curve *c = Create_Curve(num, MSH_SEGM_CIRC, 2, temp, NULL, - -1, -1, 0., 1.); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (8)].l)); + Curve *c = Create_Curve(num, MSH_SEGM_CIRC, 2, temp, NULL, + -1, -1, 0., 1.); if((yyvsp[(7) - (8)].v)[0] || (yyvsp[(7) - (8)].v)[1] || (yyvsp[(7) - (8)].v)[2]){ c->Circle.n[0] = (yyvsp[(7) - (8)].v)[0]; c->Circle.n[1] = (yyvsp[(7) - (8)].v)[1]; c->Circle.n[2] = (yyvsp[(7) - (8)].v)[2]; End_Curve(c); } - Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); - Curve *rc = CreateReversedCurve(c); + Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); + Curve *rc = CreateReversedCurve(c); if((yyvsp[(7) - (8)].v)[0] || (yyvsp[(7) - (8)].v)[1] || (yyvsp[(7) - (8)].v)[2]){ rc->Circle.n[0] = (yyvsp[(7) - (8)].v)[0]; rc->Circle.n[1] = (yyvsp[(7) - (8)].v)[1]; rc->Circle.n[2] = (yyvsp[(7) - (8)].v)[2]; End_Curve(rc); } - List_Delete(temp); + List_Delete(temp); } List_Delete((yyvsp[(6) - (8)].l)); (yyval.s).Type = MSH_SEGM_CIRC; @@ -5040,27 +5040,27 @@ yyreduce: { int num = (int)(yyvsp[(3) - (8)].d); if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); + yymsg(0, "Curve %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (8)].l)); - Curve *c = Create_Curve(num, MSH_SEGM_ELLI, 2, temp, NULL, - -1, -1, 0., 1.); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (8)].l)); + Curve *c = Create_Curve(num, MSH_SEGM_ELLI, 2, temp, NULL, + -1, -1, 0., 1.); if((yyvsp[(7) - (8)].v)[0] || (yyvsp[(7) - (8)].v)[1] || (yyvsp[(7) - (8)].v)[2]){ c->Circle.n[0] = (yyvsp[(7) - (8)].v)[0]; c->Circle.n[1] = (yyvsp[(7) - (8)].v)[1]; c->Circle.n[2] = (yyvsp[(7) - (8)].v)[2]; End_Curve(c); } - Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); - Curve *rc = CreateReversedCurve(c); + Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); + Curve *rc = CreateReversedCurve(c); if((yyvsp[(7) - (8)].v)[0] || (yyvsp[(7) - (8)].v)[1] || (yyvsp[(7) - (8)].v)[2]){ rc->Circle.n[0] = (yyvsp[(7) - (8)].v)[0]; rc->Circle.n[1] = (yyvsp[(7) - (8)].v)[1]; rc->Circle.n[2] = (yyvsp[(7) - (8)].v)[2]; End_Curve(rc); } - List_Delete(temp); + List_Delete(temp); } List_Delete((yyvsp[(6) - (8)].l)); (yyval.s).Type = MSH_SEGM_ELLI; @@ -5073,15 +5073,15 @@ yyreduce: { int num = (int)(yyvsp[(3) - (7)].d); if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); + yymsg(0, "Curve %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); - Curve *c = Create_Curve(num, MSH_SEGM_BSPLN, 2, temp, NULL, - -1, -1, 0., 1.); - Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); - CreateReversedCurve(c); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); + Curve *c = Create_Curve(num, MSH_SEGM_BSPLN, 2, temp, NULL, + -1, -1, 0., 1.); + Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); + CreateReversedCurve(c); + List_Delete(temp); } List_Delete((yyvsp[(6) - (7)].l)); (yyval.s).Type = MSH_SEGM_BSPLN; @@ -5094,15 +5094,15 @@ yyreduce: { int num = (int)(yyvsp[(3) - (7)].d); if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); + yymsg(0, "Curve %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); - Curve *c = Create_Curve(num, MSH_SEGM_BEZIER, 2, temp, NULL, - -1, -1, 0., 1.); - Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); - CreateReversedCurve(c); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); + Curve *c = Create_Curve(num, MSH_SEGM_BEZIER, 2, temp, NULL, + -1, -1, 0., 1.); + Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); + CreateReversedCurve(c); + List_Delete(temp); } List_Delete((yyvsp[(6) - (7)].l)); (yyval.s).Type = MSH_SEGM_BEZIER; @@ -5115,22 +5115,22 @@ yyreduce: { int num = (int)(yyvsp[(3) - (11)].d); if(List_Nbr((yyvsp[(6) - (11)].l)) + (int)(yyvsp[(10) - (11)].d) + 1 != List_Nbr((yyvsp[(8) - (11)].l))){ - yymsg(0, "Wrong definition of Nurbs Curve %d: " - "got %d knots, need N + D + 1 = %d + %d + 1 = %d", - (int)(yyvsp[(3) - (11)].d), List_Nbr((yyvsp[(8) - (11)].l)), List_Nbr((yyvsp[(6) - (11)].l)), (int)(yyvsp[(10) - (11)].d), List_Nbr((yyvsp[(6) - (11)].l)) + (int)(yyvsp[(10) - (11)].d) + 1); + yymsg(0, "Wrong definition of Nurbs Curve %d: " + "got %d knots, need N + D + 1 = %d + %d + 1 = %d", + (int)(yyvsp[(3) - (11)].d), List_Nbr((yyvsp[(8) - (11)].l)), List_Nbr((yyvsp[(6) - (11)].l)), (int)(yyvsp[(10) - (11)].d), List_Nbr((yyvsp[(6) - (11)].l)) + (int)(yyvsp[(10) - (11)].d) + 1); } else{ - if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); - } - else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (11)].l)); - Curve *c = Create_Curve(num, MSH_SEGM_NURBS, (int)(yyvsp[(10) - (11)].d), temp, (yyvsp[(8) - (11)].l), - -1, -1, 0., 1.); - Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); - CreateReversedCurve(c); - List_Delete(temp); - } + if(FindCurve(num)){ + yymsg(0, "Curve %d already exists", num); + } + else{ + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (11)].l)); + Curve *c = Create_Curve(num, MSH_SEGM_NURBS, (int)(yyvsp[(10) - (11)].d), temp, (yyvsp[(8) - (11)].l), + -1, -1, 0., 1.); + Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); + CreateReversedCurve(c); + List_Delete(temp); + } } List_Delete((yyvsp[(6) - (11)].l)); List_Delete((yyvsp[(8) - (11)].l)); @@ -5144,14 +5144,14 @@ yyreduce: { int num = (int)(yyvsp[(4) - (8)].d); if(FindEdgeLoop(num)){ - yymsg(0, "Line loop %d already exists", num); + yymsg(0, "Line loop %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); - sortEdgesInLoop(num, temp); - EdgeLoop *l = Create_EdgeLoop(num, temp); - Tree_Add(GModel::current()->getGEOInternals()->EdgeLoops, &l); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); + sortEdgesInLoop(num, temp); + EdgeLoop *l = Create_EdgeLoop(num, temp); + Tree_Add(GModel::current()->getGEOInternals()->EdgeLoops, &l); + List_Delete(temp); } List_Delete((yyvsp[(7) - (8)].l)); (yyval.s).Type = MSH_SEGM_LOOP; @@ -5171,13 +5171,13 @@ yyreduce: { int num = (int)(yyvsp[(5) - (9)].i); if(FindPhysicalGroup(num, MSH_PHYSICAL_LINE)){ - yymsg(0, "Physical line %d already exists", num); + yymsg(0, "Physical line %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); - PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_LINE, temp); - List_Delete(temp); - List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); + PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_LINE, temp); + List_Delete(temp); + List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); } List_Delete((yyvsp[(8) - (9)].l)); (yyval.s).Type = MSH_PHYSICAL_LINE; @@ -5190,15 +5190,15 @@ yyreduce: { int num = (int)(yyvsp[(4) - (8)].d); if(FindSurface(num)){ - yymsg(0, "Surface %d already exists", num); + yymsg(0, "Surface %d already exists", num); } else{ - Surface *s = Create_Surface(num, MSH_SURF_PLAN); - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); - setSurfaceGeneratrices(s, temp); - List_Delete(temp); - End_Surface(s); - Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); + Surface *s = Create_Surface(num, MSH_SURF_PLAN); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); + setSurfaceGeneratrices(s, temp); + List_Delete(temp); + End_Surface(s); + Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); } List_Delete((yyvsp[(7) - (8)].l)); (yyval.s).Type = MSH_SURF_PLAN; @@ -5211,36 +5211,36 @@ yyreduce: { int num = (int)(yyvsp[(4) - (9)].d), type = 0; if(FindSurface(num)){ - yymsg(0, "Surface %d already exists", num); + yymsg(0, "Surface %d already exists", num); } else{ - double d; - List_Read((yyvsp[(7) - (9)].l), 0, &d); - EdgeLoop *el = FindEdgeLoop((int)fabs(d)); - if(!el){ - yymsg(0, "Unknown line loop %d", (int)d); - } - else{ - int j = List_Nbr(el->Curves); - if(j == 4){ - type = MSH_SURF_REGL; - } - else if(j == 3){ - type = MSH_SURF_TRIC; - } - else{ - yymsg(0, "Wrong definition of Ruled Surface %d: " - "%d borders instead of 3 or 4", num, j); - type = MSH_SURF_PLAN; - } - Surface *s = Create_Surface(num, type); - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (9)].l)); - setSurfaceGeneratrices(s, temp); - List_Delete(temp); - End_Surface(s); - s->InSphereCenter = (yyvsp[(8) - (9)].l); - Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); - } + double d; + List_Read((yyvsp[(7) - (9)].l), 0, &d); + EdgeLoop *el = FindEdgeLoop((int)fabs(d)); + if(!el){ + yymsg(0, "Unknown line loop %d", (int)d); + } + else{ + int j = List_Nbr(el->Curves); + if(j == 4){ + type = MSH_SURF_REGL; + } + else if(j == 3){ + type = MSH_SURF_TRIC; + } + else{ + yymsg(0, "Wrong definition of Ruled Surface %d: " + "%d borders instead of 3 or 4", num, j); + type = MSH_SURF_PLAN; + } + Surface *s = Create_Surface(num, type); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (9)].l)); + setSurfaceGeneratrices(s, temp); + List_Delete(temp); + End_Surface(s); + s->InSphereCenter = (yyvsp[(8) - (9)].l); + Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); + } } List_Delete((yyvsp[(7) - (9)].l)); (yyval.s).Type = type; @@ -5281,23 +5281,23 @@ yyreduce: { int num = (int)(yyvsp[(3) - (7)].d); if (List_Nbr((yyvsp[(6) - (7)].l)) != 2){ - yymsg(0, "Sphere %d has to be defined using 2 points (center + " - "any point) and not %d", num, List_Nbr((yyvsp[(6) - (7)].l))); + yymsg(0, "Sphere %d has to be defined using 2 points (center + " + "any point) and not %d", num, List_Nbr((yyvsp[(6) - (7)].l))); } else{ - double p1,p2; - List_Read((yyvsp[(6) - (7)].l), 0, &p1); - List_Read((yyvsp[(6) - (7)].l), 1, &p2); - Vertex *v1 = FindPoint((int)p1); - Vertex *v2 = FindPoint((int)p2); - if(!v1) yymsg(0, "Sphere %d : unknown point %d", num, (int)p1); - if(!v2) yymsg(0, "Sphere %d : unknown point %d", num, (int)p2); - if(v1 && v2) - myGmshSurface = gmshSphere::NewSphere - (num, v1->Pos.X, v1->Pos.Y, v1->Pos.Z, - sqrt((v2->Pos.X - v1->Pos.X) * (v2->Pos.X - v1->Pos.X) + - (v2->Pos.Y - v1->Pos.Y) * (v2->Pos.Y - v1->Pos.Y) + - (v2->Pos.Z - v1->Pos.Z) * (v2->Pos.Z - v1->Pos.Z))); + double p1,p2; + List_Read((yyvsp[(6) - (7)].l), 0, &p1); + List_Read((yyvsp[(6) - (7)].l), 1, &p2); + Vertex *v1 = FindPoint((int)p1); + Vertex *v2 = FindPoint((int)p2); + if(!v1) yymsg(0, "Sphere %d : unknown point %d", num, (int)p1); + if(!v2) yymsg(0, "Sphere %d : unknown point %d", num, (int)p2); + if(v1 && v2) + myGmshSurface = gmshSphere::NewSphere + (num, v1->Pos.X, v1->Pos.Y, v1->Pos.Z, + sqrt((v2->Pos.X - v1->Pos.X) * (v2->Pos.X - v1->Pos.X) + + (v2->Pos.Y - v1->Pos.Y) * (v2->Pos.Y - v1->Pos.Y) + + (v2->Pos.Z - v1->Pos.Z) * (v2->Pos.Z - v1->Pos.Z))); } (yyval.s).Type = 0; (yyval.s).Num = num; @@ -5309,23 +5309,23 @@ yyreduce: { int num = (int)(yyvsp[(3) - (7)].d); if (List_Nbr((yyvsp[(6) - (7)].l)) != 2){ - yymsg(0, "PolarSphere %d has to be defined using 2 points (center + " - "any point) and not %d", num, List_Nbr((yyvsp[(6) - (7)].l))); + yymsg(0, "PolarSphere %d has to be defined using 2 points (center + " + "any point) and not %d", num, List_Nbr((yyvsp[(6) - (7)].l))); } else{ - double p1,p2; - List_Read((yyvsp[(6) - (7)].l), 0, &p1); - List_Read((yyvsp[(6) - (7)].l), 1, &p2); - Vertex *v1 = FindPoint((int)p1); - Vertex *v2 = FindPoint((int)p2); - if(!v1) yymsg(0, "PolarSphere %d : unknown point %d", num, (int)p1); - if(!v2) yymsg(0, "PolarSphere %d : unknown point %d", num, (int)p2); - if(v1 && v2) - myGmshSurface = gmshPolarSphere::NewPolarSphere - (num, v1->Pos.X, v1->Pos.Y, v1->Pos.Z, - sqrt((v2->Pos.X - v1->Pos.X) * (v2->Pos.X - v1->Pos.X) + - (v2->Pos.Y - v1->Pos.Y) * (v2->Pos.Y - v1->Pos.Y) + - (v2->Pos.Z - v1->Pos.Z) * (v2->Pos.Z - v1->Pos.Z))); + double p1,p2; + List_Read((yyvsp[(6) - (7)].l), 0, &p1); + List_Read((yyvsp[(6) - (7)].l), 1, &p2); + Vertex *v1 = FindPoint((int)p1); + Vertex *v2 = FindPoint((int)p2); + if(!v1) yymsg(0, "PolarSphere %d : unknown point %d", num, (int)p1); + if(!v2) yymsg(0, "PolarSphere %d : unknown point %d", num, (int)p2); + if(v1 && v2) + myGmshSurface = gmshPolarSphere::NewPolarSphere + (num, v1->Pos.X, v1->Pos.Y, v1->Pos.Z, + sqrt((v2->Pos.X - v1->Pos.X) * (v2->Pos.X - v1->Pos.X) + + (v2->Pos.Y - v1->Pos.Y) * (v2->Pos.Y - v1->Pos.Y) + + (v2->Pos.Z - v1->Pos.Z) * (v2->Pos.Z - v1->Pos.Z))); } (yyval.s).Type = 0; (yyval.s).Num = num; @@ -5337,13 +5337,13 @@ yyreduce: { int num = (int)(yyvsp[(4) - (8)].d); if(FindSurfaceLoop(num)){ - yymsg(0, "Surface loop %d already exists", num); + yymsg(0, "Surface loop %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); - SurfaceLoop *l = Create_SurfaceLoop(num, temp); - Tree_Add(GModel::current()->getGEOInternals()->SurfaceLoops, &l); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); + SurfaceLoop *l = Create_SurfaceLoop(num, temp); + Tree_Add(GModel::current()->getGEOInternals()->SurfaceLoops, &l); + List_Delete(temp); } List_Delete((yyvsp[(7) - (8)].l)); (yyval.s).Type = MSH_SURF_LOOP; @@ -5363,13 +5363,13 @@ yyreduce: { int num = (int)(yyvsp[(5) - (9)].i); if(FindPhysicalGroup(num, MSH_PHYSICAL_SURFACE)){ - yymsg(0, "Physical surface %d already exists", num); + yymsg(0, "Physical surface %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); - PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_SURFACE, temp); - List_Delete(temp); - List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); + PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_SURFACE, temp); + List_Delete(temp); + List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); } List_Delete((yyvsp[(8) - (9)].l)); (yyval.s).Type = MSH_PHYSICAL_SURFACE; @@ -5382,13 +5382,13 @@ yyreduce: { int num = (int)(yyvsp[(4) - (8)].d); if(FindPhysicalGroup(num, MSH_PHYSICAL_VOLUME)){ - yymsg(0, "Physical volume %d already exists", num); + yymsg(0, "Physical volume %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); - List_T *S[4] = {temp, 0, 0, 0}; - PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_VOLUME, temp, S); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); + List_T *S[4] = {temp, 0, 0, 0}; + PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_VOLUME, temp, S); + List_Delete(temp); List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); } List_Delete((yyvsp[(7) - (8)].l)); @@ -5402,21 +5402,21 @@ yyreduce: { int num = (int)(yyvsp[(4) - (12)].d); if(FindPhysicalGroup(num, MSH_PHYSICAL_SURFACE)){ - yymsg(0, "Physical surface %d already exists", num); + yymsg(0, "Physical surface %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (12)].l)); - List_T *S[4] = {0, 0, 0, 0}; - for (int i = 0; i < List_Nbr((yyvsp[(10) - (12)].l)); i++){ - List_T *ll; - List_Read((yyvsp[(10) - (12)].l), i, &ll); - S[i] = ListOfDouble2ListOfInt(ll); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (12)].l)); + List_T *S[4] = {0, 0, 0, 0}; + for (int i = 0; i < List_Nbr((yyvsp[(10) - (12)].l)); i++){ + List_T *ll; + List_Read((yyvsp[(10) - (12)].l), i, &ll); + S[i] = ListOfDouble2ListOfInt(ll); List_Delete(ll); - } - PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_SURFACE, temp, S); - List_Delete(temp); - for (int i = 0; i < List_Nbr((yyvsp[(10) - (12)].l)); i++) - List_Delete(S[i]); + } + PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_SURFACE, temp, S); + List_Delete(temp); + for (int i = 0; i < List_Nbr((yyvsp[(10) - (12)].l)); i++) + List_Delete(S[i]); List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); } List_Delete((yyvsp[(7) - (12)].l)); @@ -5432,13 +5432,13 @@ yyreduce: { int num = (int)(yyvsp[(4) - (8)].d); if(FindPhysicalGroup(num, MSH_PHYSICAL_SURFACE)){ - yymsg(0, "Physical surface %d already exists", num); + yymsg(0, "Physical surface %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); - List_T *S[4] = {0, 0, 0, 0}; - PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_SURFACE, temp, S); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); + List_T *S[4] = {0, 0, 0, 0}; + PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_SURFACE, temp, S); + List_Delete(temp); List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); } List_Delete((yyvsp[(7) - (8)].l)); @@ -5452,13 +5452,13 @@ yyreduce: { int num = (int)(yyvsp[(4) - (8)].d); if(FindPhysicalGroup(num, MSH_PHYSICAL_LINE)){ - yymsg(0, "Physical line %d already exists", num); + yymsg(0, "Physical line %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); - List_T *S[4] = {temp, 0, 0, 0}; - PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_LINE, temp, S); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); + List_T *S[4] = {temp, 0, 0, 0}; + PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_LINE, temp, S); + List_Delete(temp); List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); } List_Delete((yyvsp[(7) - (8)].l)); @@ -5473,14 +5473,14 @@ yyreduce: yymsg(0, "'Complex Volume' command is deprecated: use 'Volume' instead"); int num = (int)(yyvsp[(4) - (8)].d); if(FindVolume(num)){ - yymsg(0, "Volume %d already exists", num); + yymsg(0, "Volume %d already exists", num); } else{ - Volume *v = Create_Volume(num, MSH_VOLUME); - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); - setVolumeSurfaces(v, temp); - List_Delete(temp); - Tree_Add(GModel::current()->getGEOInternals()->Volumes, &v); + Volume *v = Create_Volume(num, MSH_VOLUME); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); + setVolumeSurfaces(v, temp); + List_Delete(temp); + Tree_Add(GModel::current()->getGEOInternals()->Volumes, &v); } List_Delete((yyvsp[(7) - (8)].l)); (yyval.s).Type = MSH_VOLUME; @@ -5493,14 +5493,14 @@ yyreduce: { int num = (int)(yyvsp[(3) - (7)].d); if(FindVolume(num)){ - yymsg(0, "Volume %d already exists", num); + yymsg(0, "Volume %d already exists", num); } else{ - Volume *v = Create_Volume(num, MSH_VOLUME); - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); - setVolumeSurfaces(v, temp); - List_Delete(temp); - Tree_Add(GModel::current()->getGEOInternals()->Volumes, &v); + Volume *v = Create_Volume(num, MSH_VOLUME); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); + setVolumeSurfaces(v, temp); + List_Delete(temp); + Tree_Add(GModel::current()->getGEOInternals()->Volumes, &v); } List_Delete((yyvsp[(6) - (7)].l)); (yyval.s).Type = MSH_VOLUME; @@ -5536,13 +5536,13 @@ yyreduce: { int num = (int)(yyvsp[(5) - (9)].i); if(FindPhysicalGroup(num, MSH_PHYSICAL_VOLUME)){ - yymsg(0, "Physical volume %d already exists", num); + yymsg(0, "Physical volume %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); - PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_VOLUME, temp); - List_Delete(temp); - List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); + PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_VOLUME, temp); + List_Delete(temp); + List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); } List_Delete((yyvsp[(8) - (9)].l)); (yyval.s).Type = MSH_PHYSICAL_VOLUME; @@ -5653,24 +5653,24 @@ yyreduce: #line 1666 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){ - double d; - List_Read((yyvsp[(4) - (6)].l), i, &d); - Shape TheShape; - TheShape.Num = (int)d; - Vertex *v = FindPoint(std::abs(TheShape.Num)); - if(v){ - TheShape.Type = MSH_POINT; - List_Add((yyval.l), &TheShape); - } - else{ - GVertex *gv = GModel::current()->getVertexByTag(std::abs(TheShape.Num)); - if(gv){ - TheShape.Type = MSH_POINT_FROM_GMODEL; - List_Add((yyval.l), &TheShape); - } - else - yymsg(1, "Unknown point %d", TheShape.Num); - } + double d; + List_Read((yyvsp[(4) - (6)].l), i, &d); + Shape TheShape; + TheShape.Num = (int)d; + Vertex *v = FindPoint(std::abs(TheShape.Num)); + if(v){ + TheShape.Type = MSH_POINT; + List_Add((yyval.l), &TheShape); + } + else{ + GVertex *gv = GModel::current()->getVertexByTag(std::abs(TheShape.Num)); + if(gv){ + TheShape.Type = MSH_POINT_FROM_GMODEL; + List_Add((yyval.l), &TheShape); + } + else + yymsg(1, "Unknown point %d", TheShape.Num); + } } ;} break; @@ -5679,24 +5679,24 @@ yyreduce: #line 1689 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){ - double d; - List_Read((yyvsp[(4) - (6)].l), i, &d); - Shape TheShape; - TheShape.Num = (int)d; - Curve *c = FindCurve(std::abs(TheShape.Num)); - if(c){ - TheShape.Type = c->Typ; - List_Add((yyval.l), &TheShape); - } - else{ - GEdge *ge = GModel::current()->getEdgeByTag(std::abs(TheShape.Num)); - if(ge){ - TheShape.Type = MSH_SEGM_FROM_GMODEL; - List_Add((yyval.l), &TheShape); - } - else - yymsg(1, "Unknown curve %d", TheShape.Num); - } + double d; + List_Read((yyvsp[(4) - (6)].l), i, &d); + Shape TheShape; + TheShape.Num = (int)d; + Curve *c = FindCurve(std::abs(TheShape.Num)); + if(c){ + TheShape.Type = c->Typ; + List_Add((yyval.l), &TheShape); + } + else{ + GEdge *ge = GModel::current()->getEdgeByTag(std::abs(TheShape.Num)); + if(ge){ + TheShape.Type = MSH_SEGM_FROM_GMODEL; + List_Add((yyval.l), &TheShape); + } + else + yymsg(1, "Unknown curve %d", TheShape.Num); + } } ;} break; @@ -5705,24 +5705,24 @@ yyreduce: #line 1712 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){ - double d; - List_Read((yyvsp[(4) - (6)].l), i, &d); - Shape TheShape; - TheShape.Num = (int)d; - Surface *s = FindSurface(std::abs(TheShape.Num)); - if(s){ - TheShape.Type = s->Typ; - List_Add((yyval.l), &TheShape); - } - else{ - GFace *gf = GModel::current()->getFaceByTag(std::abs(TheShape.Num)); - if(gf){ - TheShape.Type = MSH_SURF_FROM_GMODEL; - List_Add((yyval.l), &TheShape); - } - else - yymsg(1, "Unknown surface %d", TheShape.Num); - } + double d; + List_Read((yyvsp[(4) - (6)].l), i, &d); + Shape TheShape; + TheShape.Num = (int)d; + Surface *s = FindSurface(std::abs(TheShape.Num)); + if(s){ + TheShape.Type = s->Typ; + List_Add((yyval.l), &TheShape); + } + else{ + GFace *gf = GModel::current()->getFaceByTag(std::abs(TheShape.Num)); + if(gf){ + TheShape.Type = MSH_SURF_FROM_GMODEL; + List_Add((yyval.l), &TheShape); + } + else + yymsg(1, "Unknown surface %d", TheShape.Num); + } } ;} break; @@ -5731,24 +5731,24 @@ yyreduce: #line 1735 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){ - double d; - List_Read((yyvsp[(4) - (6)].l), i, &d); - Shape TheShape; - TheShape.Num = (int)d; - Volume *v = FindVolume(std::abs(TheShape.Num)); - if(v){ - TheShape.Type = v->Typ; - List_Add((yyval.l), &TheShape); - } - else{ - GRegion *gr = GModel::current()->getRegionByTag(std::abs(TheShape.Num)); - if(gr){ - TheShape.Type = MSH_VOLUME_FROM_GMODEL; - List_Add((yyval.l), &TheShape); - } - else - yymsg(1, "Unknown volume %d", TheShape.Num); - } + double d; + List_Read((yyvsp[(4) - (6)].l), i, &d); + Shape TheShape; + TheShape.Num = (int)d; + Volume *v = FindVolume(std::abs(TheShape.Num)); + if(v){ + TheShape.Type = v->Typ; + List_Add((yyval.l), &TheShape); + } + else{ + GRegion *gr = GModel::current()->getRegionByTag(std::abs(TheShape.Num)); + if(gr){ + TheShape.Type = MSH_VOLUME_FROM_GMODEL; + List_Add((yyval.l), &TheShape); + } + else + yymsg(1, "Unknown volume %d", TheShape.Num); + } } ;} break; @@ -5760,7 +5760,7 @@ yyreduce: if(List_Nbr((yyvsp[(7) - (8)].l)) == 4){ int t = (int)(yyvsp[(4) - (8)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double d[4]; @@ -5784,7 +5784,7 @@ yyreduce: if(List_Nbr((yyvsp[(12) - (14)].l)) == 0){ int t = (int)(yyvsp[(4) - (14)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double pt[3] = {(yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2]}; @@ -5807,7 +5807,7 @@ yyreduce: if(List_Nbr((yyvsp[(14) - (16)].l)) == 0){ int t = (int)(yyvsp[(4) - (16)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double pt1[3] = {(yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2]}; @@ -5831,7 +5831,7 @@ yyreduce: if(List_Nbr((yyvsp[(10) - (12)].l)) == 1){ int t = (int)(yyvsp[(4) - (12)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double d; @@ -5854,14 +5854,14 @@ yyreduce: if(!strcmp((yyvsp[(2) - (8)].c), "Union")){ int t = (int)(yyvsp[(4) - (8)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { std::vector<const 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 Union %d : unknown levelset %d", t, (int)d); + if(!pl) yymsg(0, "Levelset Union %d : unknown levelset %d", t, (int)d); else vl.push_back(pl->ls); } gLevelset *ls = new gLevelsetUnion(vl); @@ -5872,14 +5872,14 @@ yyreduce: else if(!strcmp((yyvsp[(2) - (8)].c), "Intersection")){ int t = (int)(yyvsp[(4) - (8)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { std::vector<const 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); + if(!pl) yymsg(0, "Levelset Intersection %d : unknown levelset %d", t, (int)d); else vl.push_back(pl->ls); } gLevelset *ls = new gLevelsetIntersection(vl); @@ -5890,14 +5890,14 @@ yyreduce: 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); + yymsg(0, "Levelset %d already exists", t); } else { std::vector<const 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); + if(!pl) yymsg(0, "Levelset Cut %d : unknown levelset %d", t, (int)d); else vl.push_back(pl->ls); } gLevelset *ls = new gLevelsetCut(vl); @@ -5908,14 +5908,14 @@ yyreduce: 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); + yymsg(0, "Levelset %d already exists", t); } else { std::vector<const 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); + if(!pl) yymsg(0, "Levelset Crack %d : unknown levelset %d", t, (int)d); else vl.push_back(pl->ls); } gLevelset *ls = new gLevelsetCrack(vl); @@ -5926,7 +5926,7 @@ yyreduce: 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); + yymsg(0, "Levelset %d already exists", t); } else { if(List_Nbr((yyvsp[(7) - (8)].l)) > 0){ @@ -5951,7 +5951,7 @@ yyreduce: if(!strcmp((yyvsp[(2) - (8)].c), "MathEval")){ int t = (int)(yyvsp[(4) - (8)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { gLevelset *ls = new gLevelsetMathEval((yyvsp[(7) - (8)].c), t); @@ -5990,7 +5990,7 @@ yyreduce: 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); + yymsg(0, "Levelset %d already exists", t); } else { double d; @@ -6005,7 +6005,7 @@ yyreduce: 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); + yymsg(0, "Levelset %d already exists", t); } else { double d; @@ -6020,7 +6020,7 @@ yyreduce: 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); + yymsg(0, "Levelset %d already exists", t); } else { double d[2]; @@ -6036,7 +6036,7 @@ yyreduce: 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); + yymsg(0, "Levelset %d already exists", t); } else { double d[3]; @@ -6052,7 +6052,7 @@ yyreduce: 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); + yymsg(0, "Levelset %d already exists", t); } else { double d[3]; @@ -6068,7 +6068,7 @@ yyreduce: 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); + yymsg(0, "Levelset %d already exists", t); } else { double d[5]; @@ -6093,9 +6093,9 @@ yyreduce: #line 2083 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){ - Shape TheShape; - List_Read((yyvsp[(3) - (4)].l), i, &TheShape); - DeleteShape(TheShape.Type, TheShape.Num); + Shape TheShape; + List_Read((yyvsp[(3) - (4)].l), i, &TheShape); + DeleteShape(TheShape.Type, TheShape.Num); } List_Delete((yyvsp[(3) - (4)].l)); ;} @@ -6113,14 +6113,14 @@ yyreduce: { #if !defined(HAVE_NO_POST) if(!strcmp((yyvsp[(2) - (6)].c), "View")){ - 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); + 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); } else - yymsg(0, "Unknown command 'Delete %s'", (yyvsp[(2) - (6)].c)); + yymsg(0, "Unknown command 'Delete %s'", (yyvsp[(2) - (6)].c)); #endif Free((yyvsp[(2) - (6)].c)); ;} @@ -6136,21 +6136,21 @@ yyreduce: } } else if(!strcmp((yyvsp[(2) - (3)].c), "Model")){ - GModel::current()->destroy(); - GModel::current()->getGEOInternals()->destroy(); + GModel::current()->destroy(); + GModel::current()->getGEOInternals()->destroy(); } else if(!strcmp((yyvsp[(2) - (3)].c), "Physicals")){ - GModel::current()->getGEOInternals()->reset_physicals(); - GModel::current()->deletePhysicalGroups(); + GModel::current()->getGEOInternals()->reset_physicals(); + GModel::current()->deletePhysicalGroups(); } else if(!strcmp((yyvsp[(2) - (3)].c), "Variables")){ - gmsh_yysymbols.clear(); + gmsh_yysymbols.clear(); } else{ - 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)); + 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)); } Free((yyvsp[(2) - (3)].c)); ;} @@ -6161,11 +6161,11 @@ yyreduce: { #if !defined(HAVE_NO_POST) 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]; + for(int i = PView::list.size() - 1; i >= 0; i--) + if(PView::list[i]->getData()->empty()) delete PView::list[i]; } else - yymsg(0, "Unknown command 'Delete %s %s'", (yyvsp[(2) - (4)].c), (yyvsp[(3) - (4)].c)); + yymsg(0, "Unknown command 'Delete %s %s'", (yyvsp[(2) - (4)].c), (yyvsp[(3) - (4)].c)); #endif Free((yyvsp[(2) - (4)].c)); Free((yyvsp[(3) - (4)].c)); ;} @@ -6175,9 +6175,9 @@ yyreduce: #line 2155 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(4) - (5)].l)); i++){ - Shape TheShape; - List_Read((yyvsp[(4) - (5)].l), i, &TheShape); - ColorShape(TheShape.Type, TheShape.Num, (yyvsp[(2) - (5)].u)); + Shape TheShape; + List_Read((yyvsp[(4) - (5)].l), i, &TheShape); + ColorShape(TheShape.Type, TheShape.Num, (yyvsp[(2) - (5)].u)); } List_Delete((yyvsp[(4) - (5)].l)); ;} @@ -6187,7 +6187,7 @@ yyreduce: #line 2169 "Gmsh.y" { for(int i = 0; i < 4; i++) - VisibilityShape((yyvsp[(2) - (3)].c), i, 1); + VisibilityShape((yyvsp[(2) - (3)].c), i, 1); Free((yyvsp[(2) - (3)].c)); ;} break; @@ -6196,7 +6196,7 @@ yyreduce: #line 2175 "Gmsh.y" { for(int i = 0; i < 4; i++) - VisibilityShape((yyvsp[(2) - (3)].c), i, 0); + VisibilityShape((yyvsp[(2) - (3)].c), i, 0); Free((yyvsp[(2) - (3)].c)); ;} break; @@ -6205,9 +6205,9 @@ yyreduce: #line 2181 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){ - Shape TheShape; - List_Read((yyvsp[(3) - (4)].l), i, &TheShape); - VisibilityShape(TheShape.Type, TheShape.Num, 1); + Shape TheShape; + List_Read((yyvsp[(3) - (4)].l), i, &TheShape); + VisibilityShape(TheShape.Type, TheShape.Num, 1); } List_Delete((yyvsp[(3) - (4)].l)); ;} @@ -6217,9 +6217,9 @@ yyreduce: #line 2190 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){ - Shape TheShape; - List_Read((yyvsp[(3) - (4)].l), i, &TheShape); - VisibilityShape(TheShape.Type, TheShape.Num, 0); + Shape TheShape; + List_Read((yyvsp[(3) - (4)].l), i, &TheShape); + VisibilityShape(TheShape.Type, TheShape.Num, 0); } List_Delete((yyvsp[(3) - (4)].l)); ;} @@ -6229,49 +6229,49 @@ yyreduce: #line 2204 "Gmsh.y" { if(!strcmp((yyvsp[(1) - (3)].c), "Include")){ - char tmpstring[1024]; - FixRelativePath((yyvsp[(2) - (3)].c), tmpstring); - // Warning: we *don't* close included files (to allow user - // functions in these files). If you need to include many many - // files and don't have functions in the files, use "Merge" - // instead: some OSes limit the number of files a process can - // open simultaneously. The right solution would be of course - // to modify FunctionManager to reopen the files instead of - // using the FILE pointer, but hey, I'm lazy... - Msg::StatusBar(2, true, "Reading '%s'", tmpstring); - ParseFile(tmpstring, false, true); - SetBoundingBox(); - Msg::StatusBar(2, true, "Read '%s'", tmpstring); + char tmpstring[1024]; + FixRelativePath((yyvsp[(2) - (3)].c), tmpstring); + // Warning: we *don't* close included files (to allow user + // functions in these files). If you need to include many many + // files and don't have functions in the files, use "Merge" + // instead: some OSes limit the number of files a process can + // open simultaneously. The right solution would be of course + // to modify FunctionManager to reopen the files instead of + // using the FILE pointer, but hey, I'm lazy... + Msg::StatusBar(2, true, "Reading '%s'", tmpstring); + ParseFile(tmpstring, false, true); + SetBoundingBox(); + Msg::StatusBar(2, true, "Read '%s'", tmpstring); } else if(!strcmp((yyvsp[(1) - (3)].c), "Print")){ #if defined(HAVE_FLTK) - // 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(); - char tmpstring[1024]; - FixRelativePath((yyvsp[(2) - (3)].c), tmpstring); - CreateOutputFile(tmpstring, CTX::instance()->print.format); + // 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(); + char tmpstring[1024]; + FixRelativePath((yyvsp[(2) - (3)].c), tmpstring); + CreateOutputFile(tmpstring, CTX::instance()->print.format); #endif } else if(!strcmp((yyvsp[(1) - (3)].c), "Save")){ #if defined(HAVE_FLTK) - GModel::current()->importGEOInternals(); - char tmpstring[1024]; - FixRelativePath((yyvsp[(2) - (3)].c), tmpstring); - CreateOutputFile(tmpstring, CTX::instance()->mesh.format); + GModel::current()->importGEOInternals(); + char tmpstring[1024]; + FixRelativePath((yyvsp[(2) - (3)].c), tmpstring); + CreateOutputFile(tmpstring, CTX::instance()->mesh.format); #endif } else if(!strcmp((yyvsp[(1) - (3)].c), "Merge") || !strcmp((yyvsp[(1) - (3)].c), "MergeWithBoundingBox")){ - // MergeWithBoundingBox is deprecated - char tmpstring[1024]; - FixRelativePath((yyvsp[(2) - (3)].c), tmpstring); - MergeFile(tmpstring, true); + // MergeWithBoundingBox is deprecated + char tmpstring[1024]; + FixRelativePath((yyvsp[(2) - (3)].c), tmpstring); + MergeFile(tmpstring, true); } else if(!strcmp((yyvsp[(1) - (3)].c), "System")) - SystemCall((yyvsp[(2) - (3)].c)); + SystemCall((yyvsp[(2) - (3)].c)); else - yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (3)].c)); + yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (3)].c)); Free((yyvsp[(1) - (3)].c)); Free((yyvsp[(2) - (3)].c)); ;} break; @@ -6281,17 +6281,17 @@ yyreduce: { #if !defined(HAVE_NO_POST) 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()){ - char tmpstring[1024]; - FixRelativePath((yyvsp[(6) - (7)].c), tmpstring); - PView::list[index]->write(tmpstring, CTX::instance()->post.fileFormat); - } - else - yymsg(0, "Unknown view %d", index); + int index = (int)(yyvsp[(4) - (7)].d); + if(index >= 0 && index < (int)PView::list.size()){ + char tmpstring[1024]; + FixRelativePath((yyvsp[(6) - (7)].c), tmpstring); + PView::list[index]->write(tmpstring, CTX::instance()->post.fileFormat); + } + else + yymsg(0, "Unknown view %d", index); } else - yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (7)].c)); + yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (7)].c)); #endif Free((yyvsp[(1) - (7)].c)); Free((yyvsp[(2) - (7)].c)); Free((yyvsp[(6) - (7)].c)); ;} @@ -6302,14 +6302,14 @@ yyreduce: { #if !defined(HAVE_NO_POST) 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); + 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); } else - yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (7)].c)); + yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (7)].c)); #endif Free((yyvsp[(1) - (7)].c)); Free((yyvsp[(2) - (7)].c)); Free((yyvsp[(3) - (7)].c)); ;} @@ -6319,20 +6319,20 @@ yyreduce: #line 2285 "Gmsh.y" { if(!strcmp((yyvsp[(1) - (3)].c), "Sleep")){ - SleepInSeconds((yyvsp[(2) - (3)].d)); + SleepInSeconds((yyvsp[(2) - (3)].d)); } else if(!strcmp((yyvsp[(1) - (3)].c), "Remesh")){ - yymsg(0, "Surface remeshing must be reinterfaced"); + yymsg(0, "Surface remeshing must be reinterfaced"); } else if(!strcmp((yyvsp[(1) - (3)].c), "Mesh")){ - int lock = CTX::instance()->lock; - CTX::instance()->lock = 0; - GModel::current()->importGEOInternals(); - GModel::current()->mesh((int)(yyvsp[(2) - (3)].d)); - CTX::instance()->lock = lock; + int lock = CTX::instance()->lock; + CTX::instance()->lock = 0; + GModel::current()->importGEOInternals(); + GModel::current()->mesh((int)(yyvsp[(2) - (3)].d)); + CTX::instance()->lock = lock; } else - yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (3)].c)); + yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (3)].c)); Free((yyvsp[(1) - (3)].c)); ;} break; @@ -6342,10 +6342,10 @@ yyreduce: { #if !defined(HAVE_NO_POST) try { - PluginManager::instance()->action((yyvsp[(3) - (7)].c), (yyvsp[(6) - (7)].c), 0); + PluginManager::instance()->action((yyvsp[(3) - (7)].c), (yyvsp[(6) - (7)].c), 0); } catch(...) { - yymsg(0, "Unknown action '%s' or plugin '%s'", (yyvsp[(6) - (7)].c), (yyvsp[(3) - (7)].c)); + yymsg(0, "Unknown action '%s' or plugin '%s'", (yyvsp[(6) - (7)].c), (yyvsp[(3) - (7)].c)); } #endif Free((yyvsp[(3) - (7)].c)); Free((yyvsp[(6) - (7)].c)); @@ -6357,23 +6357,23 @@ yyreduce: { #if !defined(HAVE_NO_POST) if(!strcmp((yyvsp[(2) - (3)].c), "ElementsFromAllViews")) - PView::combine(false, 1, CTX::instance()->post.combineRemoveOrig); + 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, 0, CTX::instance()->post.combineRemoveOrig); else if(!strcmp((yyvsp[(2) - (3)].c), "ElementsByViewName")) - PView::combine(false, 2, CTX::instance()->post.combineRemoveOrig); + PView::combine(false, 2, CTX::instance()->post.combineRemoveOrig); else if(!strcmp((yyvsp[(2) - (3)].c), "TimeStepsFromAllViews")) - PView::combine(true, 1, 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, 0, CTX::instance()->post.combineRemoveOrig); else if(!strcmp((yyvsp[(2) - (3)].c), "TimeStepsByViewName")) - PView::combine(true, 2, CTX::instance()->post.combineRemoveOrig); + PView::combine(true, 2, CTX::instance()->post.combineRemoveOrig); else if(!strcmp((yyvsp[(2) - (3)].c), "Views")) - PView::combine(false, 1, CTX::instance()->post.combineRemoveOrig); + PView::combine(false, 1, CTX::instance()->post.combineRemoveOrig); else if(!strcmp((yyvsp[(2) - (3)].c), "TimeSteps")) - PView::combine(true, 2, CTX::instance()->post.combineRemoveOrig); + PView::combine(true, 2, CTX::instance()->post.combineRemoveOrig); else - yymsg(0, "Unknown 'Combine' command"); + yymsg(0, "Unknown 'Combine' command"); #endif Free((yyvsp[(2) - (3)].c)); ;} @@ -6439,12 +6439,12 @@ yyreduce: fgetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop]); yylinenoImbricatedLoopsTab[ImbricatedLoop] = gmsh_yylineno; if((yyvsp[(3) - (6)].d) > (yyvsp[(5) - (6)].d)) - skip_until("For", "EndFor"); + skip_until("For", "EndFor"); else - ImbricatedLoop++; + ImbricatedLoop++; if(ImbricatedLoop > MAX_RECUR_LOOPS - 1){ - yymsg(0, "Reached maximum number of imbricated loops"); - ImbricatedLoop = MAX_RECUR_LOOPS - 1; + yymsg(0, "Reached maximum number of imbricated loops"); + ImbricatedLoop = MAX_RECUR_LOOPS - 1; } ;} break; @@ -6459,12 +6459,12 @@ yyreduce: 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"); + skip_until("For", "EndFor"); else - ImbricatedLoop++; + ImbricatedLoop++; if(ImbricatedLoop > MAX_RECUR_LOOPS - 1){ - yymsg(0, "Reached maximum number of imbricated loops"); - ImbricatedLoop = MAX_RECUR_LOOPS - 1; + yymsg(0, "Reached maximum number of imbricated loops"); + ImbricatedLoop = MAX_RECUR_LOOPS - 1; } ;} break; @@ -6481,12 +6481,12 @@ yyreduce: fgetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop]); yylinenoImbricatedLoopsTab[ImbricatedLoop] = gmsh_yylineno; if((yyvsp[(5) - (8)].d) > (yyvsp[(7) - (8)].d)) - skip_until("For", "EndFor"); + skip_until("For", "EndFor"); else - ImbricatedLoop++; + ImbricatedLoop++; if(ImbricatedLoop > MAX_RECUR_LOOPS - 1){ - yymsg(0, "Reached maximum number of imbricated loops"); - ImbricatedLoop = MAX_RECUR_LOOPS - 1; + yymsg(0, "Reached maximum number of imbricated loops"); + ImbricatedLoop = MAX_RECUR_LOOPS - 1; } ;} break; @@ -6503,12 +6503,12 @@ yyreduce: 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"); + skip_until("For", "EndFor"); else - ImbricatedLoop++; + ImbricatedLoop++; if(ImbricatedLoop > MAX_RECUR_LOOPS - 1){ - yymsg(0, "Reached maximum number of imbricated loops"); - ImbricatedLoop = MAX_RECUR_LOOPS - 1; + yymsg(0, "Reached maximum number of imbricated loops"); + ImbricatedLoop = MAX_RECUR_LOOPS - 1; } ;} break; @@ -6517,29 +6517,29 @@ yyreduce: #line 2449 "Gmsh.y" { if(ImbricatedLoop <= 0){ - yymsg(0, "Invalid For/EndFor loop"); - ImbricatedLoop = 0; + yymsg(0, "Invalid For/EndFor loop"); + ImbricatedLoop = 0; } else{ - double x0 = LoopControlVariablesTab[ImbricatedLoop - 1][0]; - double x1 = LoopControlVariablesTab[ImbricatedLoop - 1][1]; - double step = LoopControlVariablesTab[ImbricatedLoop - 1][2]; - int do_next = (step > 0.) ? (x0 + step <= x1) : (x0 + step >= x1); - if(do_next){ - LoopControlVariablesTab[ImbricatedLoop - 1][0] += - LoopControlVariablesTab[ImbricatedLoop - 1][2]; - if(LoopControlVariablesNameTab[ImbricatedLoop - 1]){ - if(!gmsh_yysymbols.count(LoopControlVariablesNameTab[ImbricatedLoop - 1])) - yymsg(0, "Unknown loop variable"); - else - gmsh_yysymbols[LoopControlVariablesNameTab[ImbricatedLoop - 1]][0] += - LoopControlVariablesTab[ImbricatedLoop - 1][2]; - } - fsetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop - 1]); - gmsh_yylineno = yylinenoImbricatedLoopsTab[ImbricatedLoop - 1]; - } - else - ImbricatedLoop--; + double x0 = LoopControlVariablesTab[ImbricatedLoop - 1][0]; + double x1 = LoopControlVariablesTab[ImbricatedLoop - 1][1]; + double step = LoopControlVariablesTab[ImbricatedLoop - 1][2]; + int do_next = (step > 0.) ? (x0 + step <= x1) : (x0 + step >= x1); + if(do_next){ + LoopControlVariablesTab[ImbricatedLoop - 1][0] += + LoopControlVariablesTab[ImbricatedLoop - 1][2]; + if(LoopControlVariablesNameTab[ImbricatedLoop - 1]){ + if(!gmsh_yysymbols.count(LoopControlVariablesNameTab[ImbricatedLoop - 1])) + yymsg(0, "Unknown loop variable"); + else + gmsh_yysymbols[LoopControlVariablesNameTab[ImbricatedLoop - 1]][0] += + LoopControlVariablesTab[ImbricatedLoop - 1][2]; + } + fsetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop - 1]); + gmsh_yylineno = yylinenoImbricatedLoopsTab[ImbricatedLoop - 1]; + } + else + ImbricatedLoop--; } ;} break; @@ -6549,7 +6549,7 @@ yyreduce: { if(!FunctionManager::Instance()->createFunction ((yyvsp[(2) - (2)].c), gmsh_yyin, gmsh_yyname, gmsh_yylineno)) - yymsg(0, "Redefinition of function %s", (yyvsp[(2) - (2)].c)); + yymsg(0, "Redefinition of function %s", (yyvsp[(2) - (2)].c)); skip_until(NULL, "Return"); //FIXME: wee leak $2 ;} @@ -6560,7 +6560,7 @@ yyreduce: { if(!FunctionManager::Instance()->leaveFunction (&gmsh_yyin, gmsh_yyname, gmsh_yylineno)) - yymsg(0, "Error while exiting function"); + yymsg(0, "Error while exiting function"); ;} break; @@ -6569,7 +6569,7 @@ yyreduce: { if(!FunctionManager::Instance()->enterFunction ((yyvsp[(2) - (3)].c), &gmsh_yyin, gmsh_yyname, gmsh_yylineno)) - yymsg(0, "Unknown function %s", (yyvsp[(2) - (3)].c)); + yymsg(0, "Unknown function %s", (yyvsp[(2) - (3)].c)); //FIXME: wee leak $2 ;} break; @@ -6592,8 +6592,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(TRANSLATE, (yyvsp[(4) - (5)].l), - (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)); + (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)); List_Delete((yyvsp[(4) - (5)].l)); ;} break; @@ -6603,8 +6603,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(ROTATE, (yyvsp[(10) - (11)].l), - 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)); + 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)); List_Delete((yyvsp[(10) - (11)].l)); ;} break; @@ -6614,8 +6614,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(TRANSLATE_ROTATE, (yyvsp[(12) - (13)].l), - (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)); + (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)); List_Delete((yyvsp[(12) - (13)].l)); ;} break; @@ -6632,8 +6632,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(TRANSLATE, (yyvsp[(4) - (7)].l), - (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)); + (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)); List_Delete((yyvsp[(4) - (7)].l)); ;} break; @@ -6650,8 +6650,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(ROTATE, (yyvsp[(10) - (13)].l), - 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)); + 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)); List_Delete((yyvsp[(10) - (13)].l)); ;} break; @@ -6668,8 +6668,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(TRANSLATE_ROTATE, (yyvsp[(12) - (15)].l), - (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)); + (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)); List_Delete((yyvsp[(12) - (15)].l)); ;} break; @@ -6686,7 +6686,7 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(BOUNDARY_LAYER, (yyvsp[(3) - (6)].l), 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., - &extr, (yyval.l)); + &extr, (yyval.l)); List_Delete((yyvsp[(3) - (6)].l)); ;} break; @@ -6696,8 +6696,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_POINT, (int)(yyvsp[(4) - (8)].d), - (yyvsp[(6) - (8)].v)[0], (yyvsp[(6) - (8)].v)[1], (yyvsp[(6) - (8)].v)[2], 0., 0., 0., 0., 0., 0., 0., - NULL, (yyval.l)); + (yyvsp[(6) - (8)].v)[0], (yyvsp[(6) - (8)].v)[1], (yyvsp[(6) - (8)].v)[2], 0., 0., 0., 0., 0., 0., 0., + NULL, (yyval.l)); ;} break; @@ -6706,8 +6706,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (8)].d), - (yyvsp[(6) - (8)].v)[0], (yyvsp[(6) - (8)].v)[1], (yyvsp[(6) - (8)].v)[2], 0., 0., 0., 0., 0., 0., 0., - NULL, (yyval.l)); + (yyvsp[(6) - (8)].v)[0], (yyvsp[(6) - (8)].v)[1], (yyvsp[(6) - (8)].v)[2], 0., 0., 0., 0., 0., 0., 0., + NULL, (yyval.l)); ;} break; @@ -6716,8 +6716,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (8)].d), - (yyvsp[(6) - (8)].v)[0], (yyvsp[(6) - (8)].v)[1], (yyvsp[(6) - (8)].v)[2], 0., 0., 0., 0., 0., 0., 0., - NULL, (yyval.l)); + (yyvsp[(6) - (8)].v)[0], (yyvsp[(6) - (8)].v)[1], (yyvsp[(6) - (8)].v)[2], 0., 0., 0., 0., 0., 0., 0., + NULL, (yyval.l)); ;} break; @@ -6726,8 +6726,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_POINT, (int)(yyvsp[(4) - (12)].d), - 0., 0., 0., (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], (yyvsp[(8) - (12)].v)[0], (yyvsp[(8) - (12)].v)[1], (yyvsp[(8) - (12)].v)[2], (yyvsp[(10) - (12)].d), - NULL, (yyval.l)); + 0., 0., 0., (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], (yyvsp[(8) - (12)].v)[0], (yyvsp[(8) - (12)].v)[1], (yyvsp[(8) - (12)].v)[2], (yyvsp[(10) - (12)].d), + NULL, (yyval.l)); ;} break; @@ -6736,8 +6736,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (12)].d), - 0., 0., 0., (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], (yyvsp[(8) - (12)].v)[0], (yyvsp[(8) - (12)].v)[1], (yyvsp[(8) - (12)].v)[2], (yyvsp[(10) - (12)].d), - NULL, (yyval.l)); + 0., 0., 0., (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], (yyvsp[(8) - (12)].v)[0], (yyvsp[(8) - (12)].v)[1], (yyvsp[(8) - (12)].v)[2], (yyvsp[(10) - (12)].d), + NULL, (yyval.l)); ;} break; @@ -6746,8 +6746,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (12)].d), - 0., 0., 0., (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], (yyvsp[(8) - (12)].v)[0], (yyvsp[(8) - (12)].v)[1], (yyvsp[(8) - (12)].v)[2], (yyvsp[(10) - (12)].d), - NULL, (yyval.l)); + 0., 0., 0., (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], (yyvsp[(8) - (12)].v)[0], (yyvsp[(8) - (12)].v)[1], (yyvsp[(8) - (12)].v)[2], (yyvsp[(10) - (12)].d), + NULL, (yyval.l)); ;} break; @@ -6756,8 +6756,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_POINT, (int)(yyvsp[(4) - (14)].d), - (yyvsp[(6) - (14)].v)[0], (yyvsp[(6) - (14)].v)[1], (yyvsp[(6) - (14)].v)[2], (yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2], (yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2], (yyvsp[(12) - (14)].d), - NULL, (yyval.l)); + (yyvsp[(6) - (14)].v)[0], (yyvsp[(6) - (14)].v)[1], (yyvsp[(6) - (14)].v)[2], (yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2], (yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2], (yyvsp[(12) - (14)].d), + NULL, (yyval.l)); ;} break; @@ -6766,8 +6766,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (14)].d), - (yyvsp[(6) - (14)].v)[0], (yyvsp[(6) - (14)].v)[1], (yyvsp[(6) - (14)].v)[2], (yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2], (yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2], (yyvsp[(12) - (14)].d), - NULL, (yyval.l)); + (yyvsp[(6) - (14)].v)[0], (yyvsp[(6) - (14)].v)[1], (yyvsp[(6) - (14)].v)[2], (yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2], (yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2], (yyvsp[(12) - (14)].d), + NULL, (yyval.l)); ;} break; @@ -6776,8 +6776,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (14)].d), - (yyvsp[(6) - (14)].v)[0], (yyvsp[(6) - (14)].v)[1], (yyvsp[(6) - (14)].v)[2], (yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2], (yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2], (yyvsp[(12) - (14)].d), - NULL, (yyval.l)); + (yyvsp[(6) - (14)].v)[0], (yyvsp[(6) - (14)].v)[1], (yyvsp[(6) - (14)].v)[2], (yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2], (yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2], (yyvsp[(12) - (14)].d), + NULL, (yyval.l)); ;} break; @@ -6793,8 +6793,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_POINT, (int)(yyvsp[(4) - (12)].d), - (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], 0., 0., 0., 0., 0., 0., 0., - &extr, (yyval.l)); + (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], 0., 0., 0., 0., 0., 0., 0., + &extr, (yyval.l)); ;} break; @@ -6810,8 +6810,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (12)].d), - (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], 0., 0., 0., 0., 0., 0., 0., - &extr, (yyval.l)); + (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], 0., 0., 0., 0., 0., 0., 0., + &extr, (yyval.l)); ;} break; @@ -6827,8 +6827,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (12)].d), - (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], 0., 0., 0., 0., 0., 0., 0., - &extr, (yyval.l)); + (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], 0., 0., 0., 0., 0., 0., 0., + &extr, (yyval.l)); ;} break; @@ -6844,8 +6844,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_POINT, (int)(yyvsp[(4) - (16)].d), - 0., 0., 0., (yyvsp[(6) - (16)].v)[0], (yyvsp[(6) - (16)].v)[1], (yyvsp[(6) - (16)].v)[2], (yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2], (yyvsp[(10) - (16)].d), - &extr, (yyval.l)); + 0., 0., 0., (yyvsp[(6) - (16)].v)[0], (yyvsp[(6) - (16)].v)[1], (yyvsp[(6) - (16)].v)[2], (yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2], (yyvsp[(10) - (16)].d), + &extr, (yyval.l)); ;} break; @@ -6861,8 +6861,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (16)].d), - 0., 0., 0., (yyvsp[(6) - (16)].v)[0], (yyvsp[(6) - (16)].v)[1], (yyvsp[(6) - (16)].v)[2], (yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2], (yyvsp[(10) - (16)].d), - &extr, (yyval.l)); + 0., 0., 0., (yyvsp[(6) - (16)].v)[0], (yyvsp[(6) - (16)].v)[1], (yyvsp[(6) - (16)].v)[2], (yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2], (yyvsp[(10) - (16)].d), + &extr, (yyval.l)); ;} break; @@ -6878,8 +6878,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (16)].d), - 0., 0., 0., (yyvsp[(6) - (16)].v)[0], (yyvsp[(6) - (16)].v)[1], (yyvsp[(6) - (16)].v)[2], (yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2], (yyvsp[(10) - (16)].d), - &extr, (yyval.l)); + 0., 0., 0., (yyvsp[(6) - (16)].v)[0], (yyvsp[(6) - (16)].v)[1], (yyvsp[(6) - (16)].v)[2], (yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2], (yyvsp[(10) - (16)].d), + &extr, (yyval.l)); ;} break; @@ -6895,8 +6895,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_POINT, (int)(yyvsp[(4) - (18)].d), - (yyvsp[(6) - (18)].v)[0], (yyvsp[(6) - (18)].v)[1], (yyvsp[(6) - (18)].v)[2], (yyvsp[(8) - (18)].v)[0], (yyvsp[(8) - (18)].v)[1], (yyvsp[(8) - (18)].v)[2], (yyvsp[(10) - (18)].v)[0], (yyvsp[(10) - (18)].v)[1], (yyvsp[(10) - (18)].v)[2], (yyvsp[(12) - (18)].d), - &extr, (yyval.l)); + (yyvsp[(6) - (18)].v)[0], (yyvsp[(6) - (18)].v)[1], (yyvsp[(6) - (18)].v)[2], (yyvsp[(8) - (18)].v)[0], (yyvsp[(8) - (18)].v)[1], (yyvsp[(8) - (18)].v)[2], (yyvsp[(10) - (18)].v)[0], (yyvsp[(10) - (18)].v)[1], (yyvsp[(10) - (18)].v)[2], (yyvsp[(12) - (18)].d), + &extr, (yyval.l)); ;} break; @@ -6912,8 +6912,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (18)].d), - (yyvsp[(6) - (18)].v)[0], (yyvsp[(6) - (18)].v)[1], (yyvsp[(6) - (18)].v)[2], (yyvsp[(8) - (18)].v)[0], (yyvsp[(8) - (18)].v)[1], (yyvsp[(8) - (18)].v)[2], (yyvsp[(10) - (18)].v)[0], (yyvsp[(10) - (18)].v)[1], (yyvsp[(10) - (18)].v)[2], (yyvsp[(12) - (18)].d), - &extr, (yyval.l)); + (yyvsp[(6) - (18)].v)[0], (yyvsp[(6) - (18)].v)[1], (yyvsp[(6) - (18)].v)[2], (yyvsp[(8) - (18)].v)[0], (yyvsp[(8) - (18)].v)[1], (yyvsp[(8) - (18)].v)[2], (yyvsp[(10) - (18)].v)[0], (yyvsp[(10) - (18)].v)[1], (yyvsp[(10) - (18)].v)[2], (yyvsp[(12) - (18)].d), + &extr, (yyval.l)); ;} break; @@ -6929,8 +6929,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (18)].d), - (yyvsp[(6) - (18)].v)[0], (yyvsp[(6) - (18)].v)[1], (yyvsp[(6) - (18)].v)[2], (yyvsp[(8) - (18)].v)[0], (yyvsp[(8) - (18)].v)[1], (yyvsp[(8) - (18)].v)[2], (yyvsp[(10) - (18)].v)[0], (yyvsp[(10) - (18)].v)[1], (yyvsp[(10) - (18)].v)[2], (yyvsp[(12) - (18)].d), - &extr, (yyval.l)); + (yyvsp[(6) - (18)].v)[0], (yyvsp[(6) - (18)].v)[1], (yyvsp[(6) - (18)].v)[2], (yyvsp[(8) - (18)].v)[0], (yyvsp[(8) - (18)].v)[1], (yyvsp[(8) - (18)].v)[2], (yyvsp[(10) - (18)].v)[0], (yyvsp[(10) - (18)].v)[1], (yyvsp[(10) - (18)].v)[2], (yyvsp[(12) - (18)].d), + &extr, (yyval.l)); ;} break; @@ -6964,18 +6964,18 @@ yyreduce: extr.mesh.ExtrudeMesh = true; extr.mesh.NbLayer = List_Nbr((yyvsp[(3) - (7)].l)); if(List_Nbr((yyvsp[(3) - (7)].l)) == List_Nbr((yyvsp[(5) - (7)].l))){ - extr.mesh.NbElmLayer.clear(); - extr.mesh.hLayer.clear(); - for(int i = 0; i < List_Nbr((yyvsp[(3) - (7)].l)); i++){ - double d; - List_Read((yyvsp[(3) - (7)].l), i, &d); - extr.mesh.NbElmLayer.push_back((d > 0) ? (int)d : 1); - List_Read((yyvsp[(5) - (7)].l), i, &d); - extr.mesh.hLayer.push_back(d); - } + extr.mesh.NbElmLayer.clear(); + extr.mesh.hLayer.clear(); + for(int i = 0; i < List_Nbr((yyvsp[(3) - (7)].l)); i++){ + double d; + List_Read((yyvsp[(3) - (7)].l), i, &d); + extr.mesh.NbElmLayer.push_back((d > 0) ? (int)d : 1); + List_Read((yyvsp[(5) - (7)].l), i, &d); + extr.mesh.hLayer.push_back(d); + } } else - yymsg(0, "Wrong layer definition {%d, %d}", List_Nbr((yyvsp[(3) - (7)].l)), List_Nbr((yyvsp[(5) - (7)].l))); + yymsg(0, "Wrong layer definition {%d, %d}", List_Nbr((yyvsp[(3) - (7)].l)), List_Nbr((yyvsp[(5) - (7)].l))); List_Delete((yyvsp[(3) - (7)].l)); List_Delete((yyvsp[(5) - (7)].l)); ;} @@ -6988,19 +6988,19 @@ yyreduce: extr.mesh.ExtrudeMesh = true; extr.mesh.NbLayer = List_Nbr((yyvsp[(3) - (9)].l)); if(List_Nbr((yyvsp[(3) - (9)].l)) == List_Nbr((yyvsp[(5) - (9)].l)) && List_Nbr((yyvsp[(3) - (9)].l)) == List_Nbr((yyvsp[(7) - (9)].l))){ - extr.mesh.NbElmLayer.clear(); - extr.mesh.hLayer.clear(); - for(int i = 0; i < List_Nbr((yyvsp[(3) - (9)].l)); i++){ - double d; - List_Read((yyvsp[(3) - (9)].l), i, &d); - extr.mesh.NbElmLayer.push_back((d > 0) ? (int)d : 1); - List_Read((yyvsp[(7) - (9)].l), i, &d); - extr.mesh.hLayer.push_back(d); - } + extr.mesh.NbElmLayer.clear(); + extr.mesh.hLayer.clear(); + for(int i = 0; i < List_Nbr((yyvsp[(3) - (9)].l)); i++){ + double d; + List_Read((yyvsp[(3) - (9)].l), i, &d); + extr.mesh.NbElmLayer.push_back((d > 0) ? (int)d : 1); + List_Read((yyvsp[(7) - (9)].l), i, &d); + extr.mesh.hLayer.push_back(d); + } } else - yymsg(0, "Wrong layer definition {%d, %d, %d}", List_Nbr((yyvsp[(3) - (9)].l)), - List_Nbr((yyvsp[(5) - (9)].l)), List_Nbr((yyvsp[(7) - (9)].l))); + yymsg(0, "Wrong layer definition {%d, %d, %d}", List_Nbr((yyvsp[(3) - (9)].l)), + List_Nbr((yyvsp[(5) - (9)].l)), List_Nbr((yyvsp[(7) - (9)].l))); List_Delete((yyvsp[(3) - (9)].l)); List_Delete((yyvsp[(5) - (9)].l)); List_Delete((yyvsp[(7) - (9)].l)); @@ -7019,18 +7019,18 @@ yyreduce: { int num = (int)(yyvsp[(3) - (9)].d); if(FindSurface(num)){ - yymsg(0, "Surface %d already exists", num); + yymsg(0, "Surface %d already exists", num); } else{ - Surface *s = Create_Surface(num, MSH_SURF_DISCRETE); - Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); - extr.mesh.Holes[num].first = (yyvsp[(8) - (9)].d); - extr.mesh.Holes[num].second.clear(); - for(int i = 0; i < List_Nbr((yyvsp[(6) - (9)].l)); i++){ - double d; - List_Read((yyvsp[(6) - (9)].l), i, &d); - extr.mesh.Holes[num].second.push_back((int)d); - } + Surface *s = Create_Surface(num, MSH_SURF_DISCRETE); + Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); + extr.mesh.Holes[num].first = (yyvsp[(8) - (9)].d); + extr.mesh.Holes[num].second.clear(); + for(int i = 0; i < List_Nbr((yyvsp[(6) - (9)].l)); i++){ + double d; + List_Read((yyvsp[(6) - (9)].l), i, &d); + extr.mesh.Holes[num].second.push_back((int)d); + } } List_Delete((yyvsp[(6) - (9)].l)); ;} @@ -7321,7 +7321,7 @@ yyreduce: #line 3091 "Gmsh.y" { if(!(yyvsp[(3) - (5)].l)){ - List_T *tmp = Tree2List(GModel::current()->getGEOInternals()->Surfaces); + List_T *tmp = Tree2List(GModel::current()->getGEOInternals()->Surfaces); if(List_Nbr(tmp)){ for(int i = 0; i < List_Nbr(tmp); i++){ Surface *s; @@ -7367,19 +7367,19 @@ yyreduce: #line 3134 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(3) - (6)].l)); i++){ - double d; - List_Read((yyvsp[(3) - (6)].l), i, &d); - int j = (int)d; - Surface *s = FindSurface(j); - if(s){ + double d; + List_Read((yyvsp[(3) - (6)].l), i, &d); + int j = (int)d; + Surface *s = FindSurface(j); + if(s){ s->TransfiniteSmoothing = (int)(yyvsp[(5) - (6)].d); } else{ - GFace *gf = GModel::current()->getFaceByTag(j); - if(gf) + GFace *gf = GModel::current()->getFaceByTag(j); + if(gf) gf->meshAttributes.transfiniteSmoothing = (int)(yyvsp[(5) - (6)].d); else - yymsg(1, "Unknown surface %d", (int)(yyvsp[(5) - (6)].d)); + yymsg(1, "Unknown surface %d", (int)(yyvsp[(5) - (6)].d)); } } List_Delete((yyvsp[(3) - (6)].l)); @@ -7391,7 +7391,7 @@ yyreduce: { Surface *s = FindSurface((int)(yyvsp[(8) - (10)].d)); if(s){ - setSurfaceEmbeddedPoints(s, (yyvsp[(3) - (10)].l)); + setSurfaceEmbeddedPoints(s, (yyvsp[(3) - (10)].l)); } else{ GFace *gf = GModel::current()->getFaceByTag((int)(yyvsp[(8) - (10)].d)); @@ -7417,7 +7417,7 @@ yyreduce: { Surface *s = FindSurface((int)(yyvsp[(8) - (10)].d)); if(s){ - setSurfaceEmbeddedCurves(s, (yyvsp[(3) - (10)].l)); + setSurfaceEmbeddedCurves(s, (yyvsp[(3) - (10)].l)); } else{ GFace *gf = GModel::current()->getFaceByTag((int)(yyvsp[(8) - (10)].d)); @@ -7514,9 +7514,9 @@ yyreduce: #line 3246 "Gmsh.y" { if(!(yyvsp[(3) - (3)].d)) - yymsg(0, "Division by zero in '%g / %g'", (yyvsp[(1) - (3)].d), (yyvsp[(3) - (3)].d)); + yymsg(0, "Division by zero in '%g / %g'", (yyvsp[(1) - (3)].d), (yyvsp[(3) - (3)].d)); else - (yyval.d) = (yyvsp[(1) - (3)].d) / (yyvsp[(3) - (3)].d); + (yyval.d) = (yyvsp[(1) - (3)].d) / (yyvsp[(3) - (3)].d); ;} break; @@ -7824,11 +7824,11 @@ yyreduce: #line 3325 "Gmsh.y" { if(!gmsh_yysymbols.count((yyvsp[(1) - (1)].c))){ - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (1)].c)); - (yyval.d) = 0.; + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (1)].c)); + (yyval.d) = 0.; } else - (yyval.d) = gmsh_yysymbols[(yyvsp[(1) - (1)].c)][0]; + (yyval.d) = gmsh_yysymbols[(yyvsp[(1) - (1)].c)][0]; Free((yyvsp[(1) - (1)].c)); ;} break; @@ -7839,11 +7839,11 @@ yyreduce: char tmpstring[1024]; sprintf(tmpstring, "%s_%d", (yyvsp[(1) - (5)].c), (int)(yyvsp[(4) - (5)].d)) ; if(!gmsh_yysymbols.count(tmpstring)){ - yymsg(0, "Unknown variable '%s'", tmpstring); - (yyval.d) = 0.; + yymsg(0, "Unknown variable '%s'", tmpstring); + (yyval.d) = 0.; } else - (yyval.d) = gmsh_yysymbols[tmpstring][0]; + (yyval.d) = gmsh_yysymbols[tmpstring][0]; Free((yyvsp[(1) - (5)].c)); ;} break; @@ -7853,15 +7853,15 @@ yyreduce: { int index = (int)(yyvsp[(3) - (4)].d); if(!gmsh_yysymbols.count((yyvsp[(1) - (4)].c))){ - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (4)].c)); - (yyval.d) = 0.; + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (4)].c)); + (yyval.d) = 0.; } else if((int)gmsh_yysymbols[(yyvsp[(1) - (4)].c)].size() < index + 1){ - yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (4)].c), index); - (yyval.d) = 0.; + yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (4)].c), index); + (yyval.d) = 0.; } else - (yyval.d) = gmsh_yysymbols[(yyvsp[(1) - (4)].c)][index]; + (yyval.d) = gmsh_yysymbols[(yyvsp[(1) - (4)].c)][index]; Free((yyvsp[(1) - (4)].c)); ;} break; @@ -7870,11 +7870,11 @@ yyreduce: #line 3365 "Gmsh.y" { if(!gmsh_yysymbols.count((yyvsp[(2) - (4)].c))){ - yymsg(0, "Unknown variable '%s'", (yyvsp[(2) - (4)].c)); - (yyval.d) = 0.; + yymsg(0, "Unknown variable '%s'", (yyvsp[(2) - (4)].c)); + (yyval.d) = 0.; } else - (yyval.d) = gmsh_yysymbols[(yyvsp[(2) - (4)].c)].size(); + (yyval.d) = gmsh_yysymbols[(yyvsp[(2) - (4)].c)].size(); Free((yyvsp[(2) - (4)].c)); ;} break; @@ -7883,11 +7883,11 @@ yyreduce: #line 3375 "Gmsh.y" { if(!gmsh_yysymbols.count((yyvsp[(1) - (2)].c))){ - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (2)].c)); - (yyval.d) = 0.; + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (2)].c)); + (yyval.d) = 0.; } else - (yyval.d) = (gmsh_yysymbols[(yyvsp[(1) - (2)].c)][0] += (yyvsp[(2) - (2)].i)); + (yyval.d) = (gmsh_yysymbols[(yyvsp[(1) - (2)].c)][0] += (yyvsp[(2) - (2)].i)); Free((yyvsp[(1) - (2)].c)); ;} break; @@ -7897,15 +7897,15 @@ yyreduce: { int index = (int)(yyvsp[(3) - (5)].d); if(!gmsh_yysymbols.count((yyvsp[(1) - (5)].c))){ - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (5)].c)); - (yyval.d) = 0.; + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (5)].c)); + (yyval.d) = 0.; } else if((int)gmsh_yysymbols[(yyvsp[(1) - (5)].c)].size() < index + 1){ - yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (5)].c), index); - (yyval.d) = 0.; + yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (5)].c), index); + (yyval.d) = 0.; } else - (yyval.d) = (gmsh_yysymbols[(yyvsp[(1) - (5)].c)][index] += (yyvsp[(5) - (5)].i)); + (yyval.d) = (gmsh_yysymbols[(yyvsp[(1) - (5)].c)][index] += (yyvsp[(5) - (5)].i)); Free((yyvsp[(1) - (5)].c)); ;} break; @@ -7931,9 +7931,9 @@ yyreduce: { double d = 0.; if(NumberOption(GMSH_GET, (yyvsp[(1) - (4)].c), 0, (yyvsp[(3) - (4)].c), d)){ - d += (yyvsp[(4) - (4)].i); - NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (4)].c), 0, (yyvsp[(3) - (4)].c), d); - (yyval.d) = d; + d += (yyvsp[(4) - (4)].i); + NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (4)].c), 0, (yyvsp[(3) - (4)].c), d); + (yyval.d) = d; } Free((yyvsp[(1) - (4)].c)); Free((yyvsp[(3) - (4)].c)); ;} @@ -7944,9 +7944,9 @@ yyreduce: { double d = 0.; if(NumberOption(GMSH_GET, (yyvsp[(1) - (7)].c), (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c), d)){ - d += (yyvsp[(7) - (7)].i); - NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (7)].c), (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c), d); - (yyval.d) = d; + d += (yyvsp[(7) - (7)].i); + NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (7)].c), (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c), d); + (yyval.d) = d; } Free((yyvsp[(1) - (7)].c)); Free((yyvsp[(6) - (7)].c)); ;} @@ -8073,8 +8073,8 @@ yyreduce: { (yyval.l) = (yyvsp[(3) - (4)].l); for(int i = 0; i < List_Nbr((yyval.l)); i++){ - double *pd = (double*)List_Pointer((yyval.l), i); - (*pd) = - (*pd); + double *pd = (double*)List_Pointer((yyval.l), i); + (*pd) = - (*pd); } ;} break; @@ -8084,8 +8084,8 @@ yyreduce: { (yyval.l) = (yyvsp[(4) - (5)].l); for(int i = 0; i < List_Nbr((yyval.l)); i++){ - double *pd = (double*)List_Pointer((yyval.l), i); - (*pd) *= (yyvsp[(1) - (5)].d); + double *pd = (double*)List_Pointer((yyval.l), i); + (*pd) *= (yyvsp[(1) - (5)].d); } ;} break; @@ -8114,8 +8114,8 @@ yyreduce: { (yyval.l) = (yyvsp[(2) - (2)].l); for(int i = 0; i < List_Nbr((yyval.l)); i++){ - double *pd = (double*)List_Pointer((yyval.l), i); - (*pd) = - (*pd); + double *pd = (double*)List_Pointer((yyval.l), i); + (*pd) = - (*pd); } ;} break; @@ -8125,8 +8125,8 @@ yyreduce: { (yyval.l) = (yyvsp[(3) - (3)].l); for(int i = 0; i < List_Nbr((yyval.l)); i++){ - double *pd = (double*)List_Pointer((yyval.l), i); - (*pd) *= (yyvsp[(1) - (3)].d); + double *pd = (double*)List_Pointer((yyval.l), i); + (*pd) *= (yyvsp[(1) - (3)].d); } ;} break; @@ -8137,7 +8137,7 @@ yyreduce: (yyval.l) = List_Create(2, 1, sizeof(double)); for(double d = (yyvsp[(1) - (3)].d); ((yyvsp[(1) - (3)].d) < (yyvsp[(3) - (3)].d)) ? (d <= (yyvsp[(3) - (3)].d)) : (d >= (yyvsp[(3) - (3)].d)); ((yyvsp[(1) - (3)].d) < (yyvsp[(3) - (3)].d)) ? (d += 1.) : (d -= 1.)) - List_Add((yyval.l), &d); + List_Add((yyval.l), &d); ;} break; @@ -8147,11 +8147,11 @@ yyreduce: (yyval.l) = List_Create(2, 1, sizeof(double)); if(!(yyvsp[(5) - (5)].d) || ((yyvsp[(1) - (5)].d) < (yyvsp[(3) - (5)].d) && (yyvsp[(5) - (5)].d) < 0) || ((yyvsp[(1) - (5)].d) > (yyvsp[(3) - (5)].d) && (yyvsp[(5) - (5)].d) > 0)){ yymsg(0, "Wrong increment in '%g:%g:%g'", (yyvsp[(1) - (5)].d), (yyvsp[(3) - (5)].d), (yyvsp[(5) - (5)].d)); - List_Add((yyval.l), &((yyvsp[(1) - (5)].d))); + List_Add((yyval.l), &((yyvsp[(1) - (5)].d))); } else - for(double d = (yyvsp[(1) - (5)].d); ((yyvsp[(5) - (5)].d) > 0) ? (d <= (yyvsp[(3) - (5)].d)) : (d >= (yyvsp[(3) - (5)].d)); d += (yyvsp[(5) - (5)].d)) - List_Add((yyval.l), &d); + for(double d = (yyvsp[(1) - (5)].d); ((yyvsp[(5) - (5)].d) > 0) ? (d <= (yyvsp[(3) - (5)].d)) : (d >= (yyvsp[(3) - (5)].d)); d += (yyvsp[(5) - (5)].d)) + List_Add((yyval.l), &d); ;} break; @@ -8164,16 +8164,16 @@ yyreduce: Vertex *v = FindPoint((int)(yyvsp[(3) - (4)].d)); (yyval.l) = List_Create(3, 1, sizeof(double)); if(!v) { - yymsg(0, "Unknown point '%d'", (int)(yyvsp[(3) - (4)].d)); - double d = 0.0; - List_Add((yyval.l), &d); - List_Add((yyval.l), &d); - List_Add((yyval.l), &d); + yymsg(0, "Unknown point '%d'", (int)(yyvsp[(3) - (4)].d)); + double d = 0.0; + List_Add((yyval.l), &d); + List_Add((yyval.l), &d); + List_Add((yyval.l), &d); } else{ - List_Add((yyval.l), &v->Pos.X); - List_Add((yyval.l), &v->Pos.Y); - List_Add((yyval.l), &v->Pos.Z); + List_Add((yyval.l), &v->Pos.X); + List_Add((yyval.l), &v->Pos.Y); + List_Add((yyval.l), &v->Pos.Z); } ;} break; @@ -8183,9 +8183,9 @@ yyreduce: { (yyval.l) = List_Create(List_Nbr((yyvsp[(1) - (1)].l)), 1, sizeof(double)); for(int i = 0; i < List_Nbr((yyvsp[(1) - (1)].l)); i++){ - Shape *s = (Shape*) List_Pointer((yyvsp[(1) - (1)].l), i); - double d = s->Num; - List_Add((yyval.l), &d); + Shape *s = (Shape*) List_Pointer((yyvsp[(1) - (1)].l), i); + double d = s->Num; + List_Add((yyval.l), &d); } List_Delete((yyvsp[(1) - (1)].l)); ;} @@ -8196,9 +8196,9 @@ yyreduce: { (yyval.l) = List_Create(List_Nbr((yyvsp[(1) - (1)].l)), 1, sizeof(double)); for(int i = 0; i < List_Nbr((yyvsp[(1) - (1)].l)); i++){ - Shape *s = (Shape*) List_Pointer((yyvsp[(1) - (1)].l), i); - double d = s->Num; - List_Add((yyval.l), &d); + Shape *s = (Shape*) List_Pointer((yyvsp[(1) - (1)].l), i); + double d = s->Num; + List_Add((yyval.l), &d); } List_Delete((yyvsp[(1) - (1)].l)); ;} @@ -8209,10 +8209,10 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(double)); if(!gmsh_yysymbols.count((yyvsp[(1) - (3)].c))) - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (3)].c)); + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (3)].c)); else - for(unsigned int i = 0; i < gmsh_yysymbols[(yyvsp[(1) - (3)].c)].size(); i++) - List_Add((yyval.l), &gmsh_yysymbols[(yyvsp[(1) - (3)].c)][i]); + for(unsigned int i = 0; i < gmsh_yysymbols[(yyvsp[(1) - (3)].c)].size(); i++) + List_Add((yyval.l), &gmsh_yysymbols[(yyvsp[(1) - (3)].c)][i]); Free((yyvsp[(1) - (3)].c)); ;} break; @@ -8222,15 +8222,15 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(double)); if(!gmsh_yysymbols.count((yyvsp[(1) - (6)].c))) - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (6)].c)); + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (6)].c)); else{ - for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){ - int index = (int)(*(double*)List_Pointer_Fast((yyvsp[(4) - (6)].l), i)); - if((int)gmsh_yysymbols[(yyvsp[(1) - (6)].c)].size() < index + 1) - yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (6)].c), index); - else - List_Add((yyval.l), &gmsh_yysymbols[(yyvsp[(1) - (6)].c)][index]); - } + for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){ + int index = (int)(*(double*)List_Pointer_Fast((yyvsp[(4) - (6)].l), i)); + if((int)gmsh_yysymbols[(yyvsp[(1) - (6)].c)].size() < index + 1) + yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (6)].c), index); + else + List_Add((yyval.l), &gmsh_yysymbols[(yyvsp[(1) - (6)].c)][index]); + } } Free((yyvsp[(1) - (6)].c)); List_Delete((yyvsp[(4) - (6)].l)); @@ -8263,9 +8263,9 @@ yyreduce: #line 3665 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(3) - (3)].l)); i++){ - double d; - List_Read((yyvsp[(3) - (3)].l), i, &d); - List_Add((yyval.l), &d); + double d; + List_Read((yyvsp[(3) - (3)].l), i, &d); + List_Add((yyval.l), &d); } List_Delete((yyvsp[(3) - (3)].l)); ;} @@ -8318,10 +8318,10 @@ yyreduce: (yyval.l) = List_Create(256, 10, sizeof(unsigned int)); GmshColorTable *ct = GetColorTable((int)(yyvsp[(3) - (6)].d)); if(!ct) - yymsg(0, "View[%d] does not exist", (int)(yyvsp[(3) - (6)].d)); + yymsg(0, "View[%d] does not exist", (int)(yyvsp[(3) - (6)].d)); else{ - for(int i = 0; i < ct->size; i++) - List_Add((yyval.l), &ct->table[i]); + for(int i = 0; i < ct->size; i++) + List_Add((yyval.l), &ct->table[i]); } Free((yyvsp[(1) - (6)].c)); ;} @@ -8353,14 +8353,14 @@ yyreduce: #line 3745 "Gmsh.y" { if(!gmsh_yystringsymbols.count((yyvsp[(1) - (1)].c))){ - yymsg(0, "Unknown string variable '%s'", (yyvsp[(1) - (1)].c)); - (yyval.c) = (yyvsp[(1) - (1)].c); + yymsg(0, "Unknown string variable '%s'", (yyvsp[(1) - (1)].c)); + (yyval.c) = (yyvsp[(1) - (1)].c); } else{ - std::string val = gmsh_yystringsymbols[(yyvsp[(1) - (1)].c)]; - (yyval.c) = (char *)Malloc((val.size() + 1) * sizeof(char)); - strcpy((yyval.c), val.c_str()); - Free((yyvsp[(1) - (1)].c)); + std::string val = gmsh_yystringsymbols[(yyvsp[(1) - (1)].c)]; + (yyval.c) = (char *)Malloc((val.size() + 1) * sizeof(char)); + strcpy((yyval.c), val.c_str()); + Free((yyvsp[(1) - (1)].c)); } ;} break; @@ -8422,11 +8422,11 @@ yyreduce: (yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (4)].c)) + 1) * sizeof(char)); int i; for(i = strlen((yyvsp[(3) - (4)].c)) - 1; i >= 0; i--){ - if((yyvsp[(3) - (4)].c)[i] == '.'){ - strncpy((yyval.c), (yyvsp[(3) - (4)].c), i); - (yyval.c)[i]='\0'; - break; - } + if((yyvsp[(3) - (4)].c)[i] == '.'){ + strncpy((yyval.c), (yyvsp[(3) - (4)].c), i); + (yyval.c)[i]='\0'; + break; + } } if(i <= 0) strcpy((yyval.c), (yyvsp[(3) - (4)].c)); Free((yyvsp[(3) - (4)].c)); @@ -8439,13 +8439,13 @@ yyreduce: (yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (4)].c)) + 1) * sizeof(char)); int i; for(i = strlen((yyvsp[(3) - (4)].c)) - 1; i >= 0; i--){ - if((yyvsp[(3) - (4)].c)[i] == '/' || (yyvsp[(3) - (4)].c)[i] == '\\') - break; + if((yyvsp[(3) - (4)].c)[i] == '/' || (yyvsp[(3) - (4)].c)[i] == '\\') + break; } if(i <= 0) - strcpy((yyval.c), (yyvsp[(3) - (4)].c)); + strcpy((yyval.c), (yyvsp[(3) - (4)].c)); else - strcpy((yyval.c), &(yyvsp[(3) - (4)].c)[i+1]); + strcpy((yyval.c), &(yyvsp[(3) - (4)].c)[i+1]); Free((yyvsp[(3) - (4)].c)); ;} break; @@ -8463,17 +8463,17 @@ yyreduce: char tmpstring[1024]; int i = PrintListOfDouble((yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].l), tmpstring); if(i < 0){ - yymsg(0, "Too few arguments in Sprintf"); - (yyval.c) = (yyvsp[(3) - (6)].c); + yymsg(0, "Too few arguments in Sprintf"); + (yyval.c) = (yyvsp[(3) - (6)].c); } else if(i > 0){ - yymsg(0, "%d extra argument%s in Sprintf", i, (i > 1) ? "s" : ""); - (yyval.c) = (yyvsp[(3) - (6)].c); + yymsg(0, "%d extra argument%s in Sprintf", i, (i > 1) ? "s" : ""); + (yyval.c) = (yyvsp[(3) - (6)].c); } else{ - (yyval.c) = (char*)Malloc((strlen(tmpstring) + 1) * sizeof(char)); - strcpy((yyval.c), tmpstring); - Free((yyvsp[(3) - (6)].c)); + (yyval.c) = (char*)Malloc((strlen(tmpstring) + 1) * sizeof(char)); + strcpy((yyval.c), tmpstring); + Free((yyvsp[(3) - (6)].c)); } List_Delete((yyvsp[(5) - (6)].l)); ;} @@ -8520,35 +8520,35 @@ yyerrlab: yyerror (YY_("syntax error")); #else { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } } #endif } @@ -8558,20 +8558,20 @@ yyerrlab: if (yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an - error, discard it. */ + error, discard it. */ if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } } /* Else will try to reuse look-ahead token after shifting the error @@ -8603,29 +8603,29 @@ yyerrorlab: | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) - YYABORT; + YYABORT; yydestruct ("Error: popping", - yystos[yystate], yyvsp); + yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -8671,7 +8671,7 @@ yyexhaustedlab: yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); + yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); @@ -8679,7 +8679,7 @@ yyreturn: while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); + yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow @@ -8714,15 +8714,15 @@ int PrintListOfDouble(char *format, List_T *list, char *buffer) j++; if(j < (int)strlen(format)){ if(format[j] == '%'){ - strcat(buffer, "%"); - j++; + strcat(buffer, "%"); + j++; } while(j < (int)strlen(format) && format[j] != '%') j++; if(k != j){ - strncpy(tmp1, &(format[k]), j-k); - tmp1[j-k] = '\0'; - sprintf(tmp2, tmp1, *(double*)List_Pointer(list, i)); - strcat(buffer, tmp2); + strncpy(tmp1, &(format[k]), j-k); + tmp1[j-k] = '\0'; + sprintf(tmp2, tmp1, *(double*)List_Pointer(list, i)); + strcat(buffer, tmp2); } } else diff --git a/Parser/Gmsh.yy.cpp b/Parser/Gmsh.yy.cpp index c9352af877..54ff7d22fa 100644 --- a/Parser/Gmsh.yy.cpp +++ b/Parser/Gmsh.yy.cpp @@ -92,14 +92,14 @@ typedef unsigned int flex_uint32_t; /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST -#else /* ! __cplusplus */ +#else /* ! __cplusplus */ #if __STDC__ #define YY_USE_CONST -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const @@ -164,17 +164,17 @@ extern FILE *gmsh_yyin, *gmsh_yyout; /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up gmsh_yytext. */ \ + do \ + { \ + /* Undo effects of setting up gmsh_yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up gmsh_yytext again */ \ - } \ - while ( 0 ) + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up gmsh_yytext again */ \ + } \ + while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) @@ -191,66 +191,66 @@ typedef unsigned int yy_size_t; #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; - int yy_buffer_status; + int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via gmsh_yyrestart()), so that the user can continue scanning by - * just pointing gmsh_yyin at a new input file. - */ + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via gmsh_yyrestart()), so that the user can continue scanning by + * just pointing gmsh_yyin at a new input file. + */ #define YY_BUFFER_EOF_PENDING 2 - }; + }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ @@ -275,13 +275,13 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* yy_hold_char holds the character lost when gmsh_yytext is formed. */ static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ +static int yy_n_chars; /* number of characters read into yy_ch_buf */ int gmsh_yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ /* Flag which is used to allow gmsh_yywrap()'s to do buffer switches * instead of setting up a fresh gmsh_yyin. A bit of a hack ... @@ -313,24 +313,24 @@ void gmsh_yyfree (void * ); #define yy_new_buffer gmsh_yy_create_buffer #define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ gmsh_yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ + YY_CURRENT_BUFFER_LVALUE = \ gmsh_yy_create_buffer(gmsh_yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } #define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ + { \ + if ( ! YY_CURRENT_BUFFER ){\ gmsh_yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ + YY_CURRENT_BUFFER_LVALUE = \ gmsh_yy_create_buffer(gmsh_yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) @@ -358,21 +358,21 @@ static void yy_fatal_error (yyconst char msg[] ); * corresponding action - sets up gmsh_yytext. */ #define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - gmsh_yyleng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; + (yytext_ptr) = yy_bp; \ + gmsh_yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 147 #define YY_END_OF_BUFFER 148 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; static yyconst flex_int16_t yy_accept[634] = { 0, 0, 0, 148, 146, 1, 1, 146, 5, 146, 6, @@ -863,20 +863,20 @@ char *strsave(char *ptr); void skipcomments(void); void skipline(void); -#define YY_INPUT(buf,result,max_size) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( gmsh_yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ){ \ - buf[n++] = (char) c; \ - gmsh_yylineno++; \ - } \ - if ( c == EOF && ferror( gmsh_yyin ) ) \ - Msg::Fatal("Input in flex scanner failed"); \ - result = n; \ - } \ +#define YY_INPUT(buf,result,max_size) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( gmsh_yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ){ \ + buf[n++] = (char) c; \ + gmsh_yylineno++; \ + } \ + if ( c == EOF && ferror( gmsh_yyin ) ) \ + Msg::Fatal("Input in flex scanner failed"); \ + result = n; \ + } \ #if defined(WIN32) #define isatty(arg) -1 @@ -951,33 +951,33 @@ static int input (void ); */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( gmsh_yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( gmsh_yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, gmsh_yyin))==0 && ferror(gmsh_yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(gmsh_yyin); \ - } \ - }\ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( gmsh_yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( gmsh_yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, gmsh_yyin))==0 && ferror(gmsh_yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(gmsh_yyin); \ + } \ + }\ \ #endif @@ -1026,803 +1026,803 @@ extern int gmsh_yylex (void); #endif #define YY_RULE_SETUP \ - YY_USER_ACTION + YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; #line 49 "Gmsh.l" #line 1043 "Gmsh.yy.cpp" - if ( !(yy_init) ) - { - (yy_init) = 1; + if ( !(yy_init) ) + { + (yy_init) = 1; #ifdef YY_USER_INIT - YY_USER_INIT; + YY_USER_INIT; #endif - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ - if ( ! gmsh_yyin ) - gmsh_yyin = stdin; + if ( ! gmsh_yyin ) + gmsh_yyin = stdin; - if ( ! gmsh_yyout ) - gmsh_yyout = stdout; + if ( ! gmsh_yyout ) + gmsh_yyout = stdout; - if ( ! YY_CURRENT_BUFFER ) { - gmsh_yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - gmsh_yy_create_buffer(gmsh_yyin,YY_BUF_SIZE ); - } + if ( ! YY_CURRENT_BUFFER ) { + gmsh_yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + gmsh_yy_create_buffer(gmsh_yyin,YY_BUF_SIZE ); + } - gmsh_yy_load_buffer_state( ); - } + gmsh_yy_load_buffer_state( ); + } - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); - /* Support of gmsh_yytext. */ - *yy_cp = (yy_hold_char); + /* Support of gmsh_yytext. */ + *yy_cp = (yy_hold_char); - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; - yy_current_state = (yy_start); + yy_current_state = (yy_start); yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 634 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 756 ); + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 634 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 756 ); yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; case 1: /* rule 1 can match eol */ YY_RULE_SETUP #line 51 "Gmsh.l" /* none */; - YY_BREAK + YY_BREAK case 2: YY_RULE_SETUP #line 52 "Gmsh.l" return tEND; - YY_BREAK + YY_BREAK case 3: YY_RULE_SETUP #line 53 "Gmsh.l" skipcomments(); - YY_BREAK + YY_BREAK case 4: YY_RULE_SETUP #line 54 "Gmsh.l" skipline(); - YY_BREAK + YY_BREAK case 5: YY_RULE_SETUP #line 55 "Gmsh.l" { parsestring('\"'); return tBIGSTR; } - YY_BREAK + YY_BREAK case 6: YY_RULE_SETUP #line 56 "Gmsh.l" { parsestring('\''); return tBIGSTR; } - YY_BREAK + YY_BREAK case 7: YY_RULE_SETUP #line 57 "Gmsh.l" { gmsh_yylval.d = NEWREG(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 8: YY_RULE_SETUP #line 58 "Gmsh.l" { gmsh_yylval.d = NEWPOINT(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 9: YY_RULE_SETUP #line 59 "Gmsh.l" { gmsh_yylval.d = NEWLINE(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 10: YY_RULE_SETUP #line 60 "Gmsh.l" { gmsh_yylval.d = NEWLINE(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 11: YY_RULE_SETUP #line 61 "Gmsh.l" { gmsh_yylval.d = NEWLINELOOP(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 12: YY_RULE_SETUP #line 62 "Gmsh.l" { gmsh_yylval.d = NEWSURFACE(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 13: YY_RULE_SETUP #line 63 "Gmsh.l" { gmsh_yylval.d = NEWSURFACELOOP(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 14: YY_RULE_SETUP #line 64 "Gmsh.l" { gmsh_yylval.d = NEWVOLUME(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 15: YY_RULE_SETUP #line 65 "Gmsh.l" { gmsh_yylval.d = NEWFIELD(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 16: YY_RULE_SETUP #line 66 "Gmsh.l" return tAFFECT; - YY_BREAK + YY_BREAK case 17: YY_RULE_SETUP #line 67 "Gmsh.l" return tAFFECTPLUS; - YY_BREAK + YY_BREAK case 18: YY_RULE_SETUP #line 68 "Gmsh.l" return tAFFECTMINUS; - YY_BREAK + YY_BREAK case 19: YY_RULE_SETUP #line 69 "Gmsh.l" return tAFFECTTIMES; - YY_BREAK + YY_BREAK case 20: YY_RULE_SETUP #line 70 "Gmsh.l" return tAFFECTDIVIDE; - YY_BREAK + YY_BREAK case 21: YY_RULE_SETUP #line 71 "Gmsh.l" return tDOTS; - YY_BREAK + YY_BREAK case 22: YY_RULE_SETUP #line 72 "Gmsh.l" return tDOTS; - YY_BREAK + YY_BREAK case 23: YY_RULE_SETUP #line 73 "Gmsh.l" return tOR; - YY_BREAK + YY_BREAK case 24: YY_RULE_SETUP #line 74 "Gmsh.l" return tAND; - YY_BREAK + YY_BREAK case 25: YY_RULE_SETUP #line 75 "Gmsh.l" return tPLUSPLUS; - YY_BREAK + YY_BREAK case 26: YY_RULE_SETUP #line 76 "Gmsh.l" return tMINUSMINUS; - YY_BREAK + YY_BREAK case 27: YY_RULE_SETUP #line 77 "Gmsh.l" return tEQUAL; - YY_BREAK + YY_BREAK case 28: YY_RULE_SETUP #line 78 "Gmsh.l" return tNOTEQUAL; - YY_BREAK + YY_BREAK case 29: YY_RULE_SETUP #line 79 "Gmsh.l" return tLESSOREQUAL; - YY_BREAK + YY_BREAK case 30: YY_RULE_SETUP #line 80 "Gmsh.l" return tGREATEROREQUAL; - YY_BREAK + YY_BREAK case 31: YY_RULE_SETUP #line 82 "Gmsh.l" return tAcos; - YY_BREAK + YY_BREAK case 32: YY_RULE_SETUP #line 83 "Gmsh.l" return tAcos; - YY_BREAK + YY_BREAK case 33: YY_RULE_SETUP #line 84 "Gmsh.l" return tAlias; - YY_BREAK + YY_BREAK case 34: YY_RULE_SETUP #line 85 "Gmsh.l" return tAliasWithOptions; - YY_BREAK + YY_BREAK case 35: YY_RULE_SETUP #line 86 "Gmsh.l" return tAsin; - YY_BREAK + YY_BREAK case 36: YY_RULE_SETUP #line 87 "Gmsh.l" return tAsin; - YY_BREAK + YY_BREAK case 37: YY_RULE_SETUP #line 88 "Gmsh.l" return tAtan; - YY_BREAK + YY_BREAK case 38: YY_RULE_SETUP #line 89 "Gmsh.l" return tAtan; - YY_BREAK + YY_BREAK case 39: YY_RULE_SETUP #line 90 "Gmsh.l" return tAtan2; - YY_BREAK + YY_BREAK case 40: YY_RULE_SETUP #line 91 "Gmsh.l" return tAtan2; - YY_BREAK + YY_BREAK case 41: YY_RULE_SETUP #line 93 "Gmsh.l" return tBezier; - YY_BREAK + YY_BREAK case 42: YY_RULE_SETUP #line 94 "Gmsh.l" return tBSpline; - YY_BREAK + YY_BREAK case 43: YY_RULE_SETUP #line 95 "Gmsh.l" return tBoundingBox; - YY_BREAK + YY_BREAK case 44: YY_RULE_SETUP #line 97 "Gmsh.l" return tCeil; - YY_BREAK + YY_BREAK case 45: YY_RULE_SETUP #line 98 "Gmsh.l" return tCircle; - YY_BREAK + YY_BREAK case 46: YY_RULE_SETUP #line 99 "Gmsh.l" return tCoherence; - YY_BREAK + YY_BREAK case 47: YY_RULE_SETUP #line 100 "Gmsh.l" return tCombine; - YY_BREAK + YY_BREAK case 48: YY_RULE_SETUP #line 101 "Gmsh.l" return tCosh; - YY_BREAK + YY_BREAK case 49: YY_RULE_SETUP #line 102 "Gmsh.l" return tCos; - YY_BREAK + YY_BREAK case 50: YY_RULE_SETUP #line 103 "Gmsh.l" return tCharacteristic; - YY_BREAK + YY_BREAK case 51: YY_RULE_SETUP #line 104 "Gmsh.l" return tComplex; - YY_BREAK + YY_BREAK case 52: YY_RULE_SETUP #line 105 "Gmsh.l" return tColor; - YY_BREAK + YY_BREAK case 53: YY_RULE_SETUP #line 106 "Gmsh.l" return tColorTable; - YY_BREAK + YY_BREAK case 54: YY_RULE_SETUP #line 107 "Gmsh.l" return tCompound; - YY_BREAK + YY_BREAK case 55: YY_RULE_SETUP #line 108 "Gmsh.l" return tCoordinates; - YY_BREAK + YY_BREAK case 56: YY_RULE_SETUP #line 109 "Gmsh.l" return tSpline; - YY_BREAK + YY_BREAK case 57: YY_RULE_SETUP #line 110 "Gmsh.l" return tCall; - YY_BREAK + YY_BREAK case 58: YY_RULE_SETUP #line 111 "Gmsh.l" return tCreateTopology; - YY_BREAK + YY_BREAK case 59: YY_RULE_SETUP #line 113 "Gmsh.l" return tDelete; - YY_BREAK + YY_BREAK case 60: YY_RULE_SETUP #line 114 "Gmsh.l" return tDegenerated; - YY_BREAK + YY_BREAK case 61: YY_RULE_SETUP #line 115 "Gmsh.l" return tDilate; - YY_BREAK + YY_BREAK case 62: YY_RULE_SETUP #line 116 "Gmsh.l" return tDraw; - YY_BREAK + YY_BREAK case 63: YY_RULE_SETUP #line 118 "Gmsh.l" return tExp; - YY_BREAK + YY_BREAK case 64: YY_RULE_SETUP #line 119 "Gmsh.l" return tEllipse; - YY_BREAK + YY_BREAK case 65: YY_RULE_SETUP #line 120 "Gmsh.l" return tEllipse; - YY_BREAK + YY_BREAK case 66: YY_RULE_SETUP #line 121 "Gmsh.l" return tExtrude; - YY_BREAK + YY_BREAK case 67: YY_RULE_SETUP #line 122 "Gmsh.l" return tElliptic; - YY_BREAK + YY_BREAK case 68: YY_RULE_SETUP #line 123 "Gmsh.l" return tEndFor; - YY_BREAK + YY_BREAK case 69: YY_RULE_SETUP #line 124 "Gmsh.l" return tEndIf; - YY_BREAK + YY_BREAK case 70: YY_RULE_SETUP #line 125 "Gmsh.l" return tEuclidian; - YY_BREAK + YY_BREAK case 71: YY_RULE_SETUP #line 126 "Gmsh.l" return tExit; - YY_BREAK + YY_BREAK case 72: YY_RULE_SETUP #line 128 "Gmsh.l" return tFabs; - YY_BREAK + YY_BREAK case 73: YY_RULE_SETUP #line 129 "Gmsh.l" return tField; - YY_BREAK + YY_BREAK case 74: YY_RULE_SETUP #line 130 "Gmsh.l" return tFloor; - YY_BREAK + YY_BREAK case 75: YY_RULE_SETUP #line 131 "Gmsh.l" return tFmod; - YY_BREAK + YY_BREAK case 76: YY_RULE_SETUP #line 132 "Gmsh.l" return tFor; - YY_BREAK + YY_BREAK case 77: YY_RULE_SETUP #line 133 "Gmsh.l" return tFunction; - YY_BREAK + YY_BREAK case 78: YY_RULE_SETUP #line 135 "Gmsh.l" return tGetValue; - YY_BREAK + YY_BREAK case 79: YY_RULE_SETUP #line 136 "Gmsh.l" return tGMSH_MAJOR_VERSION; - YY_BREAK + YY_BREAK case 80: YY_RULE_SETUP #line 137 "Gmsh.l" return tGMSH_MINOR_VERSION; - YY_BREAK + YY_BREAK case 81: YY_RULE_SETUP #line 138 "Gmsh.l" return tGMSH_PATCH_VERSION; - YY_BREAK + YY_BREAK case 82: YY_RULE_SETUP #line 140 "Gmsh.l" return tHide; - YY_BREAK + YY_BREAK case 83: YY_RULE_SETUP #line 141 "Gmsh.l" return tHole; - YY_BREAK + YY_BREAK case 84: YY_RULE_SETUP #line 142 "Gmsh.l" return tHypot; - YY_BREAK + YY_BREAK case 85: YY_RULE_SETUP #line 144 "Gmsh.l" return tIn; - YY_BREAK + YY_BREAK case 86: YY_RULE_SETUP #line 145 "Gmsh.l" return tIf; - YY_BREAK + YY_BREAK case 87: YY_RULE_SETUP #line 146 "Gmsh.l" return tIntersect; - YY_BREAK + YY_BREAK case 88: YY_RULE_SETUP #line 147 "Gmsh.l" return tInterpolationScheme; - YY_BREAK + YY_BREAK case 89: YY_RULE_SETUP #line 149 "Gmsh.l" return tKnots; - YY_BREAK + YY_BREAK case 90: YY_RULE_SETUP #line 151 "Gmsh.l" return tLength; - YY_BREAK + YY_BREAK case 91: YY_RULE_SETUP #line 152 "Gmsh.l" return tLine; - YY_BREAK + YY_BREAK case 92: YY_RULE_SETUP #line 153 "Gmsh.l" return tLoop; - YY_BREAK + YY_BREAK case 93: YY_RULE_SETUP #line 154 "Gmsh.l" return tLog; - YY_BREAK + YY_BREAK case 94: YY_RULE_SETUP #line 155 "Gmsh.l" return tLog10; - YY_BREAK + YY_BREAK case 95: YY_RULE_SETUP #line 156 "Gmsh.l" return tLayers; - YY_BREAK + YY_BREAK case 96: YY_RULE_SETUP #line 157 "Gmsh.l" return tLevelset; - YY_BREAK + YY_BREAK case 97: YY_RULE_SETUP #line 159 "Gmsh.l" return tModulo; - YY_BREAK + YY_BREAK case 98: YY_RULE_SETUP #line 160 "Gmsh.l" return tMPI_Rank; - YY_BREAK + YY_BREAK case 99: YY_RULE_SETUP #line 161 "Gmsh.l" return tMPI_Size; - YY_BREAK + YY_BREAK case 100: YY_RULE_SETUP #line 163 "Gmsh.l" return tNurbs; - YY_BREAK + YY_BREAK case 101: YY_RULE_SETUP #line 165 "Gmsh.l" return tOrder; - YY_BREAK + YY_BREAK case 102: YY_RULE_SETUP #line 166 "Gmsh.l" return tOCCShape; - YY_BREAK + YY_BREAK case 103: YY_RULE_SETUP #line 168 "Gmsh.l" return tPhysical; - YY_BREAK + YY_BREAK case 104: YY_RULE_SETUP #line 169 "Gmsh.l" return tPi; - YY_BREAK + YY_BREAK case 105: YY_RULE_SETUP #line 170 "Gmsh.l" return tPlane; - YY_BREAK + YY_BREAK case 106: YY_RULE_SETUP #line 171 "Gmsh.l" return tPoint; - YY_BREAK + YY_BREAK case 107: YY_RULE_SETUP #line 172 "Gmsh.l" return tParametric; - YY_BREAK + YY_BREAK case 108: YY_RULE_SETUP #line 173 "Gmsh.l" return tPolarSphere; - YY_BREAK + YY_BREAK case 109: YY_RULE_SETUP #line 174 "Gmsh.l" return tPrintf; - YY_BREAK + YY_BREAK case 110: YY_RULE_SETUP #line 175 "Gmsh.l" return tPlugin; - YY_BREAK + YY_BREAK case 111: YY_RULE_SETUP #line 177 "Gmsh.l" return tRecombine; - YY_BREAK + YY_BREAK case 112: YY_RULE_SETUP #line 178 "Gmsh.l" return tRotate; - YY_BREAK + YY_BREAK case 113: YY_RULE_SETUP #line 179 "Gmsh.l" return tRuled; - YY_BREAK + YY_BREAK case 114: YY_RULE_SETUP #line 180 "Gmsh.l" return tRand; - YY_BREAK + YY_BREAK case 115: YY_RULE_SETUP #line 181 "Gmsh.l" return tReturn; - YY_BREAK + YY_BREAK case 116: YY_RULE_SETUP #line 183 "Gmsh.l" return tSmoother; - YY_BREAK + YY_BREAK case 117: YY_RULE_SETUP #line 184 "Gmsh.l" return tSqrt; - YY_BREAK + YY_BREAK case 118: YY_RULE_SETUP #line 185 "Gmsh.l" return tSin; - YY_BREAK + YY_BREAK case 119: YY_RULE_SETUP #line 186 "Gmsh.l" return tSinh; - YY_BREAK + YY_BREAK case 120: YY_RULE_SETUP #line 187 "Gmsh.l" return tSphere; - YY_BREAK + YY_BREAK case 121: YY_RULE_SETUP #line 188 "Gmsh.l" return tSpline; - YY_BREAK + YY_BREAK case 122: YY_RULE_SETUP #line 189 "Gmsh.l" return tSplit; - YY_BREAK + YY_BREAK case 123: YY_RULE_SETUP #line 190 "Gmsh.l" return tSurface; - YY_BREAK + YY_BREAK case 124: YY_RULE_SETUP #line 191 "Gmsh.l" return tSprintf; - YY_BREAK + YY_BREAK case 125: YY_RULE_SETUP #line 192 "Gmsh.l" return tStrCat; - YY_BREAK + YY_BREAK case 126: YY_RULE_SETUP #line 193 "Gmsh.l" return tStrPrefix; - YY_BREAK + YY_BREAK case 127: YY_RULE_SETUP #line 194 "Gmsh.l" return tStrRelative; - YY_BREAK + YY_BREAK case 128: YY_RULE_SETUP #line 195 "Gmsh.l" return tShow; - YY_BREAK + YY_BREAK case 129: YY_RULE_SETUP #line 196 "Gmsh.l" return tSymmetry; - YY_BREAK + YY_BREAK case 130: YY_RULE_SETUP #line 197 "Gmsh.l" return tSyncModel; - YY_BREAK + YY_BREAK case 131: YY_RULE_SETUP #line 199 "Gmsh.l" return tText2D; - YY_BREAK + YY_BREAK case 132: YY_RULE_SETUP #line 200 "Gmsh.l" return tText3D; - YY_BREAK + YY_BREAK case 133: YY_RULE_SETUP #line 201 "Gmsh.l" return tTime; - YY_BREAK + YY_BREAK case 134: YY_RULE_SETUP #line 202 "Gmsh.l" return tTransfinite; - YY_BREAK + YY_BREAK case 135: YY_RULE_SETUP #line 203 "Gmsh.l" return tTranslate; - YY_BREAK + YY_BREAK case 136: YY_RULE_SETUP #line 204 "Gmsh.l" return tTanh; - YY_BREAK + YY_BREAK case 137: YY_RULE_SETUP #line 205 "Gmsh.l" return tTan; - YY_BREAK + YY_BREAK case 138: YY_RULE_SETUP #line 206 "Gmsh.l" return tToday; - YY_BREAK + YY_BREAK case 139: YY_RULE_SETUP #line 208 "Gmsh.l" return tUsing; - YY_BREAK + YY_BREAK case 140: YY_RULE_SETUP #line 210 "Gmsh.l" return tVolume; - YY_BREAK + YY_BREAK case 141: #line 213 "Gmsh.l" case 142: @@ -1833,378 +1833,378 @@ case 144: YY_RULE_SETUP #line 215 "Gmsh.l" { gmsh_yylval.d = atof((char *)gmsh_yytext); return tDOUBLE; } - YY_BREAK + YY_BREAK case 145: YY_RULE_SETUP #line 217 "Gmsh.l" { gmsh_yylval.c = strsave((char*)gmsh_yytext); return tSTRING; } - YY_BREAK + YY_BREAK case 146: YY_RULE_SETUP #line 219 "Gmsh.l" return gmsh_yytext[0]; - YY_BREAK + YY_BREAK case 147: YY_RULE_SETUP #line 221 "Gmsh.l" ECHO; - YY_BREAK + YY_BREAK #line 1853 "Gmsh.yy.cpp" case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed gmsh_yyin at a new source and called - * gmsh_yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = gmsh_yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( gmsh_yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * gmsh_yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed gmsh_yyin at a new source and called + * gmsh_yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = gmsh_yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( gmsh_yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * gmsh_yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ } /* end of gmsh_yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - gmsh_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - gmsh_yyrestart(gmsh_yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + gmsh_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + gmsh_yyrestart(gmsh_yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - return ret_val; + return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { - register yy_state_type yy_current_state; - register char *yy_cp; + register yy_state_type yy_current_state; + register char *yy_cp; - yy_current_state = (yy_start); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 634 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 634 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis - * next_state = yy_try_NUL_trans( current_state ); + * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 634 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 633); - - return yy_is_jam ? 0 : yy_current_state; + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 634 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 633); + + return yy_is_jam ? 0 : yy_current_state; } static void yyunput (int c, register char * yy_bp ) { - register char *yy_cp; + register char *yy_cp; yy_cp = (yy_c_buf_p); - /* undo effects of setting up gmsh_yytext */ - *yy_cp = (yy_hold_char); + /* undo effects of setting up gmsh_yytext */ + *yy_cp = (yy_hold_char); - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } - *--yy_cp = (char) c; + *--yy_cp = (char) c; - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; } #ifndef YY_NO_INPUT @@ -2215,71 +2215,71 @@ static int yy_get_next_buffer (void) #endif { - int c; + int c; - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - gmsh_yyrestart(gmsh_yyin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( gmsh_yywrap( ) ) - return 0; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + gmsh_yyrestart(gmsh_yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( gmsh_yywrap( ) ) + return 0; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; #ifdef __cplusplus - return yyinput(); + return yyinput(); #else - return input(); + return input(); #endif - } + } - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve gmsh_yytext */ - (yy_hold_char) = *++(yy_c_buf_p); + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve gmsh_yytext */ + (yy_hold_char) = *++(yy_c_buf_p); - return c; + return c; } -#endif /* ifndef YY_NO_INPUT */ +#endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. @@ -2289,14 +2289,14 @@ static int yy_get_next_buffer (void) void gmsh_yyrestart (FILE * input_file ) { - if ( ! YY_CURRENT_BUFFER ){ + if ( ! YY_CURRENT_BUFFER ){ gmsh_yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = + YY_CURRENT_BUFFER_LVALUE = gmsh_yy_create_buffer(gmsh_yyin,YY_BUF_SIZE ); - } + } - gmsh_yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - gmsh_yy_load_buffer_state( ); + gmsh_yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + gmsh_yy_load_buffer_state( ); } /** Switch to a different input buffer. @@ -2306,40 +2306,40 @@ static int yy_get_next_buffer (void) void gmsh_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { - /* TODO. We should be able to replace this entire function body - * with - * gmsh_yypop_buffer_state(); - * gmsh_yypush_buffer_state(new_buffer); + /* TODO. We should be able to replace this entire function body + * with + * gmsh_yypop_buffer_state(); + * gmsh_yypush_buffer_state(new_buffer); */ - gmsh_yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - gmsh_yy_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (gmsh_yywrap()) processing, but the only time this flag - * is looked at is after gmsh_yywrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; + gmsh_yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + gmsh_yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (gmsh_yywrap()) processing, but the only time this flag + * is looked at is after gmsh_yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; } static void gmsh_yy_load_buffer_state (void) { - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - gmsh_yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + gmsh_yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. @@ -2350,26 +2350,26 @@ static void gmsh_yy_load_buffer_state (void) */ YY_BUFFER_STATE gmsh_yy_create_buffer (FILE * file, int size ) { - YY_BUFFER_STATE b; + YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) gmsh_yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_create_buffer()" ); + b = (YY_BUFFER_STATE) gmsh_yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_create_buffer()" ); - b->yy_buf_size = size; + b->yy_buf_size = size; - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) gmsh_yyalloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_create_buffer()" ); + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) gmsh_yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_create_buffer()" ); - b->yy_is_our_buffer = 1; + b->yy_is_our_buffer = 1; - gmsh_yy_init_buffer(b,file ); + gmsh_yy_init_buffer(b,file ); - return b; + return b; } /** Destroy the buffer. @@ -2379,16 +2379,16 @@ static void gmsh_yy_load_buffer_state (void) void gmsh_yy_delete_buffer (YY_BUFFER_STATE b ) { - if ( ! b ) - return; + if ( ! b ) + return; - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - if ( b->yy_is_our_buffer ) - gmsh_yyfree((void *) b->yy_ch_buf ); + if ( b->yy_is_our_buffer ) + gmsh_yyfree((void *) b->yy_ch_buf ); - gmsh_yyfree((void *) b ); + gmsh_yyfree((void *) b ); } #ifndef __cplusplus @@ -2402,12 +2402,12 @@ extern int isatty (int ); static void gmsh_yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { - int oerrno = errno; + int oerrno = errno; - gmsh_yy_flush_buffer(b ); + gmsh_yy_flush_buffer(b ); - b->yy_input_file = file; - b->yy_fill_buffer = 1; + b->yy_input_file = file; + b->yy_fill_buffer = 1; /* If b is the current buffer, then gmsh_yy_init_buffer was _probably_ * called from gmsh_yyrestart() or through yy_get_next_buffer. @@ -2420,7 +2420,7 @@ extern int isatty (int ); b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - errno = oerrno; + errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. @@ -2429,25 +2429,25 @@ extern int isatty (int ); */ void gmsh_yy_flush_buffer (YY_BUFFER_STATE b ) { - if ( ! b ) - return; + if ( ! b ) + return; - b->yy_n_chars = 0; + b->yy_n_chars = 0; - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - b->yy_buf_pos = &b->yy_ch_buf[0]; + b->yy_buf_pos = &b->yy_ch_buf[0]; - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == YY_CURRENT_BUFFER ) - gmsh_yy_load_buffer_state( ); + if ( b == YY_CURRENT_BUFFER ) + gmsh_yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -2458,28 +2458,28 @@ extern int isatty (int ); */ void gmsh_yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { - if (new_buffer == NULL) - return; - - gmsh_yyensure_buffer_stack(); - - /* This block is copied from gmsh_yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from gmsh_yy_switch_to_buffer. */ - gmsh_yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; + if (new_buffer == NULL) + return; + + gmsh_yyensure_buffer_stack(); + + /* This block is copied from gmsh_yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from gmsh_yy_switch_to_buffer. */ + gmsh_yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. @@ -2488,18 +2488,18 @@ void gmsh_yypush_buffer_state (YY_BUFFER_STATE new_buffer ) */ void gmsh_yypop_buffer_state (void) { - if (!YY_CURRENT_BUFFER) - return; - - gmsh_yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - gmsh_yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } + if (!YY_CURRENT_BUFFER) + return; + + gmsh_yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + gmsh_yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } } /* Allocates the stack if it does not exist. @@ -2507,41 +2507,41 @@ void gmsh_yypop_buffer_state (void) */ static void gmsh_yyensure_buffer_stack (void) { - int num_to_alloc; + int num_to_alloc; - if (!(yy_buffer_stack)) { + if (!(yy_buffer_stack)) { - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)gmsh_yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)gmsh_yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)gmsh_yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)gmsh_yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } } /** Setup the input buffer state to scan directly from a user-specified character buffer. @@ -2552,31 +2552,31 @@ static void gmsh_yyensure_buffer_stack (void) */ YY_BUFFER_STATE gmsh_yy_scan_buffer (char * base, yy_size_t size ) { - YY_BUFFER_STATE b; + YY_BUFFER_STATE b; - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) gmsh_yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - gmsh_yy_switch_to_buffer(b ); - - return b; + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) gmsh_yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + gmsh_yy_switch_to_buffer(b ); + + return b; } /** Setup the input buffer state to scan a string. The next call to gmsh_yylex() will @@ -2590,7 +2590,7 @@ YY_BUFFER_STATE gmsh_yy_scan_buffer (char * base, yy_size_t size ) YY_BUFFER_STATE gmsh_yy_scan_string (yyconst char * yystr ) { - return gmsh_yy_scan_bytes(yystr,strlen(yystr) ); + return gmsh_yy_scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to gmsh_yylex() will @@ -2602,32 +2602,32 @@ YY_BUFFER_STATE gmsh_yy_scan_string (yyconst char * yystr ) */ YY_BUFFER_STATE gmsh_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) gmsh_yyalloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_scan_bytes()" ); + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) gmsh_yyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_scan_bytes()" ); - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = gmsh_yy_scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in gmsh_yy_scan_bytes()" ); + b = gmsh_yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in gmsh_yy_scan_bytes()" ); - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; - return b; + return b; } #ifndef YY_EXIT_FAILURE @@ -2636,26 +2636,26 @@ YY_BUFFER_STATE gmsh_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) static void yy_fatal_error (yyconst char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up gmsh_yytext. */ \ + do \ + { \ + /* Undo effects of setting up gmsh_yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - gmsh_yytext[gmsh_yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = gmsh_yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - gmsh_yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) + gmsh_yytext[gmsh_yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = gmsh_yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + gmsh_yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ @@ -2770,15 +2770,15 @@ int gmsh_yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - gmsh_yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - gmsh_yypop_buffer_state(); - } + while(YY_CURRENT_BUFFER){ + gmsh_yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + gmsh_yypop_buffer_state(); + } - /* Destroy the stack itself. */ - gmsh_yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; + /* Destroy the stack itself. */ + gmsh_yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * gmsh_yylex() is called, initialization will occur. */ @@ -2794,43 +2794,43 @@ int gmsh_yylex_destroy (void) #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { - register int n; - for ( n = 0; s[n]; ++n ) - ; + register int n; + for ( n = 0; s[n]; ++n ) + ; - return n; + return n; } #endif void *gmsh_yyalloc (yy_size_t size ) { - return (void *) malloc( size ); + return (void *) malloc( size ); } void *gmsh_yyrealloc (void * ptr, yy_size_t size ) { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); } void gmsh_yyfree (void * ptr ) { - free( (char *) ptr ); /* see gmsh_yyrealloc() for (char *) cast */ + free( (char *) ptr ); /* see gmsh_yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" @@ -2850,7 +2850,7 @@ void skipcomments(void) while (1) { while ((c = yyinput()) != '*'){ if(feof(gmsh_yyin)){ - Msg::Error("End of file in commented region"); + Msg::Error("End of file in commented region"); return; } } @@ -2917,8 +2917,8 @@ void skip_until(const char *skip, const char *until) while (1){ chars[0] = yyinput(); if(feof(gmsh_yyin)){ - Msg::Error("Unexpected end of file"); - return; + Msg::Error("Unexpected end of file"); + return; } if(chars[0] == until[0]) break; if(skip && chars[0] == skip[0]) break; @@ -2932,17 +2932,17 @@ void skip_until(const char *skip, const char *until) for(i=1; i<l; i++){ chars[i] = yyinput(); if(feof(gmsh_yyin)){ - l = i; - break; + l = i; + break; } } if(!strncmp(chars,until,l_until)){ if(!nb_skip){ - return; + return; } else{ - nb_skip--; + nb_skip--; } } else if(skip && !strncmp(chars,skip,l_skip)){ @@ -2950,7 +2950,7 @@ void skip_until(const char *skip, const char *until) } else{ for(i=1;i<l-1;i++){ - unput(chars[l-i]); + unput(chars[l-i]); } } diff --git a/benchmarks/stl/PelvisARTHUR_CLASS_GEO.geo b/benchmarks/stl/PelvisARTHUR_CLASS_GEO.geo index 36926785db..3e288e9ac4 100644 --- a/benchmarks/stl/PelvisARTHUR_CLASS_GEO.geo +++ b/benchmarks/stl/PelvisARTHUR_CLASS_GEO.geo @@ -1,4 +1,4 @@ -Mesh.CharacteristicLengthFactor=0.05; +Mesh.CharacteristicLengthFactor=0.1; Merge "PelvisARTHUR_CLASS.msh"; CreateTopology; @@ -9,10 +9,7 @@ Volume(1003)={1002}; Compound Line(10)={4}; Compound Line(20)={5}; -Compound Surface(200)={2} Boundary {{}}; -Compound Surface(400)={3} Boundary {{}}; +Compound Surface(200)={2}; +Compound Surface(400)={3}; Compound Volume(2000) = {1003}; - - - diff --git a/doc/VERSIONS.txt b/doc/VERSIONS.txt index c78d8a9192..3f4f3173cc 100644 --- a/doc/VERSIONS.txt +++ b/doc/VERSIONS.txt @@ -1,6 +1,6 @@ -$Id: VERSIONS.txt,v 1.55 2009-08-28 17:23:54 geuzaine Exp $ +$Id: VERSIONS.txt,v 1.56 2009-08-29 12:13:15 geuzaine Exp $ -2.4.1 (Aug 29): fixed surface mesh orientation bug introduced in +2.4.1 (Aug 31, 2009): fixed surface mesh orientation bug introduced in 2.4.0; 2D meshing code refactoring and small bug fixes. 2.4.0 (Aug 22, 2009): switched build system to CMake; optionally copy diff --git a/doc/gmsh.html b/doc/gmsh.html index 02cae7876a..1800cf7b9a 100644 --- a/doc/gmsh.html +++ b/doc/gmsh.html @@ -26,7 +26,7 @@ generator with built-in pre- and post-processing facilities</h1> <p> <h3 align="center">Christophe Geuzaine and Jean-François Remacle</h3> <p> -<h3 align=center>Version 2.4.1, August 29 2009</h3> +<h3 align=center>Version 2.4.1, August 31 2009</h3> <p> <center> <a href="#Description">Description</a> | -- GitLab