diff --git a/Common/Context.h b/Common/Context.h index 155d5f0e0a77086de959b718021755a351dfff73..df11fd5d32094f808696fd8a7573ab712c366f69 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -122,7 +122,6 @@ public : // approximative equivalent model length of a pixel int color_scheme ; // general color scheme int quadric_subdivisions; // nb of subdivisions for gluQuadrics (spheres/cylinders) - int visibility_mode ; // VIS_GEOM, VIS_MESH, ... int vector_type; // default vector display type (for normals, etc.) double arrow_rel_head_radius; // relative radius of arrow head double arrow_rel_stem_radius; // relative radius of arrow stem diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 94484cbe0f73d303d00bae790016f61018457414..df731b674060a18482338179ebf3baa32758d8d4 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -760,8 +760,6 @@ StringXNumber GeneralOptions_Number[] = { "Default vector display type (for normals, etc.)" }, { F|O, "Verbosity" , opt_general_verbosity , 3. , "Level of information printed during processing (0=no information)" }, - { F|O, "VisibilityMode" , opt_general_visibility_mode , 0. , - "Default mode for the visibility browser (0=Geometry+Mesh, 1=Geometry, 2=Mesh)" }, { F|S, "VisibilityPositionX" , opt_general_visibility_position0 , 650. , "Horizontal position (in pixels) of the upper left corner of the visibility window" }, { F|S, "VisibilityPositionY" , opt_general_visibility_position1 , 150. , diff --git a/Common/GmshDefines.h b/Common/GmshDefines.h index c20076619665507d52fa80267638567b02cba4ed..94fcd10821486e01ec479874ee39f7baad955741 100644 --- a/Common/GmshDefines.h +++ b/Common/GmshDefines.h @@ -63,9 +63,6 @@ #define CONV_VALUE 0.8 -#define VIS_GEOM (1<<0) -#define VIS_MESH (1<<1) - #define NOTTOLINK 1 #define TOLINK 2 diff --git a/Common/Makefile b/Common/Makefile index 342313a0b8e99f5c76013f84f6ba7342d36139b5..2985bdafdd8aa809a5e3d75ff4131bc77c63058b 100644 --- a/Common/Makefile +++ b/Common/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.99 2006-08-08 04:35:22 geuzaine Exp $ +# $Id: Makefile,v 1.100 2006-08-12 16:16:27 geuzaine Exp $ # # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle # @@ -150,16 +150,18 @@ ColorTable.o: ColorTable.cpp Gmsh.h Message.h ../DataStr/Malloc.h \ ../DataStr/List.h ../DataStr/Tree.h ColorTable.h Context.h \ ../Numeric/Numeric.h # 1 "/Users/geuzaine/.gmsh/Common//" -Visibility.o: Visibility.cpp Gmsh.h Message.h ../DataStr/Malloc.h \ - ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \ - ../DataStr/List.h ../DataStr/Tree.h ../Geo/Geo.h ../Geo/CAD.h \ - ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Vertex.h \ - ../Mesh/Simplex.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Face.h \ - ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Edge.h ../Mesh/Vertex.h \ - ../Mesh/Simplex.h ../Geo/ExtrudeParams.h ../Common/VertexArray.h \ - ../Common/SmoothNormals.h ../Numeric/Numeric.h ../Common/GmshDefines.h \ - ../Mesh/Metric.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h \ - ../Mesh/Matrix.h ../Geo/ExtrudeParams.h ../Parser/Parser.h Visibility.h +Visibility.o: Visibility.cpp Visibility.h GmshDefines.h ../Geo/GVertex.h \ + ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \ + ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \ + ../Common/GmshDefines.h ../Geo/MVertex.h ../Geo/GPoint.h ../Geo/GEdge.h \ + ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h \ + ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/MElement.h ../Geo/MVertex.h \ + ../Numeric/Numeric.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \ + ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h \ + ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.h ../Geo/GModel.h \ + ../Geo/GVertex.h ../Geo/GEdge.h ../Geo/GFace.h ../Geo/GRegion.h \ + ../Geo/SBoundingBox3d.h ../Parser/Parser.h ../DataStr/List.h \ + ../DataStr/Tree.h ../DataStr/avl.h # 1 "/Users/geuzaine/.gmsh/Common//" Trackball.o: Trackball.cpp Trackball.h # 1 "/Users/geuzaine/.gmsh/Common//" diff --git a/Common/Options.cpp b/Common/Options.cpp index 1e2b062ef048111affe588b17f0383071c325a5e..64d8f8d4715b01d2752f761baa55f9d8dc6cfd04 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.286 2006-08-08 04:35:22 geuzaine Exp $ +// $Id: Options.cpp,v 1.287 2006-08-12 16:16:27 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -2449,19 +2449,6 @@ double opt_general_manip_position1(OPT_ARGS_NUM) return CTX.manip_position[1]; } -double opt_general_visibility_mode(OPT_ARGS_NUM) -{ - if(action & GMSH_SET) - CTX.visibility_mode = (int)val; -#if defined(HAVE_FLTK) - if(WID && (action & GMSH_GUI)){ - if(CTX.visibility_mode > 0 && CTX.visibility_mode < 3) - WID->vis_browser_mode->value(CTX.visibility_mode); - } -#endif - return CTX.visibility_mode; -} - double opt_general_session_save(OPT_ARGS_NUM) { if(action & GMSH_SET) diff --git a/Common/Options.h b/Common/Options.h index 40a59d137c8144f7f08467626283d2900ce4a25d..7a356817d74337e6e6263b78d712f3b04103ad44 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -257,7 +257,6 @@ double opt_general_clip_position0(OPT_ARGS_NUM); double opt_general_clip_position1(OPT_ARGS_NUM); double opt_general_manip_position0(OPT_ARGS_NUM); double opt_general_manip_position1(OPT_ARGS_NUM); -double opt_general_visibility_mode(OPT_ARGS_NUM); double opt_general_session_save(OPT_ARGS_NUM); double opt_general_options_save(OPT_ARGS_NUM); double opt_general_rotation0(OPT_ARGS_NUM); diff --git a/Common/Visibility.cpp b/Common/Visibility.cpp index 06dfc214f1e4a1dcb398ff387e0567f81ec51bb5..5f571cb3161711ed3f638400c1bbf441779396d7 100644 --- a/Common/Visibility.cpp +++ b/Common/Visibility.cpp @@ -1,4 +1,4 @@ -// $Id: Visibility.cpp,v 1.13 2006-08-11 18:48:39 geuzaine Exp $ +// $Id: Visibility.cpp,v 1.14 2006-08-12 16:16:27 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -19,788 +19,147 @@ // // Please report all bugs and problems to <gmsh@geuz.org>. -/* -std::vector<int> GModel::getMeshPartitions() -{ - std::vector<int> part; - std::set<int>::const_iterator it = meshPartitions.begin(); - std::set<int>::const_iterator ite = meshPartitions.end(); - for(; it != ite; ++it) part.push_back(*it); - std::sort(part.begin(), part.end()); - return part; -} -*/ - -#include "Gmsh.h" -#include "Geo.h" -#include "CAD.h" -#include "Mesh.h" -#include "Parser.h" #include "Visibility.h" - -extern Mesh *THEM; - -static List_T *ElementaryEntities = NULL, *PhysicalEntities = NULL, *Partitions = NULL; -static Tree_T *VisibleThroughPhysical[4] = { NULL, NULL, NULL, NULL }; -static List_T *NumxSymb = NULL; -static int Sort = 1; - -int Entity::Num() -{ - switch (type) { - case 1: - case 2: - case 3: - case 4: - return data.physical ? data.physical->Num : 0; - case 5: - return data.vertex ? data.vertex->Num : 0; - case 6: - return data.curve ? data.curve->Num : 0; - case 7: - return data.surface ? data.surface->Num : 0; - case 8: - return data.volume ? data.volume->Num : 0; - case 9: - return data.partition ? data.partition->Num : 0; - default: - return 0; - } -} - -char *Entity::Type() -{ - switch (type) { - case 1: - case 5: - return "Point"; - case 2: - case 6: - return "Line"; - case 3: - case 7: - return "Surface"; - case 4: - case 8: - return "Volume"; - case 9: - return "Partition"; - default: - return "Unknown"; - } -} - -char *Entity::Name() -{ - char *tmp = ""; - return str ? str : tmp; -} - -static char browserline[512]; -char *Entity::BrowserLine() -{ - if(type) { - sprintf(browserline, "\t%s\t%d\t%s", Type(), Num(), Name()); - return browserline; - } - else - return Name(); -} - -int Entity::Visible() -{ - switch (type) { - case 1: - case 2: - case 3: - case 4: - return data.physical ? data.physical->Visible : 0; - case 5: - return data.vertex ? data.vertex->Visible : 0; - case 6: - return data.curve ? data.curve->Visible : 0; - case 7: - return data.surface ? data.surface->Visible : 0; - case 8: - return data.volume ? data.volume->Visible : 0; - case 9: - return data.partition ? data.partition->Visible : 0; - default: - return 0; - } -} - -void Entity::Visible(int mode) -{ - Vertex *v; - Curve *c; - Surface *s; - Volume *V; - int i, j; - - switch (type) { - case 1: - if(!data.physical) - break; - data.physical->Visible = mode; - for(i = 0; i < List_Nbr(data.physical->Entities); i++) { - List_Read(data.physical->Entities, i, &j); - if((v = FindPoint(j, THEM))) { - if(Tree_Search(VisibleThroughPhysical[0], &j)) { - v->Visible = v->Visible | mode; - } - else { - v->Visible = mode; - if(mode) - Tree_Add(VisibleThroughPhysical[0], &j); - } - } - } - break; - case 2: - if(!data.physical) - break; - data.physical->Visible = mode; - for(i = 0; i < List_Nbr(data.physical->Entities); i++) { - List_Read(data.physical->Entities, i, &j); - if((c = FindCurve(abs(j), THEM))) { - if(Tree_Search(VisibleThroughPhysical[1], &j)) { - c->Visible = c->Visible | mode; - } - else { - c->Visible = mode; - if(mode) - Tree_Add(VisibleThroughPhysical[1], &j); - } - } +#include "GModel.h" +#include "Parser.h" // for Symbol_T + +extern GModel *GMODEL; + +VisibilityManager *VisibilityManager::manager = 0; + +class VisLessThan{ + public: + bool operator()(const Vis *v1, const Vis *v2) const + { + switch(VisibilityManager::instance()->getSortMode()){ + case 1: return v1->getDim() < v2->getDim() ? true : false; + case -1: return v1->getDim() > v2->getDim() ? true : false; + case 2: return v1->getTag() < v2->getTag() ? true : false; + case -2: return v1->getTag() > v2->getTag() ? true : false; + case 3: + return strcmp(VisibilityManager::instance()->getLabel(v1->getTag()).c_str(), + VisibilityManager::instance()->getLabel(v2->getTag()).c_str()) < 0 ? + true : false; + default: + return strcmp(VisibilityManager::instance()->getLabel(v1->getTag()).c_str(), + VisibilityManager::instance()->getLabel(v2->getTag()).c_str()) > 0 ? + true : false; } - break; - case 3: - if(!data.physical) - break; - data.physical->Visible = mode; - for(i = 0; i < List_Nbr(data.physical->Entities); i++) { - List_Read(data.physical->Entities, i, &j); - if((s = FindSurface(abs(j), THEM))) { - if(Tree_Search(VisibleThroughPhysical[2], &j)) { - s->Visible = s->Visible | mode; - } - else { - s->Visible = mode; - if(mode) - Tree_Add(VisibleThroughPhysical[2], &j); - } - }; - } - break; - case 4: - if(!data.physical) - break; - data.physical->Visible = mode; - for(i = 0; i < List_Nbr(data.physical->Entities); i++) { - List_Read(data.physical->Entities, i, &j); - if((V = FindVolume(abs(j), THEM))) { - if(Tree_Search(VisibleThroughPhysical[3], &j)) { - V->Visible = V->Visible | mode; - } - else { - V->Visible = mode; - if(mode) - Tree_Add(VisibleThroughPhysical[3], &j); - } - } - } - break; - case 5: - if(!data.vertex) - break; - data.vertex->Visible = mode; - break; - case 6: - if(!data.curve) - break; - data.curve->Visible = mode; - break; - case 7: - if(!data.surface) - break; - data.surface->Visible = mode; - break; - case 8: - if(!data.volume) - break; - data.volume->Visible = mode; - break; - case 9: - if(!data.partition) - break; - data.partition->Visible = mode; - break; - } -} - -static void Recur(Curve * c, int mode) -{ - int k; - Vertex *v; - for(k = 0; k < List_Nbr(c->Control_Points); k++) { - List_Read(c->Control_Points, k, &v); - v->Visible = v->Visible | mode; } -} +}; -static void Recur(Surface * s, int mode) -{ - int k, l; - Vertex *v; - Curve *c; - for(k = 0; k < List_Nbr(s->Generatrices); k++) { - List_Read(s->Generatrices, k, &c); - if(c->Num < 0) - c = FindCurve(-c->Num, THEM); - if(c) { - c->Visible = c->Visible | mode; - for(l = 0; l < List_Nbr(c->Control_Points); l++) { - List_Read(c->Control_Points, l, &v); - v->Visible = v->Visible | mode; - } +static void setLabels(void *a, void *b){ + Symbol *s = (Symbol *)a; + for(int j = 0; j < List_Nbr(s->val); j++) { + double tag; + List_Read(s->val, j, &tag); + VisibilityManager::instance()->setLabel((int)tag, std::string(s->Name)); + } +} + +void VisibilityManager::update(int type) +{ + _labels.clear(); + Tree_Action(Symbol_T, setLabels); + + for(unsigned int i = 0; i < _entities.size(); i++) + delete _entities[i]; + _entities.clear(); + + if(type == 0){ // elementary entities + for(GModel::viter it = GMODEL->firstVertex(); it != GMODEL->lastVertex(); it++) + _entities.push_back(new VisElementary(*it)); + for(GModel::eiter it = GMODEL->firstEdge(); it != GMODEL->lastEdge(); it++) + _entities.push_back(new VisElementary(*it)); + for(GModel::fiter it = GMODEL->firstFace(); it != GMODEL->lastFace(); it++) + _entities.push_back(new VisElementary(*it)); + for(GModel::riter it = GMODEL->firstRegion(); it != GMODEL->lastRegion(); it++) + _entities.push_back(new VisElementary(*it)); + } + else if(type == 1){ // physical entities + std::map<int, std::vector<GEntity*> > groups[4]; + GMODEL->getPhysicalGroups(groups); + for(int i = 0; i < 4; i++){ + std::map<int, std::vector<GEntity*> >::const_iterator it = groups[i].begin(); + for(; it != groups[i].end(); ++it) + _entities.push_back(new VisPhysical(it->first, i, it->second)); } } -} - -static void Recur(Volume * V, int mode) -{ - int k, l, m; - Vertex *v; - Curve *c; - Surface *s; - for(k = 0; k < List_Nbr(V->Surfaces); k++) { - List_Read(V->Surfaces, k, &s); - s->Visible = s->Visible | mode; - for(l = 0; l < List_Nbr(s->Generatrices); l++) { - List_Read(s->Generatrices, l, &c); - if(c->Num < 0) - c = FindCurve(-c->Num, THEM); - if(c) { - c->Visible = c->Visible | mode; - for(m = 0; m < List_Nbr(c->Control_Points); m++) { - List_Read(c->Control_Points, m, &v); - v->Visible = v->Visible | mode; - } - } - } + else if(type == 2){ // partitions + std::set<int> part = GMODEL->getMeshPartitions(); + for(std::set<int>::const_iterator it = part.begin(); it != part.end(); ++it) + _entities.push_back(new VisPartition(*it)); } + std::sort(_entities.begin(), _entities.end(), VisLessThan()); } -void Entity::RecurVisible() +void VisibilityManager::setAllInvisible(int type) { - int j, k, mode; - Curve *c; - Surface *s; - Volume *V; - - mode = Visible(); - if(mode) { - switch (type) { - case 1: - break; - case 2: - if(!data.physical) - break; - for(j = 0; j < List_Nbr(data.physical->Entities); j++) { - List_Read(data.physical->Entities, j, &k); - if((c = FindCurve(abs(k), THEM))) - Recur(c, mode); - } - break; - case 3: - if(!data.physical) - break; - for(j = 0; j < List_Nbr(data.physical->Entities); j++) { - List_Read(data.physical->Entities, j, &k); - if((s = FindSurface(abs(k), THEM))) - Recur(s, mode); - } - break; - case 4: - if(!data.physical) - break; - for(j = 0; j < List_Nbr(data.physical->Entities); j++) { - List_Read(data.physical->Entities, j, &k); - if((V = FindVolume(abs(k), THEM))) - Recur(V, mode); - } - break; - case 5: - break; - case 6: - if(!data.curve) - break; - Recur(data.curve, mode); - break; - case 7: - if(!data.surface) - break; - Recur(data.surface, mode); - break; - case 8: - if(!data.volume) - break; - Recur(data.volume, mode); - break; - case 9: - break; - } + if(type == 0 || type == 1){ + // elementary or physical mode: set all entities in the model invisible + for(GModel::viter it = GMODEL->firstVertex(); it != GMODEL->lastVertex(); it++) + (*it)->setVisibility(false); + for(GModel::eiter it = GMODEL->firstEdge(); it != GMODEL->lastEdge(); it++) + (*it)->setVisibility(false); + for(GModel::fiter it = GMODEL->firstFace(); it != GMODEL->lastFace(); it++) + (*it)->setVisibility(false); + for(GModel::riter it = GMODEL->firstRegion(); it != GMODEL->lastRegion(); it++) + (*it)->setVisibility(false); } -} - - - -void SetVisibilitySort(int sort) -{ - if(Sort == sort) - Sort = -sort; - else - Sort = sort; + // this is superfluous in elementary mode, but we don't care + for(int i = 0; i < getNumEntities(); i++) setVisibility(i, false); } -static int CompareEntity(const void *a, const void *b) +std::string VisibilityManager::getBrowserLine(int n) { - Entity *p = (Entity *) a, *q = (Entity *) b; - switch (Sort) { - case 1: - return p->type - q->type; - case -1: - return q->type - p->type; - case 2: - return p->Num() - q->Num(); - case -2: - return q->Num() - p->Num(); - case 3: - return strcmp(p->Name(), q->Name()); - case -3: - return strcmp(q->Name(), p->Name()); - default: - return 0; - } + int tag = _entities[n]->getTag(); + char str[256]; + sprintf(str, "\t%s\t%d\t%s", _entities[n]->getName().c_str(), tag, + _labels.count(tag) ? _labels[tag].c_str() : ""); + return std::string(str); } -static int CompareNxS(const void *a, const void *b) +void VisElementary::setVisibility(bool val, bool recursive) { - NxS *p = (NxS *) a, *q = (NxS *) b; - return p->n - q->n; + _e->setVisibility(val, recursive); } -static char *GetString(int num) +void VisPhysical::setVisibility(bool val, bool recursive) { - NxS nxs, *pnxs; - nxs.n = num; - if((pnxs = (NxS *) List_PQuery(NumxSymb, &nxs, CompareNxS))) - return pnxs->s; - else - return NULL; + _visible = val; + for(unsigned int i = 0; i < _list.size(); i++) + _list[i]->setVisibility(val, recursive); } -static void AddPhysical(void *a, void *b) +void VisPartition::setVisibility(bool val, bool recursive) { - PhysicalGroup *p = *(PhysicalGroup **) a; - Entity e; - switch (p->Typ) { - case MSH_PHYSICAL_POINT: - e.type = 1; - break; - case MSH_PHYSICAL_LINE: - e.type = 2; - break; - case MSH_PHYSICAL_SURFACE: - e.type = 3; - break; - case MSH_PHYSICAL_VOLUME: - e.type = 4; - break; + _visible = val; + for(GModel::eiter it = GMODEL->firstEdge(); it != GMODEL->lastEdge(); it++){ + for(unsigned int i = 0; i < (*it)->lines.size(); i++) + if((*it)->lines[i]->getPartition() == _tag) + (*it)->lines[i]->setVisibility(val); } - e.data.physical = p; - e.str = GetString(p->Num); - List_Add(PhysicalEntities, &e); -} - -static void AddPartition(void *a, void *b) -{ - MeshPartition *p = *(MeshPartition **) a; - Entity e; - e.type = 9; - e.data.partition = p; - e.str = NULL; - List_Add(Partitions, &e); -} - -static void AddVertex(void *a, void *b) -{ - Vertex *v = *(Vertex **) a; - Entity e; - e.type = 5; - e.data.vertex = v; - e.str = GetString(v->Num); - List_Add(ElementaryEntities, &e); -} - -static void AddCurve(void *a, void *b) -{ - Curve *c = *(Curve **) a; - if(c->Num < 0) - return; - Entity e; - e.type = 6; - e.data.curve = c; - e.str = GetString(c->Num); - List_Add(ElementaryEntities, &e); -} - -static void AddSurface(void *a, void *b) -{ - Surface *s = *(Surface **) a; - Entity e; - e.type = 7; - e.data.surface = s; - e.str = GetString(s->Num); - List_Add(ElementaryEntities, &e); -} - -static void AddVolume(void *a, void *b) -{ - Volume *v = *(Volume **) a; - Entity e; - e.type = 8; - e.data.volume = v; - e.str = GetString(v->Num); - List_Add(ElementaryEntities, &e); -} - -static void addInNumxSymb(void *a, void *b){ - Symbol *s; - NxS nxs; - - s = (Symbol *)a; - for(int j = 0; j < List_Nbr(s->val); j++) { - nxs.n = (int)(*(double *)List_Pointer(s->val, j)); - nxs.s = s->Name; - List_Add(NumxSymb, &nxs); - } -} - -List_T *GetVisibilityList(int type) -{ - if(!ElementaryEntities) - ElementaryEntities = List_Create(100, 100, sizeof(Entity)); - else - List_Reset(ElementaryEntities); - - if(!PhysicalEntities) - PhysicalEntities = List_Create(100, 100, sizeof(Entity)); - else - List_Reset(PhysicalEntities); - - if(!Partitions) - Partitions = List_Create(100, 100, sizeof(Entity)); - else - List_Reset(Partitions); - - if(!NumxSymb) - NumxSymb = List_Create(100, 100, sizeof(NxS)); - else - List_Reset(NumxSymb); - - Tree_Action(Symbol_T, addInNumxSymb); - - if(THEM){ - List_Action(THEM->PhysicalGroups, AddPhysical); - List_Action(THEM->Partitions, AddPartition); - Tree_Action(THEM->Points, AddVertex); - Tree_Action(THEM->Curves, AddCurve); - Tree_Action(THEM->Surfaces, AddSurface); - Tree_Action(THEM->Volumes, AddVolume); - } - - List_Sort(ElementaryEntities, CompareEntity); - List_Sort(PhysicalEntities, CompareEntity); - List_Sort(Partitions, CompareEntity); - - switch (type) { - case ELEMENTARY: - return ElementaryEntities; - case PHYSICAL: - return PhysicalEntities; - case PARTITION: - default: - return Partitions; - } -} - -void ClearVisibilityList(int type) -{ - int i; - Entity *e; - List_T *list; - switch(type){ - case ELEMENTARY : list = ElementaryEntities; break; - case PHYSICAL : list = PhysicalEntities; break; - case PARTITION : list = Partitions; break; - default: return; - } - for(i = 0; i < List_Nbr(list); i++) { - e = (Entity *) List_Pointer(list, i); - e->Visible(0); - } -} - -void InitVisibilityThroughPhysical() -{ - int i; - for(i = 0; i < 4; i++) { - if(VisibleThroughPhysical[i]) - Tree_Delete(VisibleThroughPhysical[i]); - VisibleThroughPhysical[i] = Tree_Create(sizeof(int), fcmp_absint); - } -} - -void SetVisibilityByNumber(int num, int type, int mode) -{ - int i, found; - List_T *tmp; - Vertex vv, *v, **pv; - Curve *c; - Surface *s; - Volume *V; - Simplex SS, *S, **pS; - SimplexBase SSB, *SB, **pSB; - Quadrangle QQ, *Q, **pQ; - Hexahedron HH, *H, **pH; - Prism PP, *P, **pP; - Pyramid YY, *Y, **pY; - - if(!THEM) - return; - - switch (type) { - case 0: //node - vv.Num = num; - v = &vv; - if((pv = (Vertex **) Tree_PQuery(THEM->Vertices, &v))) - (*pv)->Visible = mode; - else - Msg(WARNING, "Unknown node %d (use '*' to hide/show all nodes)", num); - break; - case 1: //element - SS.Num = num; S = &SS; - SSB.Num = num; SB = &SSB; - QQ.Num = num; Q = &QQ; - HH.Num = num; H = &HH; - PP.Num = num; P = &PP; - YY.Num = num; Y = &YY; - found = 0; - // in curves - tmp = Tree2List(THEM->Curves); - for(i = 0; i < List_Nbr(tmp); i++) { - List_Read(tmp, i, &c); - if((pS = (Simplex **) Tree_PQuery(c->Simplexes, &S))) { - (*pS)->Visible = mode; - found = 1; - break; - } - if((pSB = (SimplexBase **) Tree_PQuery(c->SimplexesBase, &SB))) { - (*pSB)->Visible = mode; - found = 1; - break; - } - } - List_Delete(tmp); - if(found) - break; - // in surfaces - tmp = Tree2List(THEM->Surfaces); - for(i = 0; i < List_Nbr(tmp); i++) { - List_Read(tmp, i, &s); - if((pS = (Simplex **) Tree_PQuery(s->Simplexes, &S))) { - (*pS)->Visible = mode; - found = 1; - break; - } - if((pSB = (SimplexBase **) Tree_PQuery(s->SimplexesBase, &SB))) { - (*pSB)->Visible = mode; - found = 1; - break; - } - if((pQ = (Quadrangle **) Tree_PQuery(s->Quadrangles, &Q))) { - (*pQ)->Visible = mode; - found = 1; - break; - } - } - List_Delete(tmp); - if(found) - break; - // in volumes (this is tricky, since V->Simplexes contains the - // simplexes ordered by quality and not by number; so we use the - // global tree of simplexes here) - if((pS = (Simplex **) Tree_PQuery(THEM->Simplexes, &S))) { - (*pS)->Visible = mode; - break; - } - tmp = Tree2List(THEM->Volumes); - for(i = 0; i < List_Nbr(tmp); i++) { - List_Read(tmp, i, &V); - if((pSB = (SimplexBase **) Tree_PQuery(V->SimplexesBase, &SB))) { - (*pSB)->Visible = mode; - found = 1; - break; - } - if((pH = (Hexahedron **) Tree_PQuery(V->Hexahedra, &H))) { - (*pH)->Visible = mode; - found = 1; - break; - } - if((pP = (Prism **) Tree_PQuery(V->Prisms, &P))) { - (*pP)->Visible = mode; - found = 1; - break; - } - if((pY = (Pyramid **) Tree_PQuery(V->Pyramids, &Y))) { - (*pY)->Visible = mode; - found = 1; - break; - } - } - List_Delete(tmp); - if(!found) - Msg(WARNING, "Unknown element %d (use '*' to hide/show all elements)", num); - break; - case 2: //point - if((v = FindPoint(num, THEM))) - v->Visible = mode; - else - Msg(WARNING, "Unknown point %d (use '*' to hide/show all points)", num); - break; - case 3: //line - if((c = FindCurve(num, THEM))) - c->Visible = mode; - else - Msg(WARNING, "Unknown line %d (use '*' to hide/show all lines)", num); - break; - case 4: //surface - if((s = FindSurface(num, THEM))) - s->Visible = mode; - else - Msg(WARNING, "Unknown surface %d (use '*' to hide/show all surfaces)", num); - break; - case 5: //volume - if((V = FindVolume(num, THEM))) - V->Visible = mode; - else - Msg(WARNING, "Unknown volume %d (use '*' to hide/show all volumes)", num); - break; - } -} - -static int vmode; - -static void vis_nod(void *a, void *b) -{ - (*(Vertex **) a)->Visible = vmode; -} -static void vis_sim(void *a, void *b) -{ - (*(SimplexBase **) a)->Visible = vmode; -} -static void vis_qua(void *a, void *b) -{ - (*(Quadrangle **) a)->Visible = vmode; -} -static void vis_hex(void *a, void *b) -{ - (*(Hexahedron **) a)->Visible = vmode; -} -static void vis_pri(void *a, void *b) -{ - (*(Prism **) a)->Visible = vmode; -} -static void vis_pyr(void *a, void *b) -{ - (*(Pyramid **) a)->Visible = vmode; -} -static void vis_cur(void *a, void *b) -{ - (*(Curve **) a)->Visible = vmode; -} -static void vis_sur(void *a, void *b) -{ - (*(Surface **) a)->Visible = vmode; -} -static void vis_vol(void *a, void *b) -{ - (*(Volume **) a)->Visible = vmode; -} - -void SetVisibilityByNumber(char *str, int type, int mode) -{ - int i; - List_T *tmp; - Curve *c; - Surface *s; - Volume *V; - - if(!THEM) - return; - - vmode = mode; - - if(!strcmp(str, "all") || !strcmp(str, "*")) { - switch (type) { - case 0: //node - Tree_Action(THEM->Vertices, vis_nod); - break; - case 1: //element - tmp = Tree2List(THEM->Curves); - for(i = 0; i < List_Nbr(tmp); i++) { - List_Read(tmp, i, &c); - Tree_Action(c->Simplexes, vis_sim); - Tree_Action(c->SimplexesBase, vis_sim); - } - List_Delete(tmp); - tmp = Tree2List(THEM->Surfaces); - for(i = 0; i < List_Nbr(tmp); i++) { - List_Read(tmp, i, &s); - Tree_Action(s->Simplexes, vis_sim); - Tree_Action(s->SimplexesBase, vis_sim); - Tree_Action(s->Quadrangles, vis_qua); - } - List_Delete(tmp); - tmp = Tree2List(THEM->Volumes); - for(i = 0; i < List_Nbr(tmp); i++) { - List_Read(tmp, i, &V); - Tree_Action(V->Simplexes, vis_sim); - Tree_Action(V->SimplexesBase, vis_sim); - Tree_Action(V->Hexahedra, vis_hex); - Tree_Action(V->Prisms, vis_pri); - Tree_Action(V->Pyramids, vis_pyr); - } - List_Delete(tmp); - break; - case 2: //point - Tree_Action(THEM->Points, vis_nod); - break; - case 3: //line - Tree_Action(THEM->Curves, vis_cur); - break; - case 4: //surface - Tree_Action(THEM->Surfaces, vis_sur); - break; - case 5: //volume - Tree_Action(THEM->Volumes, vis_vol); - break; - } + for(GModel::fiter it = GMODEL->firstFace(); it != GMODEL->lastFace(); it++){ + for(unsigned int i = 0; i < (*it)->triangles.size(); i++) + if((*it)->triangles[i]->getPartition() == _tag) + (*it)->triangles[i]->setVisibility(val); + for(unsigned int i = 0; i < (*it)->quadrangles.size(); i++) + if((*it)->quadrangles[i]->getPartition() == _tag) + (*it)->quadrangles[i]->setVisibility(val); } - else { - SetVisibilityByNumber(atoi(str), type, mode); + for(GModel::riter it = GMODEL->firstRegion(); it != GMODEL->lastRegion(); it++){ + for(unsigned int i = 0; i < (*it)->tetrahedra.size(); i++) + if((*it)->tetrahedra[i]->getPartition() == _tag) + (*it)->tetrahedra[i]->setVisibility(val); + for(unsigned int i = 0; i < (*it)->hexahedra.size(); i++) + if((*it)->hexahedra[i]->getPartition() == _tag) + (*it)->hexahedra[i]->setVisibility(val); + for(unsigned int i = 0; i < (*it)->prisms.size(); i++) + if((*it)->prisms[i]->getPartition() == _tag) + (*it)->prisms[i]->setVisibility(val); + for(unsigned int i = 0; i < (*it)->pyramids.size(); i++) + if((*it)->pyramids[i]->getPartition() == _tag) + (*it)->pyramids[i]->setVisibility(val); } } diff --git a/Common/Visibility.h b/Common/Visibility.h index 91504bd174b0a1733050e3bce4dc1c53f3ab5b1b..9039fa0903cd72294b430abd3b693e36f12d4ec3 100644 --- a/Common/Visibility.h +++ b/Common/Visibility.h @@ -20,41 +20,137 @@ // // Please report all bugs and problems to <gmsh@geuz.org>. -#include "List.h" -#include "Mesh.h" - -typedef struct{ - int n; - char *s; -} NxS; - -class Entity { -public : - int type; - union { - Vertex *vertex; - Curve *curve; - Surface *surface; - Volume *volume; - PhysicalGroup *physical; - MeshPartition *partition; - } data; - char *str; - - int Num(); - char *Type(); - char *Name(); - int Visible(); - void Visible(int mode); - void RecurVisible(); - char *BrowserLine(); +#include <string> +#include <map> +#include <vector> +#include "GmshDefines.h" +#include "GVertex.h" +#include "GEdge.h" +#include "GFace.h" +#include "GRegion.h" + +class Vis { + public: + Vis(){} + virtual ~Vis(){} + virtual int getTag() const = 0; + virtual int getDim() const = 0; + virtual std::string getName() const = 0; + virtual bool getVisibility() const = 0; + virtual void setVisibility(bool val, bool recursive=false) = 0; +}; + +class VisElementary : public Vis { + private: + GEntity *_e; + int _dim; + public: + VisElementary(GVertex *e) : _e(e), _dim(0) {} + VisElementary(GEdge *e) : _e(e), _dim(1) {} + VisElementary(GFace *e) : _e(e), _dim(2) {} + VisElementary(GRegion *e) : _e(e), _dim(3) {} + ~VisElementary(){} + int getTag() const { return _e->tag(); } + int getDim() const { return _dim; } + std::string getName() const + { + if(_dim == 0) return "Point"; + else if(_dim == 1) return "Line"; + else if(_dim == 2) return "Surface"; + else return "Volume"; + } + bool getVisibility() const { return _e->getVisibility(); } + void setVisibility(bool val, bool recursive=false); +}; + +class VisPhysical : public Vis { + private: + int _tag, _dim; + bool _visible; + std::vector<GEntity*> _list; + public: + VisPhysical(int tag, int dim, std::vector<GEntity*> list) + : _tag(tag), _dim(dim), _visible(true), _list(list) {} + ~VisPhysical(){} + int getTag() const { return _tag; } + int getDim() const { return _dim; } + std::string getName() const + { + if(_dim == 0) return "Point"; + else if(_dim == 1) return "Line"; + else if(_dim == 2) return "Surface"; + else return "Volume"; + } + bool getVisibility() const { return _visible; } + void setVisibility(bool val, bool recursive=false); }; -void SetVisibilitySort(int sort); -List_T* GetVisibilityList(int type); -void ClearVisibilityList(int type); -void InitVisibilityThroughPhysical(); -void SetVisibilityByNumber(int num, int type, int mode); -void SetVisibilityByNumber(char *str, int type, int mode); +class VisPartition : public Vis { + private: + int _tag; + bool _visible; + public: + VisPartition(int tag) : _tag(tag), _visible(true) {} + ~VisPartition(){} + int getTag() const { return _tag; } + int getDim() const { return -1; } + std::string getName() const { return "Partition"; } + bool getVisibility() const { return _visible; } + void setVisibility(bool val, bool recursive=false); +}; + +// Singleton, one visibility manager for the whole interface +class VisibilityManager { + private: + std::map<int, std::string> _labels; + std::vector<Vis*> _entities; + int _sortMode; + static VisibilityManager *manager; + VisibilityManager() : _sortMode(1) {} + + public : + // create the only instance of the manager + static VisibilityManager *instance() + { + if(!manager) manager = new VisibilityManager(); + return manager; + } + + // repopulate the manager with current data of the given type + void update(int type); + + // get the number of entities in the manager + int getNumEntities() { return _entities.size(); } + + // get the visibility information for the nth entity in the manager + bool getVisibility(int n){ return _entities[n]->getVisibility(); } + + // set the visibility information for the nth entity in the manager + void setVisibility(bool n, int val, bool recursive=false) + { + _entities[n]->setVisibility(val, recursive); + } + + // set all entities to be invisible + void setAllInvisible(int type); + + // get the tag of the nth entity in the manager + int getTag(int n){ return _entities[n]->getTag(); } + + // get the browser line for the nth entity in the manager + std::string getBrowserLine(int n); + + // set the sort mode + void setSortMode(int mode){ _sortMode = (_sortMode != mode) ? mode : -mode; } + + // get the sort mode + int getSortMode(){ return _sortMode; } + + // associate a label with a tag + void setLabel(int tag, std::string label){ _labels[tag] = label; } + + // get the label associated with a tag + std::string getLabel(int tag){ return _labels[tag]; } +}; #endif diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 8a4d693c1cadc679a2086a6791c6406269145c0d..42f690b298c21b1c6c4ac8c475cf74ba9bfced51 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.427 2006-08-10 15:29:25 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.428 2006-08-12 16:16:27 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -23,7 +23,6 @@ #include <time.h> #include <map> -#include "BDS.h" #include "Gmsh.h" #include "GmshUI.h" #include "Geo.h" @@ -52,7 +51,7 @@ using namespace std; extern Context_T CTX; extern GUI *WID; -extern Mesh *THEM; +extern GModel *GMODEL; // Helper routines @@ -1323,139 +1322,38 @@ void message_save_cb(CALLBACK_ARGS) // Visibility Menu -void select_vis_browser(int mode) -{ - for(int i = 1; i <= WID->vis_browser->size(); i++) { - Entity *e = (Entity *) WID->vis_browser->data(i); - if((mode & VIS_GEOM) && (mode & VIS_MESH)){ - if((e->Visible() & VIS_GEOM) && (e->Visible() & VIS_MESH)) - WID->vis_browser->select(i); - } - else if(mode & VIS_GEOM){ - if(e->Visible() & VIS_GEOM) - WID->vis_browser->select(i); - } - else if(mode & VIS_MESH){ - if(e->Visible() & VIS_MESH) - WID->vis_browser->select(i); - } - } -} - void visibility_cb(CALLBACK_ARGS) { + // get the visibility info from the model, and update the browser accordingly WID->create_visibility_window(); WID->vis_browser->clear(); - - int type; - switch (WID->vis_type->value()) { - case 0: - type = ELEMENTARY; - break; - case 1: - type = PHYSICAL; - break; - default : - type = PARTITION; - break; - } - - int mode; - switch (WID->vis_browser_mode->value()) { - case 0: - mode = VIS_GEOM | VIS_MESH; - break; - case 1: - mode = VIS_GEOM; - break; - default: - mode = VIS_MESH; - break; - } - - List_T *list = GetVisibilityList(type); - - for(int i = 0; i < List_Nbr(list); i++) { - Entity *e = (Entity *) List_Pointer(list, i); - WID->vis_browser->add(e->BrowserLine(), e); + VisibilityManager::instance()->update(WID->vis_type->value()); + for(int i = 0; i < VisibilityManager::instance()->getNumEntities(); i++){ + WID->vis_browser->add(VisibilityManager::instance()->getBrowserLine(i).c_str()); + if(VisibilityManager::instance()->getVisibility(i)) + WID->vis_browser->select(i + 1); } - select_vis_browser(mode); } void visibility_ok_cb(CALLBACK_ARGS) { - InitVisibilityThroughPhysical(); - - switch (WID->vis_type->value()) { - case 0: - ClearVisibilityList(PHYSICAL); - break; - case 1: - ClearVisibilityList(ELEMENTARY); - break; - default: - // partitions: do nothing - break; - } - - int mode; - switch (WID->vis_browser_mode->value()) { - case 0: - mode = VIS_GEOM | VIS_MESH; - CTX.mesh.changed = 1; - break; - case 1: - mode = VIS_GEOM; - break; - default: - mode = VIS_MESH; - CTX.mesh.changed = 1; - break; - } - - for(int i = 1; i <= WID->vis_browser->size(); i++) { - Entity *e = (Entity *) WID->vis_browser->data(i); - if(WID->vis_browser->selected(i)) { - e->Visible(e->Visible() | mode); - } - else { - switch (WID->vis_browser_mode->value()) { - case 0: - e->Visible(0); - break; - case 1: - if(e->Visible() & VIS_MESH) - e->Visible(VIS_MESH); - else - e->Visible(0); - break; - default: - if(e->Visible() & VIS_GEOM) - e->Visible(VIS_GEOM); - else - e->Visible(0); - break; - } - } - } - - if(WID->vis_butt[0]->value()) { - for(int i = 1; i <= WID->vis_browser->size(); i++) { - Entity *e = (Entity *) WID->vis_browser->data(i); - e->RecurVisible(); - } - select_vis_browser(mode); - } - + // get the selections made in the browser and apply them into the model + CTX.mesh.changed = 1; + VisibilityManager::instance()->setAllInvisible(WID->vis_type->value()); + for(int i = 0; i < VisibilityManager::instance()->getNumEntities(); i++) + if(WID->vis_browser->selected(i + 1)) + VisibilityManager::instance()->setVisibility(i, true, WID->vis_butt[0]->value()); + // then refresh the browser to account for recursive selections + for(int i = 0; i < VisibilityManager::instance()->getNumEntities(); i++) + if(VisibilityManager::instance()->getVisibility(i)) + WID->vis_browser->select(i + 1); Draw(); } void visibility_sort_cb(CALLBACK_ARGS) { - int val; char *str = (char*)data; - static char tmpstr[256]; - + int val; if(!strcmp(str, "type")) val = 1; else if(!strcmp(str, "number")) @@ -1469,33 +1367,33 @@ void visibility_sort_cb(CALLBACK_ARGS) else val = 0; - if(val == 0) { // (de)select everything + if(val == 0) { // select or deselect everything int selectall = 0; - for(int i = 1; i <= WID->vis_browser->size(); i++) - if(!WID->vis_browser->selected(i)) { + for(int i = 0; i < WID->vis_browser->size(); i++) + if(!WID->vis_browser->selected(i + 1)) { selectall = 1; break; } if(selectall) - for(int i = 1; i <= WID->vis_browser->size(); i++) - WID->vis_browser->select(i); + for(int i = 0; i < WID->vis_browser->size(); i++) + WID->vis_browser->select(i + 1); else WID->vis_browser->deselect(); } else if(val == -1){ // invert the selection int *state = new int[WID->vis_browser->size()]; - for(int i = 1; i <= WID->vis_browser->size(); i++) - state[i-1] = WID->vis_browser->selected(i); + for(int i = 0; i < WID->vis_browser->size(); i++) + state[i] = WID->vis_browser->selected(i + 1); WID->vis_browser->deselect(); - for(int i = 1; i <= WID->vis_browser->size(); i++) - if(!state[i-1]) WID->vis_browser->select(i); + for(int i = 0; i < WID->vis_browser->size(); i++) + if(!state[i]) WID->vis_browser->select(i + 1); delete [] state; } else if(val == -2){ // create new parameter name for selection - for(int i = 1; i <= WID->vis_browser->size(); i++){ - if(WID->vis_browser->selected(i)){ - Entity *e = (Entity *) WID->vis_browser->data(i); - sprintf(tmpstr, "%d", e->Num()); + for(int i = 0; i < WID->vis_browser->size(); i++){ + if(WID->vis_browser->selected(i + 1)){ + static char tmpstr[256]; + sprintf(tmpstr, "%d", VisibilityManager::instance()->getTag(i)); WID->context_geometry_input[1]->value(tmpstr); break; } @@ -1503,32 +1401,99 @@ void visibility_sort_cb(CALLBACK_ARGS) WID->context_geometry_input[0]->value("NewName"); WID->create_geometry_context_window(0); } - else { // sort - SetVisibilitySort(val); + else { // set new sorting mode + VisibilityManager::instance()->setSortMode(val); visibility_cb(NULL, NULL); } } void visibility_number_cb(CALLBACK_ARGS) { - int mode, type = (int)(long)data; + CTX.mesh.changed = 1; + int type = (int)(long)data; + bool val; if(type >= 100){ // show - mode = VIS_GEOM | VIS_MESH; + val = true; type -= 100; - CTX.mesh.changed = 1; } else{ // hide - mode = 0; - CTX.mesh.changed = 1; + val = false; } char *str = (char *)WID->vis_input[type]->value(); - SetVisibilityByNumber(str, type, mode); + int all = !strcmp(str, "all") || !strcmp(str, "*"); + int num = all ? 0 : atoi(str); + + switch(type){ + case 0: // nodes + for(GModel::viter it = GMODEL->firstVertex(); it != GMODEL->lastVertex(); it++) + for(unsigned int i = 0; i < (*it)->mesh_vertices.size(); i++) + if(all || (*it)->mesh_vertices[i]->getNum() == num) + (*it)->mesh_vertices[i]->setVisibility(val); + for(GModel::eiter it = GMODEL->firstEdge(); it != GMODEL->lastEdge(); it++) + for(unsigned int i = 0; i < (*it)->mesh_vertices.size(); i++) + if(all || (*it)->mesh_vertices[i]->getNum() == num) + (*it)->mesh_vertices[i]->setVisibility(val); + for(GModel::fiter it = GMODEL->firstFace(); it != GMODEL->lastFace(); it++) + for(unsigned int i = 0; i < (*it)->mesh_vertices.size(); i++) + if(all || (*it)->mesh_vertices[i]->getNum() == num) + (*it)->mesh_vertices[i]->setVisibility(val); + for(GModel::riter it = GMODEL->firstRegion(); it != GMODEL->lastRegion(); it++) + for(unsigned int i = 0; i < (*it)->mesh_vertices.size(); i++) + if(all || (*it)->mesh_vertices[i]->getNum() == num) + (*it)->mesh_vertices[i]->setVisibility(val); + break; + case 1: // elements + for(GModel::eiter it = GMODEL->firstEdge(); it != GMODEL->lastEdge(); it++){ + for(unsigned int i = 0; i < (*it)->lines.size(); i++) + if(all || (*it)->lines[i]->getNum() == num) + (*it)->lines[i]->setVisibility(val); + } + for(GModel::fiter it = GMODEL->firstFace(); it != GMODEL->lastFace(); it++){ + for(unsigned int i = 0; i < (*it)->triangles.size(); i++) + if(all || (*it)->triangles[i]->getNum() == num) + (*it)->triangles[i]->setVisibility(val); + for(unsigned int i = 0; i < (*it)->quadrangles.size(); i++) + if(all || (*it)->quadrangles[i]->getNum() == num) + (*it)->quadrangles[i]->setVisibility(val); + } + for(GModel::riter it = GMODEL->firstRegion(); it != GMODEL->lastRegion(); it++){ + for(unsigned int i = 0; i < (*it)->tetrahedra.size(); i++) + if(all || (*it)->tetrahedra[i]->getNum() == num) + (*it)->tetrahedra[i]->setVisibility(val); + for(unsigned int i = 0; i < (*it)->hexahedra.size(); i++) + if(all || (*it)->hexahedra[i]->getNum() == num) + (*it)->hexahedra[i]->setVisibility(val); + for(unsigned int i = 0; i < (*it)->prisms.size(); i++) + if(all || (*it)->prisms[i]->getNum() == num) + (*it)->prisms[i]->setVisibility(val); + for(unsigned int i = 0; i < (*it)->pyramids.size(); i++) + if(all || (*it)->pyramids[i]->getNum() == num) + (*it)->pyramids[i]->setVisibility(val); + } + break; + case 2: // point + for(GModel::viter it = GMODEL->firstVertex(); it != GMODEL->lastVertex(); it++) + if(all || (*it)->tag() == num) (*it)->setVisibility(val); + break; + case 3: // line + for(GModel::eiter it = GMODEL->firstEdge(); it != GMODEL->lastEdge(); it++) + if(all || (*it)->tag() == num) (*it)->setVisibility(val); + break; + case 4: // surface + for(GModel::fiter it = GMODEL->firstFace(); it != GMODEL->lastFace(); it++) + if(all || (*it)->tag() == num) (*it)->setVisibility(val); + break; + case 5: // volume + for(GModel::riter it = GMODEL->firstRegion(); it != GMODEL->lastRegion(); it++) + if(all || (*it)->tag() == num) (*it)->setVisibility(val); + break; + } + int pos = WID->vis_browser->position(); visibility_cb(NULL, NULL); WID->vis_browser->position(pos); - Draw(); } @@ -2294,8 +2259,6 @@ void geometry_elementary_add_new_volume_cb(CALLBACK_ARGS) static void _action_point_line_surface_volume(int action, int mode, char *what) { - extern void BDS_To_Mesh(Mesh *m); - GVertex *v[SELECTION_MAX_HITS]; GEdge *c[SELECTION_MAX_HITS]; GFace *s[SELECTION_MAX_HITS]; @@ -2331,12 +2294,7 @@ static void _action_point_line_surface_volume(int action, int mode, char *what) WID->create_mesh_context_window(0); } else if(action == 10){ - if(THEM && THEM->bds) { - const double angle = CTX.mesh.dihedral_angle_tol * M_PI / 180.; - const int nb_t = CTX.mesh.edge_prolongation_threshold; - THEM->bds->classify(angle, nb_t); - BDS_To_Mesh(THEM); - } + Msg(GERROR, "BDS->classify(angle, edge_prolongation) must be reinterfaced"); } Draw(); @@ -2485,20 +2443,7 @@ static void _action_point_line_surface_volume(int action, int mode, char *what) add_recosurf(List1, CTX.filename); break; case 10: - if(THEM && THEM->bds) { - for(int i = 0; i < List_Nbr(List1); i++){ - int num; - List_Read(List1, i, &num); - BDS_GeomEntity *g = THEM->bds->get_geom(num, 1); - std::list<BDS_Edge*>::iterator it = g->e.begin(); - std::list<BDS_Edge*>::iterator ite = g->e.end(); - while (it!=ite){ - BDS_Edge *e = (*it); - e->status = 1; - ++it; - } - } - } + Msg(GERROR, "BDS->get_geom and set status must be reinterfaced"); break; default: Msg(GERROR, "Unknown action on selected entities"); @@ -2512,12 +2457,7 @@ static void _action_point_line_surface_volume(int action, int mode, char *what) } if(ib == 'q') { if(action == 10){ - if(THEM && THEM->bds) { - const double angle = CTX.mesh.dihedral_angle_tol * M_PI / 180.; - const int nb_t = CTX.mesh.edge_prolongation_threshold; - THEM->bds->classify(angle, nb_t); - BDS_To_Mesh(THEM); - } + Msg(GERROR, "BDS->classify() must be reinterfaced"); } ZeroHighlight(); Draw(); @@ -2870,7 +2810,7 @@ void mesh_degree_cb(CALLBACK_ARGS) { switch ((long)data) { case 2: - Degre2(THEM->status); + Degre2(GMODEL->getMeshStatus()); break; case 1: default: @@ -2899,20 +2839,14 @@ void mesh_optimize_cb(CALLBACK_ARGS) void mesh_remesh_cb(CALLBACK_ARGS) { - ReMesh(THEM); + ReMesh(); Draw(); Msg(STATUS2N, " "); } void mesh_update_edges_cb(CALLBACK_ARGS) { - extern void BDS_To_Mesh(Mesh *m); - if(THEM && THEM->bds){ - THEM->bds->classify(CTX.mesh.dihedral_angle_tol * M_PI/180, - CTX.mesh.edge_prolongation_threshold); - BDS_To_Mesh (THEM); - Draw(); - } + Msg(GERROR, "BDS->classify() must be reinterfaced"); } void mesh_update_more_edges_cb(CALLBACK_ARGS) @@ -3096,7 +3030,6 @@ void mesh_define_elliptic_surface_cb(CALLBACK_ARGS) void solver_cb(CALLBACK_ARGS) { - char file[256], tmp[256]; static int init = 0, first[MAXSOLVERS]; int num = (int)(long)data; @@ -3107,13 +3040,14 @@ void solver_cb(CALLBACK_ARGS) } if(first[num]) { + char file[256]; first[num] = 0; strcpy(file, CTX.base_filename); strcat(file, SINFO[num].extension); WID->solver[num].input[0]->value(file); } if(SINFO[num].nboptions) { - char file[1024]; + char file[256], tmp[256]; FixWindowsPath((char*)WID->solver[num].input[0]->value(), file); sprintf(tmp, "\"%s\"", file); sprintf(file, SINFO[num].name_command, tmp); diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 2da2eb40c311eea5460536466f37ed62782a70ce..2a36d872ec0576b81426234877abb73ad010901a 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.506 2006-08-08 04:35:22 geuzaine Exp $ +// $Id: GUI.cpp,v 1.507 2006-08-12 16:16:28 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -181,8 +181,8 @@ Fl_Menu_Item m_module_table[] = { Context_Item menu_geometry[] = { {"0Geometry", NULL} , - {"Elementary", (Fl_Callback *)geometry_elementary_cb} , - {"Physical", (Fl_Callback *)geometry_physical_cb} , + {"Elementary entities", (Fl_Callback *)geometry_elementary_cb} , + {"Physical groups", (Fl_Callback *)geometry_physical_cb} , {"Edit", (Fl_Callback *)geometry_edit_cb} , {"Reload", (Fl_Callback *)geometry_reload_cb} , {0} @@ -2392,7 +2392,7 @@ void GUI::create_option_window() static Fl_Menu_Item menu_label_type[] = { {"Number", 0, 0, 0}, {"Elementary entity", 0, 0, 0}, - {"Physical entity", 0, 0, 0}, + {"Physical group", 0, 0, 0}, {"Partition", 0, 0, 0}, {"Coordinates", 0, 0, 0}, {0} @@ -3822,17 +3822,11 @@ void GUI::create_visibility_window() static int cols[5] = { 15, 95, 95, 180, 0 }; static Fl_Menu_Item type_table[] = { - {"Elementary", 0, (Fl_Callback *) visibility_cb}, - {"Physical", 0, (Fl_Callback *) visibility_cb}, + {"Elementary entities", 0, (Fl_Callback *) visibility_cb}, + {"Physical groups", 0, (Fl_Callback *) visibility_cb}, {"Partitions", 0, (Fl_Callback *) visibility_cb}, {0} }; - static Fl_Menu_Item browser_mode_table[] = { - {"Geometry+Mesh", 0, (Fl_Callback *) visibility_cb}, - {"Geometry", 0, (Fl_Callback *) visibility_cb}, - {"Mesh", 0, (Fl_Callback *) visibility_cb}, - {0} - }; int width = cols[0] + cols[1] + cols[2] + cols[3] + 6 * WB; int height = 18 * BH; @@ -3845,15 +3839,13 @@ void GUI::create_visibility_window() Fl_Group *o = new Fl_Group(WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Browser"); int brw = width - 4 * WB; - int buw = (brw - 2 * WB)/3; + int buw = (brw - 2 * WB) / 2; vis_type = new Fl_Choice(2 * WB, 2 * WB + 1 * BH, buw, BH); vis_type->menu(type_table); - vis_browser_mode = new Fl_Choice(2 * WB + buw + WB, 2 * WB + 1 * BH, buw, BH); - vis_browser_mode->menu(browser_mode_table); - - vis_butt[0] = new Fl_Check_Button(2 * WB + 2 * buw + 2 * WB, 2 * WB + 1 * BH, buw, BH, "Recursive"); + vis_butt[0] = new Fl_Check_Button(2 * WB + buw + WB, 2 * WB + 1 * BH, width - 5 * WB - buw, BH, + "Set visibility recursively"); vis_butt[0]->type(FL_TOGGLE_BUTTON); vis_butt[0]->down_box(GMSH_TOGGLE_BOX); vis_butt[0]->selection_color(GMSH_TOGGLE_COLOR); @@ -3891,7 +3883,6 @@ void GUI::create_visibility_window() Fl_Group *o = new Fl_Group(2 * WB, 3 * WB + 3 * BH, brw, height - 7 * WB - 5 * BH); vis_browser = new Vis_Browser(2 * WB, 3 * WB + 3 * BH, brw, height - 7 * WB - 5 * BH); - vis_browser->textfont(FL_COURIER); vis_browser->type(FL_MULTI_BROWSER); vis_browser->column_widths(cols); diff --git a/Fltk/GUI.h b/Fltk/GUI.h index 72baae625abb582e08d661976316794ef93a44af..017c7235c20e46751720ebc51e1f94ae07600ff9 100644 --- a/Fltk/GUI.h +++ b/Fltk/GUI.h @@ -223,7 +223,7 @@ public: // visibility window Fl_Window *vis_window ; - Fl_Choice *vis_type, *vis_browser_mode, *vis_input_mode ; + Fl_Choice *vis_type ; Fl_Browser *vis_browser ; Fl_Check_Button *vis_butt[20] ; Fl_Input *vis_input[10]; diff --git a/Fltk/Makefile b/Fltk/Makefile index f842b44ca7eb5ac0b16ff7345f0a7236ec75319e..1c585ed76425ce5feb9b89736224dd7f0cbe43ef 100644 --- a/Fltk/Makefile +++ b/Fltk/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.95 2006-08-08 04:35:23 geuzaine Exp $ +# $Id: Makefile,v 1.96 2006-08-12 16:16:28 geuzaine Exp $ # # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle # @@ -138,32 +138,35 @@ GUI_Extras.o: GUI_Extras.cpp ../Common/Gmsh.h ../Common/Message.h \ ../Common/SmoothNormals.h ../Common/GmshMatrix.h \ ../Common/AdaptiveViews.h ../Common/GmshMatrix.h # 1 "/Users/geuzaine/.gmsh/Fltk//" -Callbacks.o: Callbacks.cpp ../Mesh/BDS.h ../Common/Views.h \ - ../Common/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \ - ../Common/SmoothNormals.h ../Numeric/Numeric.h ../Common/GmshMatrix.h \ - ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Common/Gmsh.h \ - ../Common/Message.h ../DataStr/Malloc.h ../DataStr/Tree.h \ +Callbacks.o: Callbacks.cpp ../Common/Gmsh.h ../Common/Message.h \ + ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \ ../DataStr/avl.h ../DataStr/Tools.h ../DataStr/List.h ../DataStr/Tree.h \ ../Common/GmshUI.h ../Geo/Geo.h ../Geo/CAD.h ../Mesh/Mesh.h \ ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Vertex.h ../Mesh/Simplex.h \ ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Face.h ../Mesh/Vertex.h \ ../Mesh/Element.h ../Mesh/Edge.h ../Mesh/Vertex.h ../Mesh/Simplex.h \ - ../Geo/ExtrudeParams.h ../Common/GmshDefines.h ../Mesh/Metric.h \ - ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h \ - ../Geo/ExtrudeParams.h ../Geo/ExtractContour.h ../Graphics/Draw.h \ + ../Geo/ExtrudeParams.h ../Common/VertexArray.h \ + ../Common/SmoothNormals.h ../Numeric/Numeric.h ../Common/GmshDefines.h \ + ../Mesh/Metric.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h \ + ../Mesh/Matrix.h ../Geo/ExtrudeParams.h ../Geo/ExtractContour.h \ + ../Graphics/Draw.h ../Common/Views.h ../Common/ColorTable.h \ + ../Common/VertexArray.h ../Common/SmoothNormals.h \ + ../Common/GmshMatrix.h ../Common/AdaptiveViews.h ../Common/GmshMatrix.h \ ../Graphics/CreateFile.h ../Parser/OpenFile.h ../Common/CommandLine.h \ ../Common/Context.h ../Common/Options.h GUI.h Opengl_Window.h \ Colorbar_Window.h Popup_Button.h GUI_Extras.h Callbacks.h \ ../Plugin/Plugin.h ../Plugin/PluginManager.h ../Plugin/Plugin.h \ - ../Common/Visibility.h Solvers.h ../Common/OS.h ../Geo/GModel.h \ - ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \ + ../Common/Visibility.h ../Common/GmshDefines.h ../Geo/GVertex.h \ + ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \ ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \ ../Geo/MVertex.h ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h \ ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \ ../Geo/SPoint2.h ../Geo/MElement.h ../Geo/MVertex.h ../Geo/GFace.h \ ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/MElement.h ../Geo/SPoint2.h \ ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \ - ../Geo/MElement.h ../Geo/SBoundingBox3d.h + ../Geo/MElement.h Solvers.h ../Common/OS.h ../Geo/GModel.h \ + ../Geo/GVertex.h ../Geo/GEdge.h ../Geo/GFace.h ../Geo/GRegion.h \ + ../Geo/SBoundingBox3d.h # 1 "/Users/geuzaine/.gmsh/Fltk//" Opengl.o: Opengl.cpp ../Common/Gmsh.h ../Common/Message.h \ ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \ diff --git a/Geo/CAD.cpp b/Geo/CAD.cpp index 05cedde23f6052ef539a2e8c4900b51b41660278..5dcebde6bf8445b0264d767ed07de974be5f3e8d 100644 --- a/Geo/CAD.cpp +++ b/Geo/CAD.cpp @@ -1,4 +1,4 @@ -// $Id: CAD.cpp,v 1.98 2006-05-13 22:04:04 geuzaine Exp $ +// $Id: CAD.cpp,v 1.99 2006-08-12 16:16:29 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -27,7 +27,6 @@ #include "Create.h" #include "CAD.h" #include "Edge.h" -#include "Visibility.h" #include "Context.h" extern Mesh *THEM; @@ -592,9 +591,17 @@ void ColorShape(int Type, int Num, unsigned int Color) void VisibilityShape(int Type, int Num, int Mode) { + Vertex *v; + Curve *c; + Surface *s; + Volume *V; + switch (Type) { case MSH_POINT: - SetVisibilityByNumber(Num, 2, Mode); + if((v = FindPoint(Num, THEM))) + v->Visible = Mode; + else + Msg(WARNING, "Unknown point %d (use '*' to hide/show all points)", Num); break; case MSH_SEGM_LINE: case MSH_SEGM_SPLN: @@ -607,24 +614,56 @@ void VisibilityShape(int Type, int Num, int Mode) case MSH_SEGM_NURBS: case MSH_SEGM_PARAMETRIC: case MSH_SEGM_DISCRETE: - SetVisibilityByNumber(Num, 3, Mode); + if((c = FindCurve(Num, THEM))) + c->Visible = Mode; + else + Msg(WARNING, "Unknown line %d (use '*' to hide/show all lines)", Num); break; case MSH_SURF_NURBS: case MSH_SURF_TRIC: case MSH_SURF_REGL: case MSH_SURF_PLAN: case MSH_SURF_DISCRETE: - SetVisibilityByNumber(Num, 4, Mode); + if((s = FindSurface(Num, THEM))) + s->Visible = Mode; + else + Msg(WARNING, "Unknown surface %d (use '*' to hide/show all surfaces)", Num); break; case MSH_VOLUME: case MSH_VOLUME_DISCRETE: - SetVisibilityByNumber(Num, 5, Mode); + if((V = FindVolume(Num, THEM))) + V->Visible = Mode; + else + Msg(WARNING, "Unknown volume %d (use '*' to hide/show all volumes)", Num); break; default: break; } } +static int vmode; +static void vis_nod(void *a, void *b){ (*(Vertex **) a)->Visible = vmode; } +static void vis_cur(void *a, void *b){ (*(Curve **) a)->Visible = vmode; } +static void vis_sur(void *a, void *b){ (*(Surface **) a)->Visible = vmode; } +static void vis_vol(void *a, void *b){ (*(Volume **) a)->Visible = vmode; } + +void VisibilityShape(char *str, int Type, int Mode) +{ + vmode = Mode; + + if(!strcmp(str, "all") || !strcmp(str, "*")) { + switch (Type) { + case 0: Tree_Action(THEM->Points, vis_nod); break; + case 1: Tree_Action(THEM->Curves, vis_cur); break; + case 2: Tree_Action(THEM->Surfaces, vis_sur); break; + case 3: Tree_Action(THEM->Volumes, vis_vol); break; + } + } + else { + VisibilityShape(Type, atoi(str), Mode); + } +} + Curve *CreateReversedCurve(Mesh * M, Curve * c) { Curve *newc; diff --git a/Geo/CAD.h b/Geo/CAD.h index c610853f93196722e0f405c1ff8ba81793aa6d34..1b383d4297441520e059929d5c09ca082895df5b 100644 --- a/Geo/CAD.h +++ b/Geo/CAD.h @@ -59,6 +59,7 @@ void CopyShape(int Type, int Num, int *New); void DeleteShape(int Type, int Num); void ColorShape(int Type, int Num, unsigned int Color); void VisibilityShape(int Type, int Num, int Mode); +void VisibilityShape(char *str, int Type, int Mode); void ExtrudeShape(int extrude_type, int shape_type, int shape_num, double T0, double T1, double T2, double A0, double A1, double A2, diff --git a/Geo/GEdge.cpp b/Geo/GEdge.cpp index 0ed3301e4e476f846230a81669cc049b3055f784..2d95e415bf0df536ad949407b7b3ce9f493fea79 100644 --- a/Geo/GEdge.cpp +++ b/Geo/GEdge.cpp @@ -38,6 +38,15 @@ GEdge::~GEdge() lines.clear(); } +void GEdge::setVisibility(bool val, bool recursive) +{ + GEntity::setVisibility(val); + if(recursive){ + if(v0) v0->setVisibility(val); + if(v1) v1->setVisibility(val); + } +} + void GEdge::recomputeMeshPartitions() { for(unsigned int i = 0; i < lines.size(); i++) { diff --git a/Geo/GEdge.h b/Geo/GEdge.h index 1a51ae5eadd840033bec8cb21e7655b02ab84295..4ae06de5afc263e6d87a0d940bace0b4891afe7c 100644 --- a/Geo/GEdge.h +++ b/Geo/GEdge.h @@ -26,6 +26,7 @@ class GEdge : public GEntity { virtual bool periodic(int dim=0) const = 0; virtual bool continuous(int dim=0) const = 0; + virtual void setVisibility(bool val, bool recursive=false); // Get the parameter location for a point in space on the edge. virtual double parFromPoint(const SPoint3 &) const = 0; @@ -68,6 +69,7 @@ class GEdge : public GEntity { virtual std::string getAdditionalInfoString() { + if(!v0 || !v1) return ""; char tmp[256]; sprintf(tmp, "{%d,%d}", v0->tag(), v1->tag()); return std::string(tmp); diff --git a/Geo/GEntity.h b/Geo/GEntity.h index 81a122143d7f31341c2fb2956c749520d09f6a1c..0083e20128f6efdca214c59e74a465036fad407b 100644 --- a/Geo/GEntity.h +++ b/Geo/GEntity.h @@ -24,6 +24,8 @@ class GEntity { GModel *_model; int _tag; MRep *_geom, *_mesh; + bool _visible; + char _flag; public: @@ -74,11 +76,7 @@ class GEntity { return name[type]; } - GEntity(GModel *m, int t) : _model(m), _tag(t) - { - drawAttributes.Visible = VIS_GEOM | VIS_MESH; - drawAttributes.Frozen = 0; - } + GEntity(GModel *m, int t) : _model(m), _tag(t), _visible(true), _flag(0) {} virtual ~GEntity() {}; @@ -133,16 +131,13 @@ class GEntity { // The bounding box virtual SBoundingBox3d bounds() const{throw;} - // The mesh vertices uniquely owned by the entity - std::vector<MVertex*> mesh_vertices; - - // The physical entitites (if any) that contain this entity - std::vector<int> physicals; + // get/set the visibility flag + virtual bool getVisibility(){ return _visible; } + virtual void setVisibility(bool val, bool recursive=false){ _visible = val; } - // The standard drawing attributes of the entity - struct { - char Visible, Frozen; - } drawAttributes ; + // get/set the multi-purpose flag + virtual char getFlag(){ return _flag; } + virtual void setFlag(char val){ _flag = val; } // Returns a renderable representation of the geometry virtual MRep *geomRep(){ return _geom; } @@ -176,6 +171,12 @@ class GEntity { // Returns a type-specific additional information string virtual std::string getAdditionalInfoString() { return std::string(""); } + + // The mesh vertices uniquely owned by the entity + std::vector<MVertex*> mesh_vertices; + + // The physical entitites (if any) that contain this entity + std::vector<int> physicals; }; class GEntityLessThan { diff --git a/Geo/GFace.cpp b/Geo/GFace.cpp index 01a587318333a3f012a55603ae3f58a5c8dc492e..cdef67aaf10b3bf37e3fdf8188c4bc47d62748b0 100644 --- a/Geo/GFace.cpp +++ b/Geo/GFace.cpp @@ -40,6 +40,18 @@ std::list<GVertex*> GFace::vertices() const return ret; } +void GFace::setVisibility(bool val, bool recursive) +{ + GEntity::setVisibility(val); + if(recursive){ + std::list<GEdge*>::iterator it = l_edges.begin(); + while (it != l_edges.end()){ + (*it)->setVisibility(val, recursive); + ++it; + } + } +} + void GFace::recomputeMeshPartitions() { for(unsigned int i = 0; i < triangles.size(); i++) { diff --git a/Geo/GFace.h b/Geo/GFace.h index 943b7c25c16529585de0bee26c5fafdd3d9f7b1e..14a7dfee3f71270e20f3f14580649c12f80ceb8a 100644 --- a/Geo/GFace.h +++ b/Geo/GFace.h @@ -41,6 +41,7 @@ class GFace : public GEntity virtual std::list<GVertex*> vertices() const; virtual int dim() const {return 2;} + virtual void setVisibility(bool val, bool recursive=false); // Get the location of any parametric degeneracies on the face in // the given parametric direction. diff --git a/Geo/GRegion.cpp b/Geo/GRegion.cpp index 8bac8f2b477b621ea6df1a91a4b6650f578665ea..53c6bf4a010249ac6665aa0f3b488199f08b984d 100644 --- a/Geo/GRegion.cpp +++ b/Geo/GRegion.cpp @@ -5,7 +5,6 @@ GRegion::~GRegion () { std::list<GFace*>::iterator it = l_faces.begin(); - while(it != l_faces.end()){ (*it)->delRegion(this); ++it; @@ -32,6 +31,18 @@ GRegion::~GRegion () pyramids.clear(); } +void GRegion::setVisibility(bool val, bool recursive) +{ + GEntity::setVisibility(val); + if(recursive){ + std::list<GFace*>::iterator it = l_faces.begin(); + while(it != l_faces.end()){ + (*it)->setVisibility(val, recursive); + ++it; + } + } +} + void GRegion::recomputeMeshPartitions() { for(unsigned int i = 0; i < tetrahedra.size(); i++) { diff --git a/Geo/GRegion.h b/Geo/GRegion.h index fcc0576a97418497525345a21e053332c463d5cc..8e08f96f2955e1d43e344fbc7a8dff44072c53f5 100644 --- a/Geo/GRegion.h +++ b/Geo/GRegion.h @@ -14,6 +14,7 @@ class GRegion : public GEntity { virtual ~GRegion(); virtual int dim() const {return 3;} virtual GeomType geomType() const {return Volume;} + virtual void setVisibility(bool val, bool recursive=false); // recompute the mesh partitions defined on this region. void recomputeMeshPartitions(); diff --git a/Geo/GVertex.h b/Geo/GVertex.h index 79c5d14559ce9878cc3928fae3b68984b83f6065..8cc48593e2e15947a69fd3aafae14c3a489a22ca 100644 --- a/Geo/GVertex.h +++ b/Geo/GVertex.h @@ -9,7 +9,7 @@ class GVertex : public GEntity { public: - GVertex(GModel *m, int tag) : GEntity (m,tag) + GVertex(GModel *m, int tag) : GEntity (m, tag) { } virtual ~GVertex() diff --git a/Geo/MElement.h b/Geo/MElement.h index 918be313009cb7dbd8733d9841b0faf2f4d58002..41ed1ee512f83fde380bd79758bc0fe4ea48bcb8 100644 --- a/Geo/MElement.h +++ b/Geo/MElement.h @@ -22,15 +22,12 @@ extern int quadfaces_pyramid[1][4]; class MElement { - private: - static int _globalNum; int _num, _partition; bool _visible; public : - MElement(int num=0, int part=0) : _partition(part), _visible(true) { @@ -51,8 +48,8 @@ class MElement virtual int getPartition(){ return _partition; } // get/set the visibility flag - virtual bool isVisible(){ return _visible; } - virtual void setVisible(bool val){ _visible = val; } + virtual bool getVisibility(){ return _visible; } + virtual void setVisibility(bool val){ _visible = val; } // get the vertices virtual int getNumVertices() = 0; diff --git a/Geo/MVertex.h b/Geo/MVertex.h index 24ed0d86fabccab8723ad027d183404592ee634b..ef0c6a144127288449389df59cc617ba0d3c21ae 100644 --- a/Geo/MVertex.h +++ b/Geo/MVertex.h @@ -10,11 +10,13 @@ class MVertex{ private: static int _globalNum; int _num; + bool _visible; double _x, _y, _z; GEntity *_ge; + public : MVertex(double x, double y, double z, GEntity *ge=0, int num=0) - : _x(x), _y(y), _z(z), _ge(ge) + : _visible(true), _x(x), _y(y), _z(z), _ge(ge) { if(num){ _num = num; @@ -25,14 +27,24 @@ class MVertex{ } } virtual ~MVertex(){} + + // get/set the visibility flag + virtual bool getVisibility(){ return _visible; } + virtual void setVisibility(bool val){ _visible = val; } + + // get/set the coordinates inline double x() const {return _x;} inline double y() const {return _y;} inline double z() const {return _z;} inline double & x() {return _x;} inline double & y() {return _y;} inline double & z() {return _z;} + + // get/set the parent entity inline GEntity* onWhat() const {return _ge;} inline void setEntity(GEntity *ge) { _ge = ge; } + + // get/set the number inline int getNum() const {return _num;} inline void setNum(int num) { _num = num; } diff --git a/Geo/Makefile b/Geo/Makefile index 1d477dfe6bd3807fb2aedfb35b40c7480f850ec8..8ca22b93cd788da98ee0a1e5352a51b6eb8e2fde 100644 --- a/Geo/Makefile +++ b/Geo/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.84 2006-08-07 19:08:11 geuzaine Exp $ +# $Id: Makefile,v 1.85 2006-08-12 16:16:29 geuzaine Exp $ # # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle # @@ -89,7 +89,7 @@ CAD.o: CAD.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \ ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h \ ../Mesh/Interpolation.h ../Mesh/Vertex.h ../Mesh/Mesh.h \ ../Mesh/Create.h ../Mesh/Vertex.h ../Mesh/Mesh.h CAD.h ExtrudeParams.h \ - ../Common/Visibility.h ../Common/Context.h + ../Common/Context.h # 1 "/Users/geuzaine/.gmsh/Geo//" ExtrudeParams.o: ExtrudeParams.cpp ../Common/Gmsh.h ../Common/Message.h \ ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \ @@ -130,17 +130,20 @@ GeoUtils.o: GeoUtils.cpp ../Common/Gmsh.h ../Common/Message.h \ GVertex.o: GVertex.cpp GVertex.h GEntity.h Range.h SPoint3.h \ SBoundingBox3d.h MVertex.h ../Common/GmshDefines.h GPoint.h # 1 "/Users/geuzaine/.gmsh/Geo//" -GEdge.o: GEdge.cpp GEdge.h GEntity.h Range.h SPoint3.h SBoundingBox3d.h \ - MVertex.h ../Common/GmshDefines.h GVertex.h GPoint.h SVector3.h \ - SPoint2.h MElement.h ../Numeric/Numeric.h +GEdge.o: GEdge.cpp GModel.h GVertex.h GEntity.h Range.h SPoint3.h \ + SBoundingBox3d.h MVertex.h ../Common/GmshDefines.h GPoint.h GEdge.h \ + SVector3.h SPoint2.h MElement.h ../Numeric/Numeric.h GFace.h Pair.h \ + GRegion.h # 1 "/Users/geuzaine/.gmsh/Geo//" -GFace.o: GFace.cpp GFace.h GPoint.h GEntity.h Range.h SPoint3.h \ - SBoundingBox3d.h MVertex.h ../Common/GmshDefines.h MElement.h \ - ../Numeric/Numeric.h SPoint2.h SVector3.h Pair.h GEdge.h GVertex.h +GFace.o: GFace.cpp GModel.h GVertex.h GEntity.h Range.h SPoint3.h \ + SBoundingBox3d.h MVertex.h ../Common/GmshDefines.h GPoint.h GEdge.h \ + SVector3.h SPoint2.h MElement.h ../Numeric/Numeric.h GFace.h Pair.h \ + GRegion.h # 1 "/Users/geuzaine/.gmsh/Geo//" -GRegion.o: GRegion.cpp GRegion.h GEntity.h Range.h SPoint3.h \ - SBoundingBox3d.h MVertex.h ../Common/GmshDefines.h MElement.h \ - ../Numeric/Numeric.h GFace.h GPoint.h SPoint2.h SVector3.h Pair.h +GRegion.o: GRegion.cpp GModel.h GVertex.h GEntity.h Range.h SPoint3.h \ + SBoundingBox3d.h MVertex.h ../Common/GmshDefines.h GPoint.h GEdge.h \ + SVector3.h SPoint2.h MElement.h ../Numeric/Numeric.h GFace.h Pair.h \ + GRegion.h # 1 "/Users/geuzaine/.gmsh/Geo//" GModel.o: GModel.cpp GModel.h GVertex.h GEntity.h Range.h SPoint3.h \ SBoundingBox3d.h MVertex.h ../Common/GmshDefines.h GPoint.h GEdge.h \ diff --git a/Geo/gmshModel.cpp b/Geo/gmshModel.cpp index 7c58c5da088c38a5465cb16d3e264d88c7188cfa..b471257f7a5cbf883961777fbfe389e78ae0f3c1 100644 --- a/Geo/gmshModel.cpp +++ b/Geo/gmshModel.cpp @@ -41,16 +41,19 @@ void gmshModel::convertFromUglyOldDataStructuresgmshModel() if(points.find(c->beg) == points.end()){ points.insert(c->beg); gmshVertex *v = new gmshVertex(this, c->beg); + v->setVisibility(c->beg->Visible); add(v); } if(points.find(c->end) == points.end()){ points.insert(c->end); gmshVertex *v = new gmshVertex(this, c->end); + v->setVisibility(c->beg->Visible); add(v); } - gmshEdge *e = new gmshEdge (this, c, - vertexByTag(c->beg->Num), - vertexByTag(c->end->Num) ); + gmshEdge *e = new gmshEdge(this, c, + vertexByTag(c->beg->Num), + vertexByTag(c->end->Num)); + e->setVisibility(c->Visible); add(e); } } @@ -61,7 +64,8 @@ void gmshModel::convertFromUglyOldDataStructuresgmshModel() for(int i = 0; i < List_Nbr(surfaces); i++){ Surface *s; List_Read(surfaces, i, &s); - gmshFace *f = new gmshFace ( this, s ); + gmshFace *f = new gmshFace(this, s); + f->setVisibility(s->Visible); add(f); } List_Delete(surfaces); @@ -72,6 +76,7 @@ void gmshModel::convertFromUglyOldDataStructuresgmshModel() Volume *v; List_Read(volumes, i, &v); gmshRegion *r = new gmshRegion(this, v); + r->setVisibility(v->Visible); add(r); } List_Delete(volumes); diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp index f63c4289f12fe99fce94a51431a2845f9b393784..70acadc0eea4ed797183c5d5ca60e834981cb5ca 100644 --- a/Graphics/Geom.cpp +++ b/Graphics/Geom.cpp @@ -1,4 +1,4 @@ -// $Id: Geom.cpp,v 1.104 2006-08-06 22:58:49 geuzaine Exp $ +// $Id: Geom.cpp,v 1.105 2006-08-12 16:16:30 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -35,7 +35,7 @@ extern GModel *GMODEL; void drawGeoVertex(GVertex *v) { - if(!(v->drawAttributes.Visible & VIS_GEOM)) + if(!v->getVisibility()) return; if(CTX.render_mode == GMSH_SELECT) { @@ -43,7 +43,7 @@ void drawGeoVertex(GVertex *v) glPushName(v->tag()); } - if(v->drawAttributes.Frozen > 0) { + if(v->getFlag() > 0) { glPointSize(CTX.geom.point_sel_size); gl2psPointSize(CTX.geom.point_sel_size * CTX.print.eps_point_size_factor); glColor4ubv((GLubyte *) & CTX.color.geom.point_sel); @@ -56,7 +56,7 @@ void drawGeoVertex(GVertex *v) if(CTX.geom.points) { if(CTX.geom.point_type == 1) { - if(v->drawAttributes.Frozen > 0) + if(v->getFlag() > 0) Draw_Sphere(CTX.geom.point_sel_size, v->x(), v->y(), v->z(), CTX.geom.light); else @@ -101,7 +101,7 @@ void drawGeoVertex(GVertex *v) void drawGeoEdge(GEdge *c) { - if(c->tag() < 0 || !(c->drawAttributes.Visible & VIS_GEOM)) + if(!c->getVisibility()) return; if(CTX.render_mode == GMSH_SELECT) { @@ -109,7 +109,7 @@ void drawGeoEdge(GEdge *c) glPushName(c->tag()); } - if(c->drawAttributes.Frozen > 0) { + if(c->getFlag() > 0) { glLineWidth(CTX.geom.line_sel_width); gl2psLineWidth(CTX.geom.line_sel_width * CTX.print.eps_line_width_factor); glColor4ubv((GLubyte *) & CTX.color.geom.line_sel); @@ -142,7 +142,7 @@ void drawGeoEdge(GEdge *c) double x[2] = {p1.x(), p2.x()}; double y[2] = {p1.y(), p2.y()}; double z[2] = {p1.z(), p2.z()}; - Draw_Cylinder(c->drawAttributes.Frozen > 0 ? CTX.geom.line_sel_width : + Draw_Cylinder(c->getFlag() > 0 ? CTX.geom.line_sel_width : CTX.geom.line_width, x, y, z, CTX.geom.light); if(sp) { Msg(FATAL, "GL_enhanceLine not done"); @@ -196,7 +196,7 @@ void drawGeoEdge(GEdge *c) void drawGeoFace(GFace *s) { - if(!(s->drawAttributes.Visible & VIS_GEOM)) + if(!s->getVisibility()) return; if(CTX.render_mode == GMSH_SELECT) { @@ -204,7 +204,7 @@ void drawGeoFace(GFace *s) glPushName(s->tag()); } - if(s->drawAttributes.Frozen > 0) { + if(s->getFlag() > 0) { glLineWidth(CTX.geom.line_sel_width / 2.); gl2psLineWidth(CTX.geom.line_sel_width / 2. * CTX.print.eps_line_width_factor); @@ -278,7 +278,7 @@ void Draw_Geom() void HighlightEntity(GEntity *e, int permanent) { if(permanent) - e->drawAttributes.Frozen = 2; + e->setFlag(2); else Msg(STATUS2N, "%s", e->getInfoString().c_str()); } @@ -309,7 +309,7 @@ void HighlightEntityNum(int v, int c, int s, int permanent) void ZeroHighlightEntity(GEntity *e) { - e->drawAttributes.Frozen = -2; + e->setFlag(-2); } void ZeroHighlightEntity(GVertex *v, GEdge *c, GFace *s) diff --git a/Graphics/Makefile b/Graphics/Makefile index bbcf697de7605469c76fa320dee75a645e2c7af9..f535878d52edce9145bdc79655cb9e030ff45fd2 100644 --- a/Graphics/Makefile +++ b/Graphics/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.90 2006-08-10 15:29:25 geuzaine Exp $ +# $Id: Makefile,v 1.91 2006-08-12 16:16:30 geuzaine Exp $ # # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle # @@ -107,7 +107,7 @@ Mesh.o: Mesh.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \ ../Geo/SBoundingBox3d.h Draw.h ../Common/Views.h ../Common/ColorTable.h \ ../Common/VertexArray.h ../Common/SmoothNormals.h \ ../Common/GmshMatrix.h ../Common/AdaptiveViews.h ../Common/GmshMatrix.h \ - ../Common/Context.h gl2ps.h + ../Common/Context.h ../Common/OS.h gl2ps.h tc.h # 1 "/Users/geuzaine/.gmsh/Graphics//" Geom.o: Geom.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \ ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \ @@ -242,3 +242,5 @@ gl2yuv.o: gl2yuv.cpp gl2yuv.h PixelBuffer.h ../Common/Gmsh.h \ ../Common/ColorTable.h ../Common/VertexArray.h \ ../Common/SmoothNormals.h ../Numeric/Numeric.h ../Common/GmshMatrix.h \ ../Common/AdaptiveViews.h ../Common/GmshMatrix.h +# 1 "/Users/geuzaine/.gmsh/Graphics//" +tc.o: tc.cpp tc.h diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp index a81321bfa82648022c6905cd66eb8765bbf0fe3b..1c35f78eed9044c143fa4625ab19cb234d826642 100644 --- a/Graphics/Mesh.cpp +++ b/Graphics/Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: Mesh.cpp,v 1.157 2006-08-10 15:29:26 geuzaine Exp $ +// $Id: Mesh.cpp,v 1.158 2006-08-12 16:16:30 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -69,7 +69,7 @@ class drawMeshGFace public : void operator () (GFace *s) { - if(!(s->drawAttributes.Visible & VIS_MESH)) + if(!s->getVisibility()) return; if(CTX.render_mode == GMSH_SELECT) { @@ -168,7 +168,7 @@ public : #endif unsigned int col; - if(s->drawAttributes.Frozen > 0){ + if(s->getFlag() > 0){ col = CTX.color.geom.surface_sel; } else if(CTX.mesh.color_carousel == 1){ diff --git a/Mesh/Create.cpp b/Mesh/Create.cpp index 9945360339836b9aad6cad8c9ce0e3d319c0c151..a8b124913898e2076dea0ab191d98da681716da0 100644 --- a/Mesh/Create.cpp +++ b/Mesh/Create.cpp @@ -1,4 +1,4 @@ -// $Id: Create.cpp,v 1.82 2006-02-22 19:39:50 geuzaine Exp $ +// $Id: Create.cpp,v 1.83 2006-08-12 16:16:30 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -185,7 +185,7 @@ PhysicalGroup *Create_PhysicalGroup(int Num, int typ, List_T * intlist) p->Num = Num; THEM->MaxPhysicalNum = IMAX(THEM->MaxPhysicalNum, Num); p->Typ = typ; - p->Visible = VIS_GEOM | VIS_MESH; + p->Visible = 1; for(int i = 0; i < List_Nbr(intlist); i++) { int j; List_Read(intlist, i, &j); @@ -215,7 +215,7 @@ int Add_MeshPartition(int Num, Mesh * M) else{ p = (MeshPartition*)Malloc(sizeof(MeshPartition)); p->Num = Num; - p->Visible = VIS_GEOM | VIS_MESH; + p->Visible = 1; p->Index = List_Nbr(M->Partitions); List_Add(M->Partitions, &p); return p->Index; @@ -527,7 +527,7 @@ Curve *Create_Curve(int Num, int Typ, int Order, List_T * Liste, // pC->bds = 0; pC->LinVertexArray = NULL; pC->Color.type = 0; - pC->Visible = VIS_GEOM | VIS_MESH; + pC->Visible = 1; pC->cp = NULL; pC->Vertices = List_Create(2, 20, sizeof(Vertex *)); pC->Extrude = NULL; @@ -652,7 +652,7 @@ Surface *Create_Surface(int Num, int Typ) Surface *pS = (Surface *) Malloc(sizeof(Surface)); // pS->bds = 0; pS->Color.type = 0; - pS->Visible = VIS_GEOM | VIS_MESH; + pS->Visible = 1; pS->Num = Num; THEM->MaxSurfaceNum = IMAX(THEM->MaxSurfaceNum, Num); pS->Typ = Typ; @@ -714,7 +714,7 @@ Volume *Create_Volume(int Num, int Typ) { Volume *pV = (Volume *) Malloc(sizeof(Volume)); pV->Color.type = 0; - pV->Visible = VIS_GEOM | VIS_MESH; + pV->Visible = 1; pV->Num = Num; THEM->MaxVolumeNum = IMAX(THEM->MaxVolumeNum, Num); pV->Typ = Typ; diff --git a/Mesh/DiscreteSurface.cpp b/Mesh/DiscreteSurface.cpp index 0027eff425d4efbfd29f946e32531b90ad97167c..8b2504678c1da76e1877541c8f2cb8643794ada3 100644 --- a/Mesh/DiscreteSurface.cpp +++ b/Mesh/DiscreteSurface.cpp @@ -1,4 +1,4 @@ -// $Id: DiscreteSurface.cpp,v 1.43 2006-08-10 15:29:26 geuzaine Exp $ +// $Id: DiscreteSurface.cpp,v 1.44 2006-08-12 16:16:30 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -389,27 +389,27 @@ void CreateVolumeWithAllSurfaces(Mesh *M) Tree_Add(M->Volumes, &vol2); } -int ReMesh(Mesh *M) +int ReMesh() { - if(M->status != 2) + if(THEM->status != 2) return 0; - if(!M->bds) { - Mesh_To_BDS(M); - M->bds->classify(CTX.mesh.dihedral_angle_tol * M_PI / 180); - BDS_To_Mesh(M); + if(!THEM->bds) { + Mesh_To_BDS(THEM); + THEM->bds->classify(CTX.mesh.dihedral_angle_tol * M_PI / 180); + BDS_To_Mesh(THEM); } - DeleteMesh(M); + DeleteMesh(THEM); - if(M->bds_mesh) { - delete M->bds_mesh; - M->bds_mesh = 0; + if(THEM->bds_mesh) { + delete THEM->bds_mesh; + THEM->bds_mesh = 0; } MeshDiscreteSurface((Surface *) 0); - CreateVolumeWithAllSurfaces(M); + CreateVolumeWithAllSurfaces(THEM); CTX.mesh.changed = 1; return 1; } diff --git a/Mesh/Element.cpp b/Mesh/Element.cpp index cf3dbc4fffa9a2369db1ed4b8d13e15d63956da4..3319a2af01e1b3a1bd5e33f5cb0e2842f35d323a 100644 --- a/Mesh/Element.cpp +++ b/Mesh/Element.cpp @@ -1,4 +1,4 @@ -// $Id: Element.cpp,v 1.12 2006-08-05 10:05:45 geuzaine Exp $ +// $Id: Element.cpp,v 1.13 2006-08-12 16:16:30 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -32,7 +32,7 @@ extern int edges_pyramid[8][2]; int Element::TotalNumber = 0; Element::Element() - : iEnt(-1), iPart(-1), Visible(VIS_MESH), VSUP(NULL) + : iEnt(-1), iPart(-1), Visible(1), VSUP(NULL) { Num = ++TotalNumber; } diff --git a/Mesh/Makefile b/Mesh/Makefile index f3bbcffe53583f82a5c9248ec75c1ec2726520a3..67a2003bf14c39f6c239aeff438d08f9672ec890 100644 --- a/Mesh/Makefile +++ b/Mesh/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.115 2006-08-08 04:35:23 geuzaine Exp $ +# $Id: Makefile,v 1.116 2006-08-12 16:16:30 geuzaine Exp $ # # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle # @@ -365,17 +365,18 @@ Create.o: Create.cpp ../Common/Gmsh.h ../Common/Message.h \ ../Geo/ExtrudeParams.h Mesh.h Utils.h Vertex.h ../Common/Context.h \ Create.h # 1 "/Users/geuzaine/.gmsh/Mesh//" -Generator.o: Generator.cpp BDS.h ../Common/Views.h ../Common/ColorTable.h \ - ../DataStr/List.h ../Common/VertexArray.h ../Common/SmoothNormals.h \ - ../Numeric/Numeric.h ../Common/GmshMatrix.h ../Common/AdaptiveViews.h \ - ../Common/GmshMatrix.h ../Common/Gmsh.h ../Common/Message.h \ - ../DataStr/Malloc.h ../DataStr/Tree.h ../DataStr/avl.h \ - ../DataStr/Tools.h ../DataStr/List.h ../DataStr/Tree.h Mesh.h Vertex.h \ - Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h \ - ../Common/GmshDefines.h Metric.h Matrix.h Create.h ../Common/Context.h \ - ../Parser/OpenFile.h PartitionMesh.h ../Common/OS.h meshGEdge.h \ - meshGFace.h ../Geo/SPoint2.h ../Geo/GModel.h ../Geo/GVertex.h \ - ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \ +Generator.o: Generator.cpp ../Common/Gmsh.h ../Common/Message.h \ + ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \ + ../DataStr/avl.h ../DataStr/Tools.h ../DataStr/List.h ../DataStr/Tree.h \ + ../Numeric/Numeric.h Mesh.h Vertex.h Element.h Simplex.h Face.h Edge.h \ + ../Geo/ExtrudeParams.h ../Common/VertexArray.h \ + ../Common/SmoothNormals.h ../Common/GmshDefines.h Metric.h Matrix.h \ + BDS.h ../Common/Views.h ../Common/ColorTable.h ../Common/VertexArray.h \ + ../Common/SmoothNormals.h ../Common/GmshMatrix.h \ + ../Common/AdaptiveViews.h ../Common/GmshMatrix.h Create.h \ + ../Common/Context.h ../Parser/OpenFile.h PartitionMesh.h ../Common/OS.h \ + meshGEdge.h meshGFace.h ../Geo/SPoint2.h ../Geo/GModel.h \ + ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \ ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \ ../Geo/MVertex.h ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h \ ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \ diff --git a/Mesh/Mesh.h b/Mesh/Mesh.h index 8d3b9c04269856a3d13b72a839239c0be8c98d77..8d42d8e4636e2e55f04d68dc06cf48df3577536c 100644 --- a/Mesh/Mesh.h +++ b/Mesh/Mesh.h @@ -386,7 +386,7 @@ int MeshParametricSurface(Surface *s); int MeshEllipticSurface(Surface *sur); int MeshDiscreteSurface(Surface *sur); int MeshDiscreteCurve(Curve *c); -int ReMesh(Mesh *M); +int ReMesh(); int AlgorithmeMaillage2DAnisotropeModeJF(Surface *s); void Maillage_Automatique_VieuxCode(Surface *pS, int ori); diff --git a/Mesh/Vertex.cpp b/Mesh/Vertex.cpp index 887638c54f6a72a3db1a36ce875f90301982212f..a5503af868cd0b1ec4cd1c770e7cbe4410366f3a 100644 --- a/Mesh/Vertex.cpp +++ b/Mesh/Vertex.cpp @@ -1,4 +1,4 @@ -// $Id: Vertex.cpp,v 1.29 2006-01-06 00:34:26 geuzaine Exp $ +// $Id: Vertex.cpp,v 1.30 2006-08-12 16:16:30 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -31,7 +31,7 @@ extern Mesh *THEM; Vertex::Vertex() { Frozen = 0; - Visible = VIS_GEOM | VIS_MESH; + Visible = 1; Degree = 1; Pos.X = 0.0; Pos.Y = 0.0; @@ -47,7 +47,7 @@ Vertex::Vertex() Vertex::Vertex(double X, double Y, double Z, double l, double W) { Frozen = 0; - Visible = VIS_GEOM | VIS_MESH; + Visible = 1; Degree = 1; Pos.X = X; Pos.Y = Y; diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp index 39ebf5f1736211a599b5774796540b428f1e7b06..2d66964ad423119af524b5dfed40b5c07e07b771 100644 --- a/Parser/Gmsh.tab.cpp +++ b/Parser/Gmsh.tab.cpp @@ -126,7 +126,7 @@ #line 1 "Gmsh.y" -// $Id: Gmsh.tab.cpp,v 1.271 2006-08-07 19:08:12 geuzaine Exp $ +// $Id: Gmsh.tab.cpp,v 1.272 2006-08-12 16:16:30 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -171,7 +171,6 @@ #include "ColorTable.h" #include "OS.h" #include "CreateFile.h" -#include "Visibility.h" Tree_T *Symbol_T = NULL; @@ -200,7 +199,7 @@ void skip_until(char *skip, char *until); int PrintListOfDouble(char *format, List_T *list, char *buffer); int CheckViewErrorFlags(Post_View *v); -#line 77 "Gmsh.y" +#line 76 "Gmsh.y" typedef union { char *c; int i; @@ -510,40 +509,40 @@ static const short yyrhs[] = { 143, #if YYDEBUG != 0 static const short yyrline[] = { 0, - 142, 144, 149, 151, 154, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 171, 176, - 182, 188, 203, 216, 244, 252, 261, 269, 270, 271, - 272, 273, 274, 277, 280, 284, 287, 291, 482, 500, - 510, 516, 523, 531, 537, 543, 550, 558, 564, 572, - 577, 581, 590, 592, 593, 594, 595, 598, 600, 603, - 638, 677, 731, 748, 766, 777, 796, 810, 827, 853, - 880, 894, 911, 925, 942, 962, 985, 995, 1010, 1030, - 1046, 1065, 1084, 1102, 1120, 1138, 1164, 1182, 1208, 1228, - 1252, 1276, 1302, 1319, 1337, 1356, 1375, 1414, 1439, 1458, - 1477, 1493, 1513, 1530, 1547, 1567, 1573, 1578, 1583, 1590, - 1592, 1593, 1596, 1601, 1605, 1621, 1637, 1653, 1673, 1688, - 1694, 1700, 1711, 1721, 1731, 1745, 1763, 1777, 1786, 1792, - 1803, 1816, 1862, 1877, 1888, 1907, 1917, 1939, 1943, 1948, - 1953, 1963, 1980, 1996, 2022, 2049, 2081, 2088, 2093, 2099, - 2103, 2111, 2120, 2128, 2136, 2141, 2149, 2154, 2162, 2167, - 2177, 2184, 2191, 2198, 2205, 2212, 2219, 2226, 2233, 2240, - 2245, 2252, 2257, 2264, 2269, 2276, 2281, 2288, 2293, 2300, - 2305, 2312, 2317, 2324, 2329, 2336, 2341, 2351, 2355, 2360, - 2387, 2411, 2419, 2438, 2456, 2474, 2503, 2538, 2565, 2592, - 2606, 2624, 2629, 2638, 2640, 2641, 2642, 2643, 2644, 2645, - 2646, 2647, 2654, 2655, 2656, 2657, 2658, 2659, 2660, 2661, - 2662, 2663, 2664, 2665, 2666, 2667, 2668, 2669, 2670, 2671, - 2672, 2673, 2674, 2675, 2676, 2677, 2678, 2679, 2680, 2681, - 2682, 2683, 2684, 2685, 2687, 2688, 2689, 2690, 2691, 2692, - 2693, 2694, 2695, 2696, 2697, 2698, 2699, 2700, 2701, 2702, - 2703, 2704, 2705, 2706, 2707, 2712, 2717, 2718, 2719, 2720, - 2721, 2722, 2726, 2742, 2757, 2777, 2791, 2804, 2827, 2845, - 2863, 2881, 2899, 2906, 2911, 2915, 2919, 2923, 2929, 2934, - 2938, 2942, 2948, 2952, 2956, 2962, 2968, 2975, 2981, 2985, - 2990, 2994, 3005, 3012, 3023, 3043, 3053, 3063, 3073, 3090, - 3109, 3133, 3161, 3167, 3171, 3175, 3187, 3192, 3204, 3211, - 3232, 3237, 3251, 3257, 3263, 3268, 3276, 3284, 3298, 3312, - 3316, 3335, 3357 + 141, 143, 148, 150, 153, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 170, 175, + 181, 187, 202, 215, 243, 251, 260, 268, 269, 270, + 271, 272, 273, 276, 279, 283, 286, 290, 481, 499, + 509, 515, 522, 530, 536, 542, 549, 557, 563, 571, + 576, 580, 589, 591, 592, 593, 594, 597, 599, 602, + 637, 676, 730, 747, 765, 776, 795, 809, 826, 852, + 879, 893, 910, 924, 941, 961, 984, 994, 1009, 1029, + 1045, 1064, 1083, 1101, 1119, 1137, 1163, 1181, 1207, 1227, + 1251, 1275, 1301, 1318, 1336, 1355, 1374, 1413, 1438, 1457, + 1476, 1492, 1512, 1529, 1546, 1566, 1572, 1577, 1582, 1589, + 1591, 1592, 1595, 1600, 1604, 1620, 1636, 1652, 1672, 1687, + 1693, 1699, 1710, 1720, 1730, 1744, 1762, 1776, 1783, 1789, + 1798, 1811, 1857, 1872, 1883, 1902, 1912, 1934, 1938, 1943, + 1948, 1958, 1975, 1991, 2017, 2044, 2076, 2083, 2088, 2094, + 2098, 2106, 2115, 2123, 2131, 2136, 2144, 2149, 2157, 2162, + 2172, 2179, 2186, 2193, 2200, 2207, 2214, 2221, 2228, 2235, + 2240, 2247, 2252, 2259, 2264, 2271, 2276, 2283, 2288, 2295, + 2300, 2307, 2312, 2319, 2324, 2331, 2336, 2346, 2350, 2355, + 2382, 2406, 2414, 2433, 2451, 2469, 2498, 2533, 2560, 2587, + 2601, 2619, 2624, 2633, 2635, 2636, 2637, 2638, 2639, 2640, + 2641, 2642, 2649, 2650, 2651, 2652, 2653, 2654, 2655, 2656, + 2657, 2658, 2659, 2660, 2661, 2662, 2663, 2664, 2665, 2666, + 2667, 2668, 2669, 2670, 2671, 2672, 2673, 2674, 2675, 2676, + 2677, 2678, 2679, 2680, 2682, 2683, 2684, 2685, 2686, 2687, + 2688, 2689, 2690, 2691, 2692, 2693, 2694, 2695, 2696, 2697, + 2698, 2699, 2700, 2701, 2702, 2707, 2712, 2713, 2714, 2715, + 2716, 2717, 2721, 2737, 2752, 2772, 2786, 2799, 2822, 2840, + 2858, 2876, 2894, 2901, 2906, 2910, 2914, 2918, 2924, 2929, + 2933, 2937, 2943, 2947, 2951, 2957, 2963, 2970, 2976, 2980, + 2985, 2989, 3000, 3007, 3018, 3038, 3048, 3058, 3068, 3085, + 3104, 3128, 3156, 3162, 3166, 3170, 3182, 3187, 3199, 3206, + 3227, 3232, 3246, 3252, 3258, 3263, 3271, 3279, 3293, 3307, + 3311, 3330, 3352 }; #endif @@ -2706,86 +2705,86 @@ yyreduce: switch (yyn) { case 2: -#line 144 "Gmsh.y" +#line 143 "Gmsh.y" { yyerrok; return 1; ; break;} case 5: -#line 155 "Gmsh.y" +#line 154 "Gmsh.y" { return 1; ; break;} case 6: -#line 156 "Gmsh.y" +#line 155 "Gmsh.y" { return 1; ; break;} case 7: -#line 157 "Gmsh.y" +#line 156 "Gmsh.y" { return 1; ; break;} case 8: -#line 158 "Gmsh.y" +#line 157 "Gmsh.y" { return 1; ; break;} case 9: -#line 159 "Gmsh.y" +#line 158 "Gmsh.y" { List_Delete(yyvsp[0].l); return 1; ; break;} case 10: -#line 160 "Gmsh.y" +#line 159 "Gmsh.y" { List_Delete(yyvsp[0].l); return 1; ; break;} case 11: -#line 161 "Gmsh.y" +#line 160 "Gmsh.y" { return 1; ; break;} case 12: -#line 162 "Gmsh.y" +#line 161 "Gmsh.y" { return 1; ; break;} case 13: -#line 163 "Gmsh.y" +#line 162 "Gmsh.y" { return 1; ; break;} case 14: -#line 164 "Gmsh.y" +#line 163 "Gmsh.y" { List_Delete(yyvsp[0].l); return 1; ; break;} case 15: -#line 165 "Gmsh.y" +#line 164 "Gmsh.y" { return 1; ; break;} case 16: -#line 166 "Gmsh.y" +#line 165 "Gmsh.y" { return 1; ; break;} case 17: -#line 167 "Gmsh.y" +#line 166 "Gmsh.y" { return 1; ; break;} case 18: -#line 168 "Gmsh.y" +#line 167 "Gmsh.y" { return 1; ; break;} case 19: -#line 173 "Gmsh.y" +#line 172 "Gmsh.y" { yyval.c = "w"; ; break;} case 20: -#line 177 "Gmsh.y" +#line 176 "Gmsh.y" { yyval.c = "a"; ; break;} case 21: -#line 184 "Gmsh.y" +#line 183 "Gmsh.y" { Msg(DIRECT, yyvsp[-2].c); Free(yyvsp[-2].c); ; break;} case 22: -#line 189 "Gmsh.y" +#line 188 "Gmsh.y" { char tmpstring[1024]; FixRelativePath(yyvsp[-1].c, tmpstring); @@ -2802,7 +2801,7 @@ case 22: ; break;} case 23: -#line 204 "Gmsh.y" +#line 203 "Gmsh.y" { char tmpstring[1024]; int i = PrintListOfDouble(yyvsp[-4].c, yyvsp[-2].l, tmpstring); @@ -2817,7 +2816,7 @@ case 23: ; break;} case 24: -#line 217 "Gmsh.y" +#line 216 "Gmsh.y" { char tmpstring[1024]; int i = PrintListOfDouble(yyvsp[-6].c, yyvsp[-4].l, tmpstring); @@ -2843,7 +2842,7 @@ case 24: ; break;} case 25: -#line 246 "Gmsh.y" +#line 245 "Gmsh.y" { if(!strcmp(yyvsp[-5].c, "View") && !CheckViewErrorFlags(View)){ EndView(View, 0, yyname, yyvsp[-4].c); @@ -2852,7 +2851,7 @@ case 25: ; break;} case 26: -#line 253 "Gmsh.y" +#line 252 "Gmsh.y" { if(!strcmp(yyvsp[-7].c, "View") && !CheckViewErrorFlags(View)){ EndView(View, 0, yyname, yyvsp[-6].c); @@ -2861,7 +2860,7 @@ case 26: ; break;} case 27: -#line 263 "Gmsh.y" +#line 262 "Gmsh.y" { View = BeginView(1); for(int i = 0; i < VIEW_NB_ELEMENT_TYPES; i++){ @@ -2870,23 +2869,23 @@ case 27: ; break;} case 34: -#line 279 "Gmsh.y" +#line 278 "Gmsh.y" { ViewCoord[ViewCoordIdx] = yyvsp[0].d; ViewCoordIdx++; ; break;} case 35: -#line 281 "Gmsh.y" +#line 280 "Gmsh.y" { ViewCoord[ViewCoordIdx] = yyvsp[0].d; ViewCoordIdx++; ; break;} case 36: -#line 286 "Gmsh.y" +#line 285 "Gmsh.y" { if(ViewValueList) List_Add(ViewValueList, &yyvsp[0].d); ; break;} case 37: -#line 288 "Gmsh.y" +#line 287 "Gmsh.y" { if(ViewValueList) List_Add(ViewValueList, &yyvsp[0].d); ; break;} case 38: -#line 293 "Gmsh.y" +#line 292 "Gmsh.y" { if(!strcmp(yyvsp[0].c, "SP")){ ViewElementIdx = 0; ViewNumNodes = 1; ViewNumComp = 1; @@ -3078,7 +3077,7 @@ case 38: ; break;} case 39: -#line 483 "Gmsh.y" +#line 482 "Gmsh.y" { if(ViewValueList){ if(ViewCoordIdx != 3 * ViewNumNodes){ @@ -3098,7 +3097,7 @@ case 39: ; break;} case 40: -#line 501 "Gmsh.y" +#line 500 "Gmsh.y" { if(ViewValueList){ if((List_Nbr(ViewValueList) - ViewNumListTmp) % (ViewNumComp * ViewNumNodes)) @@ -3108,21 +3107,21 @@ case 40: ; break;} case 41: -#line 512 "Gmsh.y" +#line 511 "Gmsh.y" { for(int i = 0; i < (int)strlen(yyvsp[0].c)+1; i++) List_Add(View->T2C, &yyvsp[0].c[i]); Free(yyvsp[0].c); ; break;} case 42: -#line 517 "Gmsh.y" +#line 516 "Gmsh.y" { for(int i = 0; i < (int)strlen(yyvsp[0].c)+1; i++) List_Add(View->T2C, &yyvsp[0].c[i]); Free(yyvsp[0].c); ; break;} case 43: -#line 525 "Gmsh.y" +#line 524 "Gmsh.y" { List_Add(View->T2D, &yyvsp[-5].d); List_Add(View->T2D, &yyvsp[-3].d); List_Add(View->T2D, &yyvsp[-1].d); @@ -3131,27 +3130,27 @@ case 43: ; break;} case 44: -#line 532 "Gmsh.y" +#line 531 "Gmsh.y" { View->NbT2++; ; break;} case 45: -#line 539 "Gmsh.y" +#line 538 "Gmsh.y" { for(int i = 0; i < (int)strlen(yyvsp[0].c)+1; i++) List_Add(View->T3C, &yyvsp[0].c[i]); Free(yyvsp[0].c); ; break;} case 46: -#line 544 "Gmsh.y" +#line 543 "Gmsh.y" { for(int i = 0; i < (int)strlen(yyvsp[0].c)+1; i++) List_Add(View->T3C, &yyvsp[0].c[i]); Free(yyvsp[0].c); ; break;} case 47: -#line 552 "Gmsh.y" +#line 551 "Gmsh.y" { List_Add(View->T3D, &yyvsp[-7].d); List_Add(View->T3D, &yyvsp[-5].d); List_Add(View->T3D, &yyvsp[-3].d); List_Add(View->T3D, &yyvsp[-1].d); @@ -3160,64 +3159,64 @@ case 47: ; break;} case 48: -#line 559 "Gmsh.y" +#line 558 "Gmsh.y" { View->NbT3++; ; break;} case 49: -#line 567 "Gmsh.y" +#line 566 "Gmsh.y" { View->adaptive = new Adaptive_Post_View(View, yyvsp[-5].l, yyvsp[-2].l); ; break;} case 50: -#line 574 "Gmsh.y" +#line 573 "Gmsh.y" { ViewValueList = View->Time; ; break;} case 51: -#line 578 "Gmsh.y" +#line 577 "Gmsh.y" { ; break;} case 52: -#line 583 "Gmsh.y" +#line 582 "Gmsh.y" { (*View->Grains) [(int)yyvsp[-3].d] = yyvsp[-1].l; ; break;} case 53: -#line 591 "Gmsh.y" +#line 590 "Gmsh.y" { yyval.i = 0; ; break;} case 54: -#line 592 "Gmsh.y" +#line 591 "Gmsh.y" { yyval.i = 1; ; break;} case 55: -#line 593 "Gmsh.y" +#line 592 "Gmsh.y" { yyval.i = 2; ; break;} case 56: -#line 594 "Gmsh.y" +#line 593 "Gmsh.y" { yyval.i = 3; ; break;} case 57: -#line 595 "Gmsh.y" +#line 594 "Gmsh.y" { yyval.i = 4; ; break;} case 58: -#line 599 "Gmsh.y" +#line 598 "Gmsh.y" { yyval.i = 1; ; break;} case 59: -#line 600 "Gmsh.y" +#line 599 "Gmsh.y" { yyval.i = -1; ; break;} case 60: -#line 608 "Gmsh.y" +#line 607 "Gmsh.y" { Symbol TheSymbol; TheSymbol.Name = yyvsp[-3].c; @@ -3250,7 +3249,7 @@ case 60: ; break;} case 61: -#line 639 "Gmsh.y" +#line 638 "Gmsh.y" { Symbol TheSymbol; TheSymbol.Name = yyvsp[-6].c; @@ -3291,7 +3290,7 @@ case 61: ; break;} case 62: -#line 678 "Gmsh.y" +#line 677 "Gmsh.y" { if(List_Nbr(yyvsp[-5].l) != List_Nbr(yyvsp[-1].l)){ yymsg(GERROR, "Incompatible array dimensions in affectation"); @@ -3347,7 +3346,7 @@ case 62: ; break;} case 63: -#line 732 "Gmsh.y" +#line 731 "Gmsh.y" { Symbol TheSymbol; TheSymbol.Name = yyvsp[-5].c; @@ -3366,7 +3365,7 @@ case 63: ; break;} case 64: -#line 749 "Gmsh.y" +#line 748 "Gmsh.y" { // appends to the list Symbol TheSymbol; @@ -3386,7 +3385,7 @@ case 64: ; break;} case 65: -#line 767 "Gmsh.y" +#line 766 "Gmsh.y" { Symbol TheSymbol; TheSymbol.Name = yyvsp[-2].c; @@ -3399,7 +3398,7 @@ case 65: ; break;} case 66: -#line 778 "Gmsh.y" +#line 777 "Gmsh.y" { Symbol TheSymbol; TheSymbol.Name = yyvsp[-5].c; @@ -3417,7 +3416,7 @@ case 66: ; break;} case 67: -#line 797 "Gmsh.y" +#line 796 "Gmsh.y" { char* (*pStrOpt)(int num, int action, char *value); StringXString *pStrCat; @@ -3433,7 +3432,7 @@ case 67: ; break;} case 68: -#line 811 "Gmsh.y" +#line 810 "Gmsh.y" { char* (*pStrOpt)(int num, int action, char *value); StringXString *pStrCat; @@ -3449,7 +3448,7 @@ case 68: ; break;} case 69: -#line 828 "Gmsh.y" +#line 827 "Gmsh.y" { double (*pNumOpt)(int num, int action, double value); StringXNumber *pNumCat; @@ -3477,7 +3476,7 @@ case 69: ; break;} case 70: -#line 854 "Gmsh.y" +#line 853 "Gmsh.y" { double (*pNumOpt)(int num, int action, double value); StringXNumber *pNumCat; @@ -3506,7 +3505,7 @@ case 70: ; break;} case 71: -#line 881 "Gmsh.y" +#line 880 "Gmsh.y" { double (*pNumOpt)(int num, int action, double value); StringXNumber *pNumCat; @@ -3522,7 +3521,7 @@ case 71: ; break;} case 72: -#line 895 "Gmsh.y" +#line 894 "Gmsh.y" { double (*pNumOpt)(int num, int action, double value); StringXNumber *pNumCat; @@ -3538,7 +3537,7 @@ case 72: ; break;} case 73: -#line 912 "Gmsh.y" +#line 911 "Gmsh.y" { unsigned int (*pColOpt)(int num, int action, unsigned int value); StringXColor *pColCat; @@ -3554,7 +3553,7 @@ case 73: ; break;} case 74: -#line 926 "Gmsh.y" +#line 925 "Gmsh.y" { unsigned int (*pColOpt)(int num, int action, unsigned int value); StringXColor *pColCat; @@ -3570,7 +3569,7 @@ case 74: ; break;} case 75: -#line 943 "Gmsh.y" +#line 942 "Gmsh.y" { GmshColorTable *ct = Get_ColorTable(0); if(!ct) @@ -3592,7 +3591,7 @@ case 75: ; break;} case 76: -#line 963 "Gmsh.y" +#line 962 "Gmsh.y" { GmshColorTable *ct = Get_ColorTable((int)yyvsp[-6].d); if(!ct) @@ -3614,7 +3613,7 @@ case 76: ; break;} case 77: -#line 986 "Gmsh.y" +#line 985 "Gmsh.y" { try { GMSH_PluginManager::instance()->setPluginOption(yyvsp[-6].c, yyvsp[-3].c, yyvsp[-1].d); @@ -3626,7 +3625,7 @@ case 77: ; break;} case 78: -#line 996 "Gmsh.y" +#line 995 "Gmsh.y" { try { GMSH_PluginManager::instance()->setPluginOption(yyvsp[-6].c, yyvsp[-3].c, yyvsp[-1].c); @@ -3638,7 +3637,7 @@ case 78: ; break;} case 79: -#line 1015 "Gmsh.y" +#line 1014 "Gmsh.y" { int num = (int)yyvsp[-4].d; if(FindPoint(num, THEM)){ @@ -3656,7 +3655,7 @@ case 79: ; break;} case 80: -#line 1031 "Gmsh.y" +#line 1030 "Gmsh.y" { int num = (int)yyvsp[-4].d; if(FindPhysicalGroup(num, MSH_PHYSICAL_POINT, THEM)){ @@ -3674,7 +3673,7 @@ case 80: ; break;} case 81: -#line 1047 "Gmsh.y" +#line 1046 "Gmsh.y" { for(int i = 0; i < List_Nbr(yyvsp[-9].l); i++){ double p; @@ -3695,7 +3694,7 @@ case 81: ; break;} case 82: -#line 1066 "Gmsh.y" +#line 1065 "Gmsh.y" { for(int i = 0; i < List_Nbr(yyvsp[-3].l); i++){ double d; @@ -3713,7 +3712,7 @@ case 82: ; break;} case 83: -#line 1085 "Gmsh.y" +#line 1084 "Gmsh.y" { int num = (int)yyvsp[-4].d; if(FindCurve(num, THEM)){ @@ -3733,7 +3732,7 @@ case 83: ; break;} case 84: -#line 1103 "Gmsh.y" +#line 1102 "Gmsh.y" { int num = (int)yyvsp[-4].d; if(FindCurve(num, THEM)){ @@ -3753,7 +3752,7 @@ case 84: ; break;} case 85: -#line 1121 "Gmsh.y" +#line 1120 "Gmsh.y" { int num = (int)yyvsp[-4].d; if(FindCurve(num, THEM)){ @@ -3773,7 +3772,7 @@ case 85: ; break;} case 86: -#line 1139 "Gmsh.y" +#line 1138 "Gmsh.y" { int num = (int)yyvsp[-6].d; if(FindCurve(num, THEM)){ @@ -3801,7 +3800,7 @@ case 86: ; break;} case 87: -#line 1165 "Gmsh.y" +#line 1164 "Gmsh.y" { int num = (int)yyvsp[-4].d; if(FindCurve(num, THEM)){ @@ -3821,7 +3820,7 @@ case 87: ; break;} case 88: -#line 1183 "Gmsh.y" +#line 1182 "Gmsh.y" { int num = (int)yyvsp[-6].d; if(FindCurve(num, THEM)){ @@ -3849,7 +3848,7 @@ case 88: ; break;} case 89: -#line 1210 "Gmsh.y" +#line 1209 "Gmsh.y" { int num = (int)yyvsp[-14].d; if(FindCurve(num, THEM)){ @@ -3870,7 +3869,7 @@ case 89: ; break;} case 90: -#line 1229 "Gmsh.y" +#line 1228 "Gmsh.y" { int num = (int)yyvsp[-4].d; if(List_Nbr(yyvsp[-1].l) < 4){ @@ -3896,7 +3895,7 @@ case 90: ; break;} case 91: -#line 1253 "Gmsh.y" +#line 1252 "Gmsh.y" { int num = (int)yyvsp[-4].d; if(List_Nbr(yyvsp[-1].l) < 4){ @@ -3922,7 +3921,7 @@ case 91: ; break;} case 92: -#line 1277 "Gmsh.y" +#line 1276 "Gmsh.y" { int num = (int)yyvsp[-8].d; if(List_Nbr(yyvsp[-5].l) + (int)yyvsp[-1].d + 1 != List_Nbr(yyvsp[-3].l)){ @@ -3950,7 +3949,7 @@ case 92: ; break;} case 93: -#line 1303 "Gmsh.y" +#line 1302 "Gmsh.y" { int num = (int)yyvsp[-4].d; if(FindEdgeLoop(num, THEM)){ @@ -3969,7 +3968,7 @@ case 93: ; break;} case 94: -#line 1320 "Gmsh.y" +#line 1319 "Gmsh.y" { for(int i = 0; i < List_Nbr(yyvsp[-9].l); i++){ double p; @@ -3989,7 +3988,7 @@ case 94: ; break;} case 95: -#line 1338 "Gmsh.y" +#line 1337 "Gmsh.y" { int num = (int)yyvsp[-4].d; if(FindPhysicalGroup(num, MSH_PHYSICAL_LINE, THEM)){ @@ -4007,7 +4006,7 @@ case 95: ; break;} case 96: -#line 1357 "Gmsh.y" +#line 1356 "Gmsh.y" { int num = (int)yyvsp[-4].d; if(FindSurface(num, THEM)){ @@ -4028,7 +4027,7 @@ case 96: ; break;} case 97: -#line 1376 "Gmsh.y" +#line 1375 "Gmsh.y" { int num = (int)yyvsp[-4].d, type = 0; if(FindSurface(num, THEM)){ @@ -4069,7 +4068,7 @@ case 97: ; break;} case 98: -#line 1415 "Gmsh.y" +#line 1414 "Gmsh.y" { int num = (int)yyvsp[-8].d; Surface *support = FindSurface((int)yyvsp[-4].d, THEM); @@ -4096,7 +4095,7 @@ case 98: ; break;} case 99: -#line 1442 "Gmsh.y" +#line 1441 "Gmsh.y" { int num = (int)yyvsp[-16].d; if(FindSurface(num, THEM)){ @@ -4115,7 +4114,7 @@ case 99: ; break;} case 100: -#line 1461 "Gmsh.y" +#line 1460 "Gmsh.y" { int num = (int)yyvsp[-16].d; if(FindSurface(num, THEM)){ @@ -4134,7 +4133,7 @@ case 100: ; break;} case 101: -#line 1478 "Gmsh.y" +#line 1477 "Gmsh.y" { int num = (int)yyvsp[-4].d; if(FindSurfaceLoop(num, THEM)){ @@ -4152,7 +4151,7 @@ case 101: ; break;} case 102: -#line 1494 "Gmsh.y" +#line 1493 "Gmsh.y" { int num = (int)yyvsp[-4].d; if(FindPhysicalGroup(num, MSH_PHYSICAL_SURFACE, THEM)){ @@ -4170,7 +4169,7 @@ case 102: ; break;} case 103: -#line 1514 "Gmsh.y" +#line 1513 "Gmsh.y" { int num = (int)yyvsp[-4].d; if(FindVolume(num, THEM)){ @@ -4189,7 +4188,7 @@ case 103: ; break;} case 104: -#line 1531 "Gmsh.y" +#line 1530 "Gmsh.y" { int num = (int)yyvsp[-4].d; if(FindVolume(num, THEM)){ @@ -4208,7 +4207,7 @@ case 104: ; break;} case 105: -#line 1548 "Gmsh.y" +#line 1547 "Gmsh.y" { int num = (int)yyvsp[-4].d; if(FindPhysicalGroup(num, MSH_PHYSICAL_VOLUME, THEM)){ @@ -4226,59 +4225,59 @@ case 105: ; break;} case 106: -#line 1569 "Gmsh.y" +#line 1568 "Gmsh.y" { TranslateShapes(yyvsp[-3].v[0], yyvsp[-3].v[1], yyvsp[-3].v[2], yyvsp[-1].l, 1); yyval.l = yyvsp[-1].l; ; break;} case 107: -#line 1574 "Gmsh.y" +#line 1573 "Gmsh.y" { RotateShapes(yyvsp[-8].v[0], yyvsp[-8].v[1], yyvsp[-8].v[2], yyvsp[-6].v[0], yyvsp[-6].v[1], yyvsp[-6].v[2], yyvsp[-4].d, yyvsp[-1].l, 1); yyval.l = yyvsp[-1].l; ; break;} case 108: -#line 1579 "Gmsh.y" +#line 1578 "Gmsh.y" { SymmetryShapes(yyvsp[-3].v[0], yyvsp[-3].v[1], yyvsp[-3].v[2], yyvsp[-3].v[3], yyvsp[-1].l, 1); yyval.l = yyvsp[-1].l; ; break;} case 109: -#line 1584 "Gmsh.y" +#line 1583 "Gmsh.y" { DilatShapes(yyvsp[-6].v[0], yyvsp[-6].v[1], yyvsp[-6].v[2], yyvsp[-4].d, yyvsp[-1].l, 1); yyval.l = yyvsp[-1].l; ; break;} case 110: -#line 1591 "Gmsh.y" +#line 1590 "Gmsh.y" { yyval.l = yyvsp[0].l; ; break;} case 111: -#line 1592 "Gmsh.y" +#line 1591 "Gmsh.y" { yyval.l = yyvsp[0].l; ; break;} case 112: -#line 1593 "Gmsh.y" +#line 1592 "Gmsh.y" { yyval.l = yyvsp[0].l; ; break;} case 113: -#line 1598 "Gmsh.y" +#line 1597 "Gmsh.y" { yyval.l = List_Create(3, 3, sizeof(Shape)); ; break;} case 114: -#line 1602 "Gmsh.y" +#line 1601 "Gmsh.y" { List_Add(yyval.l, &yyvsp[0].s); ; break;} case 115: -#line 1606 "Gmsh.y" +#line 1605 "Gmsh.y" { for(int i = 0; i < List_Nbr(yyvsp[-2].l); i++){ double d; @@ -4296,7 +4295,7 @@ case 115: ; break;} case 116: -#line 1622 "Gmsh.y" +#line 1621 "Gmsh.y" { for(int i = 0; i < List_Nbr(yyvsp[-2].l); i++){ double d; @@ -4314,7 +4313,7 @@ case 116: ; break;} case 117: -#line 1638 "Gmsh.y" +#line 1637 "Gmsh.y" { for(int i = 0; i < List_Nbr(yyvsp[-2].l); i++){ double d; @@ -4332,7 +4331,7 @@ case 117: ; break;} case 118: -#line 1654 "Gmsh.y" +#line 1653 "Gmsh.y" { for(int i = 0; i < List_Nbr(yyvsp[-2].l); i++){ double d; @@ -4350,7 +4349,7 @@ case 118: ; break;} case 119: -#line 1675 "Gmsh.y" +#line 1674 "Gmsh.y" { yyval.l = List_Create(3, 3, sizeof(Shape)); for(int i = 0; i < List_Nbr(yyvsp[-1].l); i++){ @@ -4365,7 +4364,7 @@ case 119: ; break;} case 120: -#line 1689 "Gmsh.y" +#line 1688 "Gmsh.y" { if(!strcmp(yyvsp[-4].c, "View")) AliasView((int)yyvsp[-2].d, 0); Free(yyvsp[-4].c); @@ -4373,7 +4372,7 @@ case 120: ; break;} case 121: -#line 1695 "Gmsh.y" +#line 1694 "Gmsh.y" { if(!strcmp(yyvsp[-4].c, "View")) AliasView((int)yyvsp[-2].d, 0); Free(yyvsp[-4].c); @@ -4381,7 +4380,7 @@ case 121: ; break;} case 122: -#line 1701 "Gmsh.y" +#line 1700 "Gmsh.y" { if(!strcmp(yyvsp[-4].c, "View")) AliasView((int)yyvsp[-2].d, 1); Free(yyvsp[-4].c); @@ -4389,7 +4388,7 @@ case 122: ; break;} case 123: -#line 1713 "Gmsh.y" +#line 1712 "Gmsh.y" { for(int i = 0; i < List_Nbr(yyvsp[-1].l); i++){ Shape TheShape; @@ -4400,7 +4399,7 @@ case 123: ; break;} case 124: -#line 1722 "Gmsh.y" +#line 1721 "Gmsh.y" { if(!strcmp(yyvsp[-4].c, "View")){ RemoveViewByIndex((int)yyvsp[-2].d); @@ -4412,7 +4411,7 @@ case 124: ; break;} case 125: -#line 1732 "Gmsh.y" +#line 1731 "Gmsh.y" { if(!strcmp(yyvsp[-1].c, "Meshes") || !strcmp(yyvsp[-1].c, "All")){ Init_Mesh(); @@ -4428,7 +4427,7 @@ case 125: ; break;} case 126: -#line 1746 "Gmsh.y" +#line 1745 "Gmsh.y" { if(!strcmp(yyvsp[-2].c, "Empty") && !strcmp(yyvsp[-1].c, "Views")){ for(int i = List_Nbr(CTX.post.list) - 1; i >= 0; i--){ @@ -4444,7 +4443,7 @@ case 126: ; break;} case 127: -#line 1765 "Gmsh.y" +#line 1764 "Gmsh.y" { for(int i = 0; i < List_Nbr(yyvsp[-1].l); i++){ Shape TheShape; @@ -4455,38 +4454,34 @@ case 127: ; break;} case 128: -#line 1779 "Gmsh.y" +#line 1778 "Gmsh.y" { - int m = (CTX.visibility_mode == 2) ? VIS_MESH : - ((CTX.visibility_mode == 1) ? VIS_GEOM : VIS_GEOM|VIS_MESH); - for(int i = 2; i < 6; i++) - SetVisibilityByNumber(yyvsp[-1].c, i, m); + for(int i = 0; i < 4; i++) + VisibilityShape(yyvsp[-1].c, i, 1); Free(yyvsp[-1].c); ; break;} case 129: -#line 1787 "Gmsh.y" +#line 1784 "Gmsh.y" { - for(int i = 2; i < 6; i++) - SetVisibilityByNumber(yyvsp[-1].c, i, 0); + for(int i = 0; i < 4; i++) + VisibilityShape(yyvsp[-1].c, i, 0); Free(yyvsp[-1].c); ; break;} case 130: -#line 1793 "Gmsh.y" +#line 1790 "Gmsh.y" { - int m = (CTX.visibility_mode == 2) ? VIS_MESH : - ((CTX.visibility_mode == 1) ? VIS_GEOM : VIS_GEOM|VIS_MESH); for(int i = 0; i < List_Nbr(yyvsp[-1].l); i++){ Shape TheShape; List_Read(yyvsp[-1].l, i, &TheShape); - VisibilityShape(TheShape.Type, TheShape.Num, m); + VisibilityShape(TheShape.Type, TheShape.Num, 1); } List_Delete(yyvsp[-1].l); ; break;} case 131: -#line 1804 "Gmsh.y" +#line 1799 "Gmsh.y" { for(int i = 0; i < List_Nbr(yyvsp[-1].l); i++){ Shape TheShape; @@ -4497,7 +4492,7 @@ case 131: ; break;} case 132: -#line 1818 "Gmsh.y" +#line 1813 "Gmsh.y" { if(!strcmp(yyvsp[-2].c, "Include")){ char tmpstring[1024]; @@ -4544,7 +4539,7 @@ case 132: ; break;} case 133: -#line 1863 "Gmsh.y" +#line 1858 "Gmsh.y" { if(!strcmp(yyvsp[-6].c, "Save") && !strcmp(yyvsp[-5].c, "View")){ Post_View **vv = (Post_View **)List_Pointer_Test(CTX.post.list, (int)yyvsp[-3].d); @@ -4561,7 +4556,7 @@ case 133: ; break;} case 134: -#line 1878 "Gmsh.y" +#line 1873 "Gmsh.y" { if(!strcmp(yyvsp[-6].c, "Background") && !strcmp(yyvsp[-5].c, "Mesh") && !strcmp(yyvsp[-4].c, "View")){ Post_View **vv = (Post_View **)List_Pointer_Test(CTX.post.list, (int)yyvsp[-2].d); @@ -4574,13 +4569,13 @@ case 134: ; break;} case 135: -#line 1889 "Gmsh.y" +#line 1884 "Gmsh.y" { if(!strcmp(yyvsp[-2].c, "Sleep")){ SleepInSeconds(yyvsp[-1].d); } else if(!strcmp(yyvsp[-2].c, "Remesh")){ - ReMesh(THEM); + ReMesh(); } else if(!strcmp(yyvsp[-2].c, "Mesh")){ yymsg(GERROR, "Mesh directives are not (yet) allowed in scripts"); @@ -4595,7 +4590,7 @@ case 135: ; break;} case 136: -#line 1908 "Gmsh.y" +#line 1903 "Gmsh.y" { try { GMSH_PluginManager::instance()->action(yyvsp[-4].c, yyvsp[-1].c, 0); @@ -4607,7 +4602,7 @@ case 136: ; break;} case 137: -#line 1918 "Gmsh.y" +#line 1913 "Gmsh.y" { if(!strcmp(yyvsp[-1].c, "ElementsFromAllViews")) CombineViews(0, 1, CTX.post.combine_remove_orig); @@ -4631,27 +4626,27 @@ case 137: ; break;} case 138: -#line 1940 "Gmsh.y" +#line 1935 "Gmsh.y" { exit(0); ; break;} case 139: -#line 1944 "Gmsh.y" +#line 1939 "Gmsh.y" { CTX.forced_bbox = 0; SetBoundingBox(); ; break;} case 140: -#line 1949 "Gmsh.y" +#line 1944 "Gmsh.y" { CTX.forced_bbox = 1; SetBoundingBox(yyvsp[-12].d, yyvsp[-10].d, yyvsp[-8].d, yyvsp[-6].d, yyvsp[-4].d, yyvsp[-2].d); ; break;} case 141: -#line 1954 "Gmsh.y" +#line 1949 "Gmsh.y" { #if defined(HAVE_FLTK) Draw(); @@ -4659,7 +4654,7 @@ case 141: ; break;} case 142: -#line 1966 "Gmsh.y" +#line 1961 "Gmsh.y" { LoopControlVariablesTab[ImbricatedLoop][0] = yyvsp[-3].d; LoopControlVariablesTab[ImbricatedLoop][1] = yyvsp[-1].d; @@ -4676,7 +4671,7 @@ case 142: ; break;} case 143: -#line 1981 "Gmsh.y" +#line 1976 "Gmsh.y" { LoopControlVariablesTab[ImbricatedLoop][0] = yyvsp[-5].d; LoopControlVariablesTab[ImbricatedLoop][1] = yyvsp[-3].d; @@ -4694,7 +4689,7 @@ case 143: ; break;} case 144: -#line 1997 "Gmsh.y" +#line 1992 "Gmsh.y" { LoopControlVariablesTab[ImbricatedLoop][0] = yyvsp[-3].d; LoopControlVariablesTab[ImbricatedLoop][1] = yyvsp[-1].d; @@ -4722,7 +4717,7 @@ case 144: ; break;} case 145: -#line 2023 "Gmsh.y" +#line 2018 "Gmsh.y" { LoopControlVariablesTab[ImbricatedLoop][0] = yyvsp[-5].d; LoopControlVariablesTab[ImbricatedLoop][1] = yyvsp[-3].d; @@ -4751,7 +4746,7 @@ case 145: ; break;} case 146: -#line 2050 "Gmsh.y" +#line 2045 "Gmsh.y" { if(ImbricatedLoop <= 0){ yymsg(GERROR, "Invalid For/EndFor loop"); @@ -4785,7 +4780,7 @@ case 146: ; break;} case 147: -#line 2082 "Gmsh.y" +#line 2077 "Gmsh.y" { if(!FunctionManager::Instance()->createFunction(yyvsp[0].c, yyin, yyname, yylineno)) yymsg(GERROR, "Redefinition of function %s", yyvsp[0].c); @@ -4794,14 +4789,14 @@ case 147: ; break;} case 148: -#line 2089 "Gmsh.y" +#line 2084 "Gmsh.y" { if(!FunctionManager::Instance()->leaveFunction(&yyin, yyname, yylineno)) yymsg(GERROR, "Error while exiting function"); ; break;} case 149: -#line 2094 "Gmsh.y" +#line 2089 "Gmsh.y" { if(!FunctionManager::Instance()->enterFunction(yyvsp[-1].c, &yyin, yyname, yylineno)) yymsg(GERROR, "Unknown function %s", yyvsp[-1].c); @@ -4809,18 +4804,18 @@ case 149: ; break;} case 150: -#line 2100 "Gmsh.y" +#line 2095 "Gmsh.y" { if(!yyvsp[-1].d) skip_until("If", "EndIf"); ; break;} case 151: -#line 2104 "Gmsh.y" +#line 2099 "Gmsh.y" { ; break;} case 152: -#line 2113 "Gmsh.y" +#line 2108 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(TRANSLATE, yyvsp[-1].l, @@ -4830,7 +4825,7 @@ case 152: ; break;} case 153: -#line 2121 "Gmsh.y" +#line 2116 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(ROTATE, yyvsp[-1].l, @@ -4840,7 +4835,7 @@ case 153: ; break;} case 154: -#line 2129 "Gmsh.y" +#line 2124 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(TRANSLATE_ROTATE, yyvsp[-1].l, @@ -4850,14 +4845,14 @@ case 154: ; break;} case 155: -#line 2137 "Gmsh.y" +#line 2132 "Gmsh.y" { extr.mesh.ExtrudeMesh = false; extr.mesh.Recombine = false; ; break;} case 156: -#line 2142 "Gmsh.y" +#line 2137 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(TRANSLATE, yyvsp[-3].l, @@ -4867,14 +4862,14 @@ case 156: ; break;} case 157: -#line 2150 "Gmsh.y" +#line 2145 "Gmsh.y" { extr.mesh.ExtrudeMesh = false; extr.mesh.Recombine = false; ; break;} case 158: -#line 2155 "Gmsh.y" +#line 2150 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(ROTATE, yyvsp[-3].l, @@ -4884,14 +4879,14 @@ case 158: ; break;} case 159: -#line 2163 "Gmsh.y" +#line 2158 "Gmsh.y" { extr.mesh.ExtrudeMesh = false; extr.mesh.Recombine = false; ; break;} case 160: -#line 2168 "Gmsh.y" +#line 2163 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(TRANSLATE_ROTATE, yyvsp[-3].l, @@ -4901,7 +4896,7 @@ case 160: ; break;} case 161: -#line 2178 "Gmsh.y" +#line 2173 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_POINT, (int)yyvsp[-4].d, @@ -4910,7 +4905,7 @@ case 161: ; break;} case 162: -#line 2185 "Gmsh.y" +#line 2180 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_SEGM_LINE, (int)yyvsp[-4].d, @@ -4919,7 +4914,7 @@ case 162: ; break;} case 163: -#line 2192 "Gmsh.y" +#line 2187 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_SURF_PLAN, (int)yyvsp[-4].d, @@ -4928,7 +4923,7 @@ case 163: ; break;} case 164: -#line 2199 "Gmsh.y" +#line 2194 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_POINT, (int)yyvsp[-8].d, @@ -4937,7 +4932,7 @@ case 164: ; break;} case 165: -#line 2206 "Gmsh.y" +#line 2201 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_SEGM_LINE, (int)yyvsp[-8].d, @@ -4946,7 +4941,7 @@ case 165: ; break;} case 166: -#line 2213 "Gmsh.y" +#line 2208 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_SURF_PLAN, (int)yyvsp[-8].d, @@ -4955,7 +4950,7 @@ case 166: ; break;} case 167: -#line 2220 "Gmsh.y" +#line 2215 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_POINT, (int)yyvsp[-10].d, @@ -4964,7 +4959,7 @@ case 167: ; break;} case 168: -#line 2227 "Gmsh.y" +#line 2222 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_SEGM_LINE, (int)yyvsp[-10].d, @@ -4973,7 +4968,7 @@ case 168: ; break;} case 169: -#line 2234 "Gmsh.y" +#line 2229 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_SURF_PLAN, (int)yyvsp[-10].d, @@ -4982,14 +4977,14 @@ case 169: ; break;} case 170: -#line 2241 "Gmsh.y" +#line 2236 "Gmsh.y" { extr.mesh.ExtrudeMesh = false; extr.mesh.Recombine = false; ; break;} case 171: -#line 2246 "Gmsh.y" +#line 2241 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_POINT, (int)yyvsp[-8].d, @@ -4998,14 +4993,14 @@ case 171: ; break;} case 172: -#line 2253 "Gmsh.y" +#line 2248 "Gmsh.y" { extr.mesh.ExtrudeMesh = false; extr.mesh.Recombine = false; ; break;} case 173: -#line 2258 "Gmsh.y" +#line 2253 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_SEGM_LINE, (int)yyvsp[-8].d, @@ -5014,14 +5009,14 @@ case 173: ; break;} case 174: -#line 2265 "Gmsh.y" +#line 2260 "Gmsh.y" { extr.mesh.ExtrudeMesh = false; extr.mesh.Recombine = false; ; break;} case 175: -#line 2270 "Gmsh.y" +#line 2265 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_SURF_PLAN, (int)yyvsp[-8].d, @@ -5030,14 +5025,14 @@ case 175: ; break;} case 176: -#line 2277 "Gmsh.y" +#line 2272 "Gmsh.y" { extr.mesh.ExtrudeMesh = false; extr.mesh.Recombine = false; ; break;} case 177: -#line 2282 "Gmsh.y" +#line 2277 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_POINT, (int)yyvsp[-12].d, @@ -5046,14 +5041,14 @@ case 177: ; break;} case 178: -#line 2289 "Gmsh.y" +#line 2284 "Gmsh.y" { extr.mesh.ExtrudeMesh = false; extr.mesh.Recombine = false; ; break;} case 179: -#line 2294 "Gmsh.y" +#line 2289 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_SEGM_LINE, (int)yyvsp[-12].d, @@ -5062,14 +5057,14 @@ case 179: ; break;} case 180: -#line 2301 "Gmsh.y" +#line 2296 "Gmsh.y" { extr.mesh.ExtrudeMesh = false; extr.mesh.Recombine = false; ; break;} case 181: -#line 2306 "Gmsh.y" +#line 2301 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_SURF_PLAN, (int)yyvsp[-12].d, @@ -5078,14 +5073,14 @@ case 181: ; break;} case 182: -#line 2313 "Gmsh.y" +#line 2308 "Gmsh.y" { extr.mesh.ExtrudeMesh = false; extr.mesh.Recombine = false; ; break;} case 183: -#line 2318 "Gmsh.y" +#line 2313 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_POINT, (int)yyvsp[-14].d, @@ -5094,14 +5089,14 @@ case 183: ; break;} case 184: -#line 2325 "Gmsh.y" +#line 2320 "Gmsh.y" { extr.mesh.ExtrudeMesh = false; extr.mesh.Recombine = false; ; break;} case 185: -#line 2330 "Gmsh.y" +#line 2325 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_SEGM_LINE, (int)yyvsp[-14].d, @@ -5110,14 +5105,14 @@ case 185: ; break;} case 186: -#line 2337 "Gmsh.y" +#line 2332 "Gmsh.y" { extr.mesh.ExtrudeMesh = false; extr.mesh.Recombine = false; ; break;} case 187: -#line 2342 "Gmsh.y" +#line 2337 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_SURF_PLAN, (int)yyvsp[-14].d, @@ -5126,17 +5121,17 @@ case 187: ; break;} case 188: -#line 2353 "Gmsh.y" +#line 2348 "Gmsh.y" { ; break;} case 189: -#line 2356 "Gmsh.y" +#line 2351 "Gmsh.y" { ; break;} case 190: -#line 2362 "Gmsh.y" +#line 2357 "Gmsh.y" { double d; extr.mesh.ExtrudeMesh = true; @@ -5164,7 +5159,7 @@ case 190: ; break;} case 191: -#line 2388 "Gmsh.y" +#line 2383 "Gmsh.y" { double d; extr.mesh.ExtrudeMesh = true; @@ -5190,13 +5185,13 @@ case 191: ; break;} case 192: -#line 2412 "Gmsh.y" +#line 2407 "Gmsh.y" { extr.mesh.Recombine = true; ; break;} case 193: -#line 2421 "Gmsh.y" +#line 2416 "Gmsh.y" { for(int i = 0; i < List_Nbr(yyvsp[-3].l); i++){ double d; @@ -5216,7 +5211,7 @@ case 193: ; break;} case 194: -#line 2439 "Gmsh.y" +#line 2434 "Gmsh.y" { for(int i = 0; i < List_Nbr(yyvsp[-6].l); i++){ double d; @@ -5236,7 +5231,7 @@ case 194: ; break;} case 195: -#line 2457 "Gmsh.y" +#line 2452 "Gmsh.y" { for(int i = 0; i < List_Nbr(yyvsp[-6].l); i++){ double d; @@ -5256,7 +5251,7 @@ case 195: ; break;} case 196: -#line 2475 "Gmsh.y" +#line 2470 "Gmsh.y" { Surface *s = FindSurface((int)yyvsp[-4].d, THEM); if(!s) @@ -5287,7 +5282,7 @@ case 196: ; break;} case 197: -#line 2504 "Gmsh.y" +#line 2499 "Gmsh.y" { Surface *s = FindSurface((int)yyvsp[-5].d, THEM); if(!s) @@ -5324,7 +5319,7 @@ case 197: ; break;} case 198: -#line 2539 "Gmsh.y" +#line 2534 "Gmsh.y" { Surface *s = FindSurface((int)yyvsp[-4].d, THEM); if(!s) @@ -5353,7 +5348,7 @@ case 198: ; break;} case 199: -#line 2566 "Gmsh.y" +#line 2561 "Gmsh.y" { Volume *v = FindVolume((int)yyvsp[-4].d, THEM); if(!v) @@ -5382,7 +5377,7 @@ case 199: ; break;} case 200: -#line 2593 "Gmsh.y" +#line 2588 "Gmsh.y" { for(int i = 0; i < List_Nbr(yyvsp[-3].l); i++){ double d; @@ -5398,7 +5393,7 @@ case 200: ; break;} case 201: -#line 2607 "Gmsh.y" +#line 2602 "Gmsh.y" { for(int i = 0; i < List_Nbr(yyvsp[-1].l); i++){ double d; @@ -5413,51 +5408,51 @@ case 201: ; break;} case 202: -#line 2626 "Gmsh.y" +#line 2621 "Gmsh.y" { ReplaceAllDuplicates(THEM); ; break;} case 203: -#line 2630 "Gmsh.y" +#line 2625 "Gmsh.y" { IntersectAllSegmentsTogether(); ; break;} case 204: -#line 2639 "Gmsh.y" +#line 2634 "Gmsh.y" { yyval.d = yyvsp[0].d; ; break;} case 205: -#line 2640 "Gmsh.y" +#line 2635 "Gmsh.y" { yyval.d = yyvsp[-1].d; ; break;} case 206: -#line 2641 "Gmsh.y" +#line 2636 "Gmsh.y" { yyval.d = -yyvsp[0].d; ; break;} case 207: -#line 2642 "Gmsh.y" +#line 2637 "Gmsh.y" { yyval.d = yyvsp[0].d; ; break;} case 208: -#line 2643 "Gmsh.y" +#line 2638 "Gmsh.y" { yyval.d = !yyvsp[0].d; ; break;} case 209: -#line 2644 "Gmsh.y" +#line 2639 "Gmsh.y" { yyval.d = yyvsp[-2].d - yyvsp[0].d; ; break;} case 210: -#line 2645 "Gmsh.y" +#line 2640 "Gmsh.y" { yyval.d = yyvsp[-2].d + yyvsp[0].d; ; break;} case 211: -#line 2646 "Gmsh.y" +#line 2641 "Gmsh.y" { yyval.d = yyvsp[-2].d * yyvsp[0].d; ; break;} case 212: -#line 2648 "Gmsh.y" +#line 2643 "Gmsh.y" { if(!yyvsp[0].d) yymsg(GERROR, "Division by zero in '%g / %g'", yyvsp[-2].d, yyvsp[0].d); @@ -5466,247 +5461,247 @@ case 212: ; break;} case 213: -#line 2654 "Gmsh.y" +#line 2649 "Gmsh.y" { yyval.d = (int)yyvsp[-2].d % (int)yyvsp[0].d; ; break;} case 214: -#line 2655 "Gmsh.y" +#line 2650 "Gmsh.y" { yyval.d = pow(yyvsp[-2].d, yyvsp[0].d); ; break;} case 215: -#line 2656 "Gmsh.y" +#line 2651 "Gmsh.y" { yyval.d = yyvsp[-2].d < yyvsp[0].d; ; break;} case 216: -#line 2657 "Gmsh.y" +#line 2652 "Gmsh.y" { yyval.d = yyvsp[-2].d > yyvsp[0].d; ; break;} case 217: -#line 2658 "Gmsh.y" +#line 2653 "Gmsh.y" { yyval.d = yyvsp[-2].d <= yyvsp[0].d; ; break;} case 218: -#line 2659 "Gmsh.y" +#line 2654 "Gmsh.y" { yyval.d = yyvsp[-2].d >= yyvsp[0].d; ; break;} case 219: -#line 2660 "Gmsh.y" +#line 2655 "Gmsh.y" { yyval.d = yyvsp[-2].d == yyvsp[0].d; ; break;} case 220: -#line 2661 "Gmsh.y" +#line 2656 "Gmsh.y" { yyval.d = yyvsp[-2].d != yyvsp[0].d; ; break;} case 221: -#line 2662 "Gmsh.y" +#line 2657 "Gmsh.y" { yyval.d = yyvsp[-2].d && yyvsp[0].d; ; break;} case 222: -#line 2663 "Gmsh.y" +#line 2658 "Gmsh.y" { yyval.d = yyvsp[-2].d || yyvsp[0].d; ; break;} case 223: -#line 2664 "Gmsh.y" +#line 2659 "Gmsh.y" { yyval.d = yyvsp[-4].d? yyvsp[-2].d : yyvsp[0].d; ; break;} case 224: -#line 2665 "Gmsh.y" +#line 2660 "Gmsh.y" { yyval.d = exp(yyvsp[-1].d); ; break;} case 225: -#line 2666 "Gmsh.y" +#line 2661 "Gmsh.y" { yyval.d = log(yyvsp[-1].d); ; break;} case 226: -#line 2667 "Gmsh.y" +#line 2662 "Gmsh.y" { yyval.d = log10(yyvsp[-1].d); ; break;} case 227: -#line 2668 "Gmsh.y" +#line 2663 "Gmsh.y" { yyval.d = sqrt(yyvsp[-1].d); ; break;} case 228: -#line 2669 "Gmsh.y" +#line 2664 "Gmsh.y" { yyval.d = sin(yyvsp[-1].d); ; break;} case 229: -#line 2670 "Gmsh.y" +#line 2665 "Gmsh.y" { yyval.d = asin(yyvsp[-1].d); ; break;} case 230: -#line 2671 "Gmsh.y" +#line 2666 "Gmsh.y" { yyval.d = cos(yyvsp[-1].d); ; break;} case 231: -#line 2672 "Gmsh.y" +#line 2667 "Gmsh.y" { yyval.d = acos(yyvsp[-1].d); ; break;} case 232: -#line 2673 "Gmsh.y" +#line 2668 "Gmsh.y" { yyval.d = tan(yyvsp[-1].d); ; break;} case 233: -#line 2674 "Gmsh.y" +#line 2669 "Gmsh.y" { yyval.d = atan(yyvsp[-1].d); ; break;} case 234: -#line 2675 "Gmsh.y" +#line 2670 "Gmsh.y" { yyval.d = atan2(yyvsp[-3].d, yyvsp[-1].d);; break;} case 235: -#line 2676 "Gmsh.y" +#line 2671 "Gmsh.y" { yyval.d = sinh(yyvsp[-1].d); ; break;} case 236: -#line 2677 "Gmsh.y" +#line 2672 "Gmsh.y" { yyval.d = cosh(yyvsp[-1].d); ; break;} case 237: -#line 2678 "Gmsh.y" +#line 2673 "Gmsh.y" { yyval.d = tanh(yyvsp[-1].d); ; break;} case 238: -#line 2679 "Gmsh.y" +#line 2674 "Gmsh.y" { yyval.d = fabs(yyvsp[-1].d); ; break;} case 239: -#line 2680 "Gmsh.y" +#line 2675 "Gmsh.y" { yyval.d = floor(yyvsp[-1].d); ; break;} case 240: -#line 2681 "Gmsh.y" +#line 2676 "Gmsh.y" { yyval.d = ceil(yyvsp[-1].d); ; break;} case 241: -#line 2682 "Gmsh.y" +#line 2677 "Gmsh.y" { yyval.d = fmod(yyvsp[-3].d, yyvsp[-1].d); ; break;} case 242: -#line 2683 "Gmsh.y" +#line 2678 "Gmsh.y" { yyval.d = fmod(yyvsp[-3].d, yyvsp[-1].d); ; break;} case 243: -#line 2684 "Gmsh.y" +#line 2679 "Gmsh.y" { yyval.d = sqrt(yyvsp[-3].d*yyvsp[-3].d+yyvsp[-1].d*yyvsp[-1].d); ; break;} case 244: -#line 2685 "Gmsh.y" +#line 2680 "Gmsh.y" { yyval.d = yyvsp[-1].d*(double)rand()/(double)RAND_MAX; ; break;} case 245: -#line 2687 "Gmsh.y" +#line 2682 "Gmsh.y" { yyval.d = exp(yyvsp[-1].d); ; break;} case 246: -#line 2688 "Gmsh.y" +#line 2683 "Gmsh.y" { yyval.d = log(yyvsp[-1].d); ; break;} case 247: -#line 2689 "Gmsh.y" +#line 2684 "Gmsh.y" { yyval.d = log10(yyvsp[-1].d); ; break;} case 248: -#line 2690 "Gmsh.y" +#line 2685 "Gmsh.y" { yyval.d = sqrt(yyvsp[-1].d); ; break;} case 249: -#line 2691 "Gmsh.y" +#line 2686 "Gmsh.y" { yyval.d = sin(yyvsp[-1].d); ; break;} case 250: -#line 2692 "Gmsh.y" +#line 2687 "Gmsh.y" { yyval.d = asin(yyvsp[-1].d); ; break;} case 251: -#line 2693 "Gmsh.y" +#line 2688 "Gmsh.y" { yyval.d = cos(yyvsp[-1].d); ; break;} case 252: -#line 2694 "Gmsh.y" +#line 2689 "Gmsh.y" { yyval.d = acos(yyvsp[-1].d); ; break;} case 253: -#line 2695 "Gmsh.y" +#line 2690 "Gmsh.y" { yyval.d = tan(yyvsp[-1].d); ; break;} case 254: -#line 2696 "Gmsh.y" +#line 2691 "Gmsh.y" { yyval.d = atan(yyvsp[-1].d); ; break;} case 255: -#line 2697 "Gmsh.y" +#line 2692 "Gmsh.y" { yyval.d = atan2(yyvsp[-3].d, yyvsp[-1].d);; break;} case 256: -#line 2698 "Gmsh.y" +#line 2693 "Gmsh.y" { yyval.d = sinh(yyvsp[-1].d); ; break;} case 257: -#line 2699 "Gmsh.y" +#line 2694 "Gmsh.y" { yyval.d = cosh(yyvsp[-1].d); ; break;} case 258: -#line 2700 "Gmsh.y" +#line 2695 "Gmsh.y" { yyval.d = tanh(yyvsp[-1].d); ; break;} case 259: -#line 2701 "Gmsh.y" +#line 2696 "Gmsh.y" { yyval.d = fabs(yyvsp[-1].d); ; break;} case 260: -#line 2702 "Gmsh.y" +#line 2697 "Gmsh.y" { yyval.d = floor(yyvsp[-1].d); ; break;} case 261: -#line 2703 "Gmsh.y" +#line 2698 "Gmsh.y" { yyval.d = ceil(yyvsp[-1].d); ; break;} case 262: -#line 2704 "Gmsh.y" +#line 2699 "Gmsh.y" { yyval.d = fmod(yyvsp[-3].d, yyvsp[-1].d); ; break;} case 263: -#line 2705 "Gmsh.y" +#line 2700 "Gmsh.y" { yyval.d = fmod(yyvsp[-3].d, yyvsp[-1].d); ; break;} case 264: -#line 2706 "Gmsh.y" +#line 2701 "Gmsh.y" { yyval.d = sqrt(yyvsp[-3].d*yyvsp[-3].d+yyvsp[-1].d*yyvsp[-1].d); ; break;} case 265: -#line 2707 "Gmsh.y" +#line 2702 "Gmsh.y" { yyval.d = yyvsp[-1].d*(double)rand()/(double)RAND_MAX; ; break;} case 266: -#line 2716 "Gmsh.y" +#line 2711 "Gmsh.y" { yyval.d = yyvsp[0].d; ; break;} case 267: -#line 2717 "Gmsh.y" +#line 2712 "Gmsh.y" { yyval.d = 3.141592653589793; ; break;} case 268: -#line 2718 "Gmsh.y" +#line 2713 "Gmsh.y" { yyval.d = ParUtil::Instance()->rank(); ; break;} case 269: -#line 2719 "Gmsh.y" +#line 2714 "Gmsh.y" { yyval.d = ParUtil::Instance()->size(); ; break;} case 270: -#line 2720 "Gmsh.y" +#line 2715 "Gmsh.y" { yyval.d = Get_GmshMajorVersion(); ; break;} case 271: -#line 2721 "Gmsh.y" +#line 2716 "Gmsh.y" { yyval.d = Get_GmshMinorVersion(); ; break;} case 272: -#line 2722 "Gmsh.y" +#line 2717 "Gmsh.y" { yyval.d = Get_GmshPatchVersion(); ; break;} case 273: -#line 2727 "Gmsh.y" +#line 2722 "Gmsh.y" { Symbol TheSymbol; TheSymbol.Name = yyvsp[0].c; @@ -5721,7 +5716,7 @@ case 273: ; break;} case 274: -#line 2743 "Gmsh.y" +#line 2738 "Gmsh.y" { char tmpstring[1024]; sprintf(tmpstring, "%s_%d", yyvsp[-4].c, (int)yyvsp[-1].d) ; @@ -5738,7 +5733,7 @@ case 274: ; break;} case 275: -#line 2758 "Gmsh.y" +#line 2753 "Gmsh.y" { Symbol TheSymbol; TheSymbol.Name = yyvsp[-3].c; @@ -5760,7 +5755,7 @@ case 275: ; break;} case 276: -#line 2778 "Gmsh.y" +#line 2773 "Gmsh.y" { Symbol TheSymbol; TheSymbol.Name = yyvsp[-2].c; @@ -5776,7 +5771,7 @@ case 276: ; break;} case 277: -#line 2792 "Gmsh.y" +#line 2787 "Gmsh.y" { Symbol TheSymbol; TheSymbol.Name = yyvsp[-1].c; @@ -5791,7 +5786,7 @@ case 277: ; break;} case 278: -#line 2805 "Gmsh.y" +#line 2800 "Gmsh.y" { Symbol TheSymbol; TheSymbol.Name = yyvsp[-4].c; @@ -5813,7 +5808,7 @@ case 278: ; break;} case 279: -#line 2828 "Gmsh.y" +#line 2823 "Gmsh.y" { double (*pNumOpt)(int num, int action, double value); StringXNumber *pNumCat; @@ -5833,7 +5828,7 @@ case 279: ; break;} case 280: -#line 2846 "Gmsh.y" +#line 2841 "Gmsh.y" { double (*pNumOpt)(int num, int action, double value); StringXNumber *pNumCat; @@ -5853,7 +5848,7 @@ case 280: ; break;} case 281: -#line 2864 "Gmsh.y" +#line 2859 "Gmsh.y" { double (*pNumOpt)(int num, int action, double value); StringXNumber *pNumCat; @@ -5873,7 +5868,7 @@ case 281: ; break;} case 282: -#line 2882 "Gmsh.y" +#line 2877 "Gmsh.y" { double (*pNumOpt)(int num, int action, double value); StringXNumber *pNumCat; @@ -5893,124 +5888,124 @@ case 282: ; break;} case 283: -#line 2900 "Gmsh.y" +#line 2895 "Gmsh.y" { yyval.d = GetValue(yyvsp[-3].c, yyvsp[-1].d); Free(yyvsp[-3].c); ; break;} case 284: -#line 2908 "Gmsh.y" +#line 2903 "Gmsh.y" { memcpy(yyval.v, yyvsp[0].v, 5*sizeof(double)); ; break;} case 285: -#line 2912 "Gmsh.y" +#line 2907 "Gmsh.y" { for(int i = 0; i < 5; i++) yyval.v[i] = -yyvsp[0].v[i]; ; break;} case 286: -#line 2916 "Gmsh.y" +#line 2911 "Gmsh.y" { for(int i = 0; i < 5; i++) yyval.v[i] = yyvsp[0].v[i]; ; break;} case 287: -#line 2920 "Gmsh.y" +#line 2915 "Gmsh.y" { for(int i = 0; i < 5; i++) yyval.v[i] = yyvsp[-2].v[i] - yyvsp[0].v[i]; ; break;} case 288: -#line 2924 "Gmsh.y" +#line 2919 "Gmsh.y" { for(int i = 0; i < 5; i++) yyval.v[i] = yyvsp[-2].v[i] + yyvsp[0].v[i]; ; break;} case 289: -#line 2931 "Gmsh.y" +#line 2926 "Gmsh.y" { yyval.v[0] = yyvsp[-9].d; yyval.v[1] = yyvsp[-7].d; yyval.v[2] = yyvsp[-5].d; yyval.v[3] = yyvsp[-3].d; yyval.v[4] = yyvsp[-1].d; ; break;} case 290: -#line 2935 "Gmsh.y" +#line 2930 "Gmsh.y" { yyval.v[0] = yyvsp[-7].d; yyval.v[1] = yyvsp[-5].d; yyval.v[2] = yyvsp[-3].d; yyval.v[3] = yyvsp[-1].d; yyval.v[4] = 1.0; ; break;} case 291: -#line 2939 "Gmsh.y" +#line 2934 "Gmsh.y" { yyval.v[0] = yyvsp[-5].d; yyval.v[1] = yyvsp[-3].d; yyval.v[2] = yyvsp[-1].d; yyval.v[3] = 0.0; yyval.v[4] = 1.0; ; break;} case 292: -#line 2943 "Gmsh.y" +#line 2938 "Gmsh.y" { yyval.v[0] = yyvsp[-5].d; yyval.v[1] = yyvsp[-3].d; yyval.v[2] = yyvsp[-1].d; yyval.v[3] = 0.0; yyval.v[4] = 1.0; ; break;} case 293: -#line 2950 "Gmsh.y" +#line 2945 "Gmsh.y" { ; break;} case 294: -#line 2953 "Gmsh.y" +#line 2948 "Gmsh.y" { yyval.l = yyvsp[-1].l; ; break;} case 295: -#line 2957 "Gmsh.y" +#line 2952 "Gmsh.y" { yyval.l = yyvsp[-1].l; ; break;} case 296: -#line 2964 "Gmsh.y" +#line 2959 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(List_T*)); List_Add(yyval.l, &(yyvsp[0].l)); ; break;} case 297: -#line 2969 "Gmsh.y" +#line 2964 "Gmsh.y" { List_Add(yyval.l, &(yyvsp[0].l)); ; break;} case 298: -#line 2977 "Gmsh.y" +#line 2972 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(double)); List_Add(yyval.l, &(yyvsp[0].d)); ; break;} case 299: -#line 2982 "Gmsh.y" +#line 2977 "Gmsh.y" { yyval.l = yyvsp[0].l; ; break;} case 300: -#line 2986 "Gmsh.y" +#line 2981 "Gmsh.y" { // creates an empty list yyval.l = List_Create(2, 1, sizeof(double)); ; break;} case 301: -#line 2991 "Gmsh.y" +#line 2986 "Gmsh.y" { yyval.l = yyvsp[-1].l; ; break;} case 302: -#line 2995 "Gmsh.y" +#line 2990 "Gmsh.y" { yyval.l = yyvsp[-1].l; double *pd; @@ -6021,7 +6016,7 @@ case 302: ; break;} case 303: -#line 3007 "Gmsh.y" +#line 3002 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(double)); for(double d = yyvsp[-2].d; (yyvsp[-2].d < yyvsp[0].d) ? (d <= yyvsp[0].d) : (d >= yyvsp[0].d); (yyvsp[-2].d < yyvsp[0].d) ? (d += 1.) : (d -= 1.)) @@ -6029,7 +6024,7 @@ case 303: ; break;} case 304: -#line 3013 "Gmsh.y" +#line 3008 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(double)); if(!yyvsp[0].d || (yyvsp[-4].d < yyvsp[-2].d && yyvsp[0].d < 0) || (yyvsp[-4].d > yyvsp[-2].d && yyvsp[0].d > 0)){ @@ -6042,7 +6037,7 @@ case 304: ; break;} case 305: -#line 3024 "Gmsh.y" +#line 3019 "Gmsh.y" { // Returns the coordinates of a point and fills a list with it. // This allows to ensure e.g. that relative point positions are @@ -6064,7 +6059,7 @@ case 305: ; break;} case 306: -#line 3044 "Gmsh.y" +#line 3039 "Gmsh.y" { yyval.l = List_Create(List_Nbr(yyvsp[0].l), 1, sizeof(double)); for(int i = 0; i < List_Nbr(yyvsp[0].l); i++){ @@ -6076,7 +6071,7 @@ case 306: ; break;} case 307: -#line 3054 "Gmsh.y" +#line 3049 "Gmsh.y" { yyval.l = List_Create(List_Nbr(yyvsp[0].l), 1, sizeof(double)); for(int i = 0; i < List_Nbr(yyvsp[0].l); i++){ @@ -6088,7 +6083,7 @@ case 307: ; break;} case 308: -#line 3064 "Gmsh.y" +#line 3059 "Gmsh.y" { yyval.l = List_Create(List_Nbr(yyvsp[0].l), 1, sizeof(double)); for(int i = 0; i < List_Nbr(yyvsp[0].l); i++){ @@ -6100,7 +6095,7 @@ case 308: ; break;} case 309: -#line 3074 "Gmsh.y" +#line 3069 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(double)); Symbol TheSymbol; @@ -6119,7 +6114,7 @@ case 309: ; break;} case 310: -#line 3091 "Gmsh.y" +#line 3086 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(double)); Symbol TheSymbol; @@ -6140,7 +6135,7 @@ case 310: ; break;} case 311: -#line 3110 "Gmsh.y" +#line 3105 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(double)); Symbol TheSymbol; @@ -6166,7 +6161,7 @@ case 311: ; break;} case 312: -#line 3134 "Gmsh.y" +#line 3129 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(double)); Symbol TheSymbol; @@ -6194,26 +6189,26 @@ case 312: ; break;} case 313: -#line 3163 "Gmsh.y" +#line 3158 "Gmsh.y" { yyval.l = List_Create(2, 1, sizeof(double)); List_Add(yyval.l, &(yyvsp[0].d)); ; break;} case 314: -#line 3168 "Gmsh.y" +#line 3163 "Gmsh.y" { yyval.l = yyvsp[0].l; ; break;} case 315: -#line 3172 "Gmsh.y" +#line 3167 "Gmsh.y" { List_Add(yyval.l, &(yyvsp[0].d)); ; break;} case 316: -#line 3176 "Gmsh.y" +#line 3171 "Gmsh.y" { for(int i = 0; i < List_Nbr(yyvsp[0].l); i++){ double d; @@ -6224,19 +6219,19 @@ case 316: ; break;} case 317: -#line 3189 "Gmsh.y" +#line 3184 "Gmsh.y" { yyval.u = CTX.PACK_COLOR((int)yyvsp[-7].d, (int)yyvsp[-5].d, (int)yyvsp[-3].d, (int)yyvsp[-1].d); ; break;} case 318: -#line 3193 "Gmsh.y" +#line 3188 "Gmsh.y" { yyval.u = CTX.PACK_COLOR((int)yyvsp[-5].d, (int)yyvsp[-3].d, (int)yyvsp[-1].d, 255); ; break;} case 319: -#line 3205 "Gmsh.y" +#line 3200 "Gmsh.y" { int flag; yyval.u = Get_ColorForString(ColorString, -1, yyvsp[0].c, &flag); @@ -6245,7 +6240,7 @@ case 319: ; break;} case 320: -#line 3212 "Gmsh.y" +#line 3207 "Gmsh.y" { unsigned int (*pColOpt)(int num, int action, unsigned int value); StringXColor *pColCat; @@ -6266,13 +6261,13 @@ case 320: ; break;} case 321: -#line 3234 "Gmsh.y" +#line 3229 "Gmsh.y" { yyval.l = yyvsp[-1].l; ; break;} case 322: -#line 3238 "Gmsh.y" +#line 3233 "Gmsh.y" { yyval.l = List_Create(256, 10, sizeof(unsigned int)); GmshColorTable *ct = Get_ColorTable((int)yyvsp[-3].d); @@ -6286,26 +6281,26 @@ case 322: ; break;} case 323: -#line 3253 "Gmsh.y" +#line 3248 "Gmsh.y" { yyval.l = List_Create(256, 10, sizeof(unsigned int)); List_Add(yyval.l, &(yyvsp[0].u)); ; break;} case 324: -#line 3258 "Gmsh.y" +#line 3253 "Gmsh.y" { List_Add(yyval.l, &(yyvsp[0].u)); ; break;} case 325: -#line 3265 "Gmsh.y" +#line 3260 "Gmsh.y" { yyval.c = yyvsp[0].c; ; break;} case 326: -#line 3269 "Gmsh.y" +#line 3264 "Gmsh.y" { yyval.c = (char *)Malloc(32*sizeof(char)); time_t now; @@ -6315,7 +6310,7 @@ case 326: ; break;} case 327: -#line 3277 "Gmsh.y" +#line 3272 "Gmsh.y" { yyval.c = (char *)Malloc((strlen(yyvsp[-3].c)+strlen(yyvsp[-1].c)+1)*sizeof(char)); strcpy(yyval.c, yyvsp[-3].c); @@ -6325,7 +6320,7 @@ case 327: ; break;} case 328: -#line 3285 "Gmsh.y" +#line 3280 "Gmsh.y" { yyval.c = (char *)Malloc((strlen(yyvsp[-1].c)+1)*sizeof(char)); int i; @@ -6341,7 +6336,7 @@ case 328: ; break;} case 329: -#line 3299 "Gmsh.y" +#line 3294 "Gmsh.y" { yyval.c = (char *)Malloc((strlen(yyvsp[-1].c)+1)*sizeof(char)); int i; @@ -6357,13 +6352,13 @@ case 329: ; break;} case 330: -#line 3313 "Gmsh.y" +#line 3308 "Gmsh.y" { yyval.c = yyvsp[-1].c; ; break;} case 331: -#line 3317 "Gmsh.y" +#line 3312 "Gmsh.y" { char tmpstring[1024]; int i = PrintListOfDouble(yyvsp[-3].c, yyvsp[-1].l, tmpstring); @@ -6384,7 +6379,7 @@ case 331: ; break;} case 332: -#line 3336 "Gmsh.y" +#line 3331 "Gmsh.y" { char* (*pStrOpt)(int num, int action, char *value); StringXString *pStrCat; @@ -6408,7 +6403,7 @@ case 332: ; break;} case 333: -#line 3358 "Gmsh.y" +#line 3353 "Gmsh.y" { char* (*pStrOpt)(int num, int action, char *value); StringXString *pStrCat; @@ -6653,7 +6648,7 @@ yyerrhandle: } return 1; } -#line 3381 "Gmsh.y" +#line 3376 "Gmsh.y" void DeleteSymbol(void *a, void *b){ diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y index db1724ddd76098d827fe371a6045e51b0139c7a5..3e0c1cbd0aea6e30d1dadad2ffc2aaef7c5646fe 100644 --- a/Parser/Gmsh.y +++ b/Parser/Gmsh.y @@ -1,5 +1,5 @@ %{ -// $Id: Gmsh.y,v 1.232 2006-08-07 19:08:13 geuzaine Exp $ +// $Id: Gmsh.y,v 1.233 2006-08-12 16:16:36 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -44,7 +44,6 @@ #include "ColorTable.h" #include "OS.h" #include "CreateFile.h" -#include "Visibility.h" Tree_T *Symbol_T = NULL; @@ -1777,26 +1776,22 @@ Colorify : Visibility : tShow StringExpr tEND { - int m = (CTX.visibility_mode == 2) ? VIS_MESH : - ((CTX.visibility_mode == 1) ? VIS_GEOM : VIS_GEOM|VIS_MESH); - for(int i = 2; i < 6; i++) - SetVisibilityByNumber($2, i, m); + for(int i = 0; i < 4; i++) + VisibilityShape($2, i, 1); Free($2); } | tHide StringExpr tEND { - for(int i = 2; i < 6; i++) - SetVisibilityByNumber($2, i, 0); + for(int i = 0; i < 4; i++) + VisibilityShape($2, i, 0); Free($2); } | tShow '{' ListOfShapes '}' { - int m = (CTX.visibility_mode == 2) ? VIS_MESH : - ((CTX.visibility_mode == 1) ? VIS_GEOM : VIS_GEOM|VIS_MESH); for(int i = 0; i < List_Nbr($3); i++){ Shape TheShape; List_Read($3, i, &TheShape); - VisibilityShape(TheShape.Type, TheShape.Num, m); + VisibilityShape(TheShape.Type, TheShape.Num, 1); } List_Delete($3); } @@ -1891,7 +1886,7 @@ Command : SleepInSeconds($2); } else if(!strcmp($1, "Remesh")){ - ReMesh(THEM); + ReMesh(); } else if(!strcmp($1, "Mesh")){ yymsg(GERROR, "Mesh directives are not (yet) allowed in scripts"); diff --git a/Parser/Gmsh.yy.cpp b/Parser/Gmsh.yy.cpp index 2be60e3187997f1acc63368195a258df98f27dd7..28281a6c10372629f8cef86d6abec0e066011e01 100644 --- a/Parser/Gmsh.yy.cpp +++ b/Parser/Gmsh.yy.cpp @@ -2,7 +2,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.270 2006-08-07 19:08:13 geuzaine Exp $ + * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.271 2006-08-12 16:16:36 geuzaine Exp $ */ #define FLEX_SCANNER @@ -727,7 +727,7 @@ char *yytext; #line 1 "Gmsh.l" #define INITIAL 0 #line 2 "Gmsh.l" -// $Id: Gmsh.yy.cpp,v 1.270 2006-08-07 19:08:13 geuzaine Exp $ +// $Id: Gmsh.yy.cpp,v 1.271 2006-08-12 16:16:36 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // diff --git a/Parser/Makefile b/Parser/Makefile index 450cdcf13e9404a9a58935598ae083edfeb4da6d..e38977c2475a6a9a2ecf61658959a8d9904a97d3 100644 --- a/Parser/Makefile +++ b/Parser/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.92 2006-08-07 19:08:13 geuzaine Exp $ +# $Id: Makefile,v 1.93 2006-08-12 16:16:36 geuzaine Exp $ # # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle # @@ -93,7 +93,7 @@ Gmsh.tab.o: Gmsh.tab.cpp ../Plugin/PluginManager.h ../Plugin/Plugin.h \ ../Geo/CAD.h ../Geo/ExtrudeParams.h ../Graphics/Draw.h ../Mesh/Create.h \ ../Mesh/Vertex.h ../Mesh/Mesh.h ../Common/Colors.h ../Common/Options.h \ Parser.h OpenFile.h ../Common/CommandLine.h FunctionManager.h \ - ../Common/OS.h ../Graphics/CreateFile.h ../Common/Visibility.h + ../Common/OS.h ../Graphics/CreateFile.h # 1 "/Users/geuzaine/.gmsh/Parser//" Gmsh.yy.o: Gmsh.yy.cpp ../Common/Gmsh.h ../Common/Message.h \ ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \ @@ -129,9 +129,8 @@ OpenFile.o: OpenFile.cpp ../Common/Gmsh.h ../Common/Message.h \ ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Edge.h ../Mesh/Vertex.h \ ../Mesh/Simplex.h ../Geo/ExtrudeParams.h ../Mesh/Metric.h \ ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h \ - ../Common/Visibility.h ../Graphics/ReadImg.h ../Common/OS.h \ - ../Common/GmshUI.h ../Graphics/Draw.h ../Fltk/GUI.h \ - ../Fltk/Opengl_Window.h ../Fltk/Colorbar_Window.h \ - ../Fltk/Popup_Button.h + ../Graphics/ReadImg.h ../Common/OS.h ../Common/GmshUI.h \ + ../Graphics/Draw.h ../Fltk/GUI.h ../Fltk/Opengl_Window.h \ + ../Fltk/Colorbar_Window.h ../Fltk/Popup_Button.h # 1 "/Users/geuzaine/.gmsh/Parser//" FunctionManager.o: FunctionManager.cpp FunctionManager.h diff --git a/Parser/OpenFile.cpp b/Parser/OpenFile.cpp index 3ba6d242260ca73a445a38c160cb40b3f6c7d462..740987bb530ea2ba80ce691e6fbc1bfd29fe3ee2 100644 --- a/Parser/OpenFile.cpp +++ b/Parser/OpenFile.cpp @@ -1,4 +1,4 @@ -// $Id: OpenFile.cpp,v 1.105 2006-08-11 18:48:39 geuzaine Exp $ +// $Id: OpenFile.cpp,v 1.106 2006-08-12 16:16:36 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -33,7 +33,6 @@ #include "PluginManager.h" #include "Views.h" #include "Mesh.h" -#include "Visibility.h" #include "ReadImg.h" #include "OS.h" diff --git a/Parser/Parser.h b/Parser/Parser.h index 4b41777393586ee6615fdc7d0b064a36f8ee5912..3f8b12384251cf86b668a204524ce7f4d795298b 100644 --- a/Parser/Parser.h +++ b/Parser/Parser.h @@ -21,18 +21,19 @@ // Please report all bugs and problems to <gmsh@geuz.org>. #include "List.h" +#include "Tree.h" typedef struct { char *Name; List_T *val; } Symbol; -void InitSymbols (void); +void InitSymbols(); extern Tree_T *Symbol_T; -int yyparse (void); -int yylex (); +int yyparse(); +int yylex(); void force_yyflush(); extern FILE *yyin; @@ -41,5 +42,4 @@ extern char yyname[256]; extern char *yytext; extern int yyerrorstate; - #endif