diff --git a/Geo/GEdge.cpp b/Geo/GEdge.cpp index 4d33054285c099663c0b4ad9880b2df8c7e8115f..cded8e55516dcc21a6f3b03faa64f2ca185a020a 100644 --- a/Geo/GEdge.cpp +++ b/Geo/GEdge.cpp @@ -54,3 +54,11 @@ void GEdge::recomputeMeshPartitions() if(part) model()->getMeshPartitions().insert(part); } } + +std::string GEdge::getAdditionalInfoString() +{ + if(!v0 || !v1) return std::string(""); + char tmp[256]; + sprintf(tmp, "{%d,%d}", v0->tag(), v1->tag()); + return std::string(tmp); +} diff --git a/Geo/GEdge.h b/Geo/GEdge.h index b6483d8871dbe4e127e5314f0b631a3d33b53840..74e609e63a287cf139692eeb2383762fe09d245c 100644 --- a/Geo/GEdge.h +++ b/Geo/GEdge.h @@ -67,13 +67,7 @@ class GEdge : public GEntity { virtual int minimumMeshSegments () const {return 1;} virtual int minimumDrawSegments () const {return 1;} - virtual std::string getAdditionalInfoString() - { - if(!v0 || !v1) return ""; - char tmp[256]; - sprintf(tmp, "{%d,%d}", v0->tag(), v1->tag()); - return std::string(tmp); - } + virtual std::string getAdditionalInfoString(); }; #endif diff --git a/Geo/GEntity.cpp b/Geo/GEntity.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9493292c7248127a81f4bb654db661566de464a3 --- /dev/null +++ b/Geo/GEntity.cpp @@ -0,0 +1,24 @@ +#include "GEntity.h" + +std::string GEntity::getInfoString() +{ + char str[256]; + sprintf(str, "%s %d", getTypeString().c_str(), tag()); + std::string info = getAdditionalInfoString(); + if(info.size()){ + strcat(str, " "); + strcat(str, info.c_str()); + } + if(physicals.size()){ + char str2[256] = " ["; + for(unsigned int i = 0; i < physicals.size(); i++){ + char str3[256]; + sprintf(str3, "%d", physicals[i]); + if(i) strcat(str2, " "); + strcat(str2, str3); + } + strcat(str2, "]"); + strcat(str, str2); + } + return std::string(str); +} diff --git a/Geo/GEntity.h b/Geo/GEntity.h index c7e24e7134728d075835767bcf5f0f8f0db32af8..80f75f24d6f7ffaa9a20449c0b22fa21ef70971d 100644 --- a/Geo/GEntity.h +++ b/Geo/GEntity.h @@ -145,28 +145,7 @@ class GEntity { virtual MRep *meshRep(){ return _mesh; } // Returns an information string for the entity - virtual std::string getInfoString() - { - char str[256]; - sprintf(str, "%s %d", getTypeString().c_str(), tag()); - std::string info = getAdditionalInfoString(); - if(info.size()){ - strcat(str, " "); - strcat(str, info.c_str()); - } - if(physicals.size()){ - char str2[256] = " ["; - for(unsigned int i = 0; i < physicals.size(); i++){ - char str3[256]; - sprintf(str3, "%d", physicals[i]); - if(i) strcat(str2, " "); - strcat(str2, str3); - } - strcat(str2, "]"); - strcat(str, str2); - } - return std::string(str); - } + virtual std::string getInfoString(); // Returns a type-specific additional information string virtual std::string getAdditionalInfoString() { return std::string(""); } diff --git a/Geo/GVertex.cpp b/Geo/GVertex.cpp index 80f878273c9c6c24825242ebfdce521c6b0eec77..82a242cfd1d98a530131759ae7275f9ca51c2bb1 100644 --- a/Geo/GVertex.cpp +++ b/Geo/GVertex.cpp @@ -10,3 +10,17 @@ void GVertex::delEdge(GEdge *e) { l_edges.erase(std::find(l_edges.begin(), l_edges.end(), e)); } + +std::string GVertex::getAdditionalInfoString() +{ + char str[256]; + sprintf(str, "{%g,%g,%g", x(), y(), z()); + double lc = prescribedMeshSizeAtVertex(); + if(lc > 0.){ + char str2[256]; + sprintf(str2, ",%g", lc); + strcat(str, str2); + } + strcat(str, "}"); + return std::string(str); +} diff --git a/Geo/GVertex.h b/Geo/GVertex.h index 8cc48593e2e15947a69fd3aafae14c3a489a22ca..49034651fa98b890c3ef32378d8dfc79dbfd98e5 100644 --- a/Geo/GVertex.h +++ b/Geo/GVertex.h @@ -8,7 +8,10 @@ // A model vertex class GVertex : public GEntity { -public: + protected: + std::list<GEdge*> l_edges; + + public: GVertex(GModel *m, int tag) : GEntity (m, tag) { } @@ -27,22 +30,7 @@ public: virtual GeomType geomType() const {return Point;} virtual double prescribedMeshSizeAtVertex() const {return 0;} virtual SBoundingBox3d bounds(){ return SBoundingBox3d(SPoint3(x(), y(), z())); } - virtual std::string getAdditionalInfoString() - { - char str[256]; - sprintf(str, "{%g,%g,%g", x(), y(), z()); - double lc = prescribedMeshSizeAtVertex(); - if(lc > 0.){ - char str2[256]; - sprintf(str2, ",%g", lc); - strcat(str, str2); - } - strcat(str, "}"); - return std::string(str); - } - - protected: - std::list<GEdge*> l_edges; + virtual std::string getAdditionalInfoString(); }; #endif diff --git a/Geo/Makefile b/Geo/Makefile index a941aba4abefc93a66698c40fff953fbdf23bd3f..e6a86c29551b4f30594eea697f68fb749c15f974 100644 --- a/Geo/Makefile +++ b/Geo/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.89 2006-08-13 02:46:53 geuzaine Exp $ +# $Id: Makefile,v 1.90 2006-08-13 03:23:44 geuzaine Exp $ # # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle # @@ -37,6 +37,7 @@ SRC = CAD.cpp \ ExtrudeParams.cpp \ Geo.cpp \ GeoUtils.cpp \ + GEntity.cpp\ GVertex.cpp\ GEdge.cpp\ GFace.cpp\ @@ -125,6 +126,9 @@ GeoUtils.o: GeoUtils.cpp ../Common/Gmsh.h ../Common/Message.h \ ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h ExtrudeParams.h \ ../Numeric/Numeric.h # 1 "/Users/geuzaine/.gmsh/Geo//" +GEntity.o: GEntity.cpp GEntity.h Range.h SPoint3.h SBoundingBox3d.h \ + MVertex.h ../Common/GmshDefines.h +# 1 "/Users/geuzaine/.gmsh/Geo//" 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//"