diff --git a/CMakeLists.txt b/CMakeLists.txt index ab89bf5dc848dc4b17846ec90eaa391bc9961392..8151df8d5e695a0cffbc4f03e26ccd744ca14788 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -220,7 +220,7 @@ if(ENABLE_BLAS_LAPACK) # on Linux also try to find ATLAS without a Fortran compiler, # because cmake ships with a buggy FindBLAS e.g. on Ubuntu Lucid # Lynx - set(ATLAS_LIBS_REQUIRED lapack f77blas atlas) + set(ATLAS_LIBS_REQUIRED lapack f77blas cblas atlas) find_all_libraries(LAPACK_LIBRARIES ATLAS_LIBS_REQUIRED "" "") if(LAPACK_LIBRARIES) set_config_option(HAVE_BLAS "Blas(ATLAS)") diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp index 98b7480935d8aafa895babf09cdda07e334e2685..f39bc99d97ffa34eb7028224e3d131dce79281b5 100644 --- a/Common/OpenFile.cpp +++ b/Common/OpenFile.cpp @@ -216,16 +216,12 @@ void ParseString(std::string str) } } -static void SetProjectName(std::string fileName) -{ - GModel::current()->setFileName(fileName); - GModel::current()->setName(SplitFileName(fileName)[1]); -} - int MergeFile(std::string fileName, bool warnIfMissing) { - if(GModel::current()->getName() == "") - SetProjectName(fileName); + if(GModel::current()->getName() == ""){ + GModel::current()->setFileName(fileName); + GModel::current()->setName(SplitFileName(fileName)[1]); + } #if defined(HAVE_FLTK) if(FlGui::available()) @@ -260,7 +256,7 @@ int MergeFile(std::string fileName, bool warnIfMissing) if(SystemCall(std::string("gunzip -c ") + fileName + " > " + noExt)) Msg::Error("Failed to uncompress `%s': check directory permissions", fileName.c_str()); - SetProjectName(noExt); + GModel::current()->setFileName(noExt); return MergeFile(noExt); } } @@ -422,7 +418,8 @@ void ClearProject() for(int i = GModel::list.size() - 1; i >= 0; i--) delete GModel::list[i]; new GModel(); - SetProjectName(CTX::instance()->defaultFileName); + GModel::current()->setFileName(CTX::instance()->defaultFileName); + GModel::current()->setName(""); #if defined(HAVE_FLTK) if(FlGui::available()){ FlGui::instance()->setGraphicTitle(GModel::current()->getFileName()); diff --git a/Geo/GModelFactory.h b/Geo/GModelFactory.h index ae3f340e0e40b765aca20d1e39b1693926d0f7e5..79172fedcab76e5e7a300af961e9660a2254d86d 100644 --- a/Geo/GModelFactory.h +++ b/Geo/GModelFactory.h @@ -19,7 +19,7 @@ class GModel; // Abstract CAD creation factory. class GModelFactory { public: - GModelFactory (){} + GModelFactory(){} virtual ~GModelFactory(){} // brep primitives @@ -33,10 +33,10 @@ class GModelFactory { virtual GEdge *addCircleArc(GModel *gm, const arcCreationMethod &method, GVertex *start, GVertex *end, const SPoint3 &aPoint) = 0; - virtual GEdge *addSpline (GModel *gm,const splineType &type, - GVertex *start, - GVertex *end, - std::vector<std::vector<double> > controlPoints) = 0; + virtual GEdge *addSpline(GModel *gm,const splineType &type, + GVertex *start, + GVertex *end, + std::vector<std::vector<double> > controlPoints) = 0; virtual GEdge *addNURBS(GModel *gm, GVertex *start, GVertex *end, std::vector<std::vector<double> > controlPoints, std::vector<double> knots, @@ -46,15 +46,17 @@ class GModelFactory { // this one tries to build a model face with one single list // of faces. If boundaries are co-planar, then it's a plane, // otherwise, we tru ruled, sweep or other kind of surfaces - virtual std::vector<GFace *> addRuledFaces (GModel *gm, std::vector<std::vector<GEdge *> > edges) = 0; - virtual GFace * addFace (GModel *gm, std::vector<GEdge *> edges, std::vector< std::vector<double > > points) = 0; - virtual GFace * addPlanarFace (GModel *gm, std::vector<std::vector<GEdge *> > edges) = 0; + virtual std::vector<GFace *> addRuledFaces(GModel *gm, + std::vector<std::vector<GEdge *> > edges) = 0; + virtual GFace *addFace(GModel *gm, std::vector<GEdge *> edges, + std::vector< std::vector<double > > points) = 0; + virtual GFace *addPlanarFace(GModel *gm, std::vector<std::vector<GEdge *> > edges) = 0; // sweep stuff virtual GEntity *revolve(GModel *gm, GEntity*, std::vector<double> p1, std::vector<double> p2, double angle) = 0; virtual GEntity *extrude(GModel *gm, GEntity*, std::vector<double> p1, std::vector<double> p2) = 0; - virtual GEntity* addPipe (GModel *gm, GEntity *base, std::vector<GEdge *> wire) = 0; + virtual GEntity *addPipe(GModel *gm, GEntity *base, std::vector<GEdge *> wire) = 0; // solid primitives virtual GEntity *addSphere(GModel *gm, double cx, double cy, double cz, @@ -91,15 +93,15 @@ class GModelFactory { class OCCFactory : public GModelFactory { public: - OCCFactory (){} - GVertex *addVertex (GModel *gm,double x, double y, double z, double lc); - virtual GEdge *addLine (GModel *gm,GVertex *v1, GVertex *v2); - GEdge *addCircleArc (GModel *gm,const arcCreationMethod &method, - GVertex *start, GVertex *end, - const SPoint3 &aPoint); - GEdge *addSpline (GModel *gm,const splineType &type, - GVertex *start, GVertex *end, - std::vector<std::vector<double> > controlPoints); + OCCFactory(){} + GVertex *addVertex(GModel *gm,double x, double y, double z, double lc); + virtual GEdge *addLine(GModel *gm,GVertex *v1, GVertex *v2); + GEdge *addCircleArc(GModel *gm,const arcCreationMethod &method, + GVertex *start, GVertex *end, + const SPoint3 &aPoint); + GEdge *addSpline(GModel *gm,const splineType &type, + GVertex *start, GVertex *end, + std::vector<std::vector<double> > controlPoints); GEdge *addNURBS(GModel *gm, GVertex *start, GVertex *end, std::vector<std::vector<double> > controlPoints, @@ -108,15 +110,16 @@ class OCCFactory : public GModelFactory { std::vector<int> multiplicity); GEntity *revolve(GModel *gm, GEntity*,std::vector<double> p1, std::vector<double> p2, double angle); - GEntity *extrude (GModel *gm, GEntity*,std::vector<double> p1, - std::vector<double> p2); - GEntity* addPipe (GModel *gm, GEntity *base, std::vector<GEdge *> wire); + GEntity *extrude(GModel *gm, GEntity*,std::vector<double> p1, + std::vector<double> p2); + GEntity *addPipe(GModel *gm, GEntity *base, std::vector<GEdge *> wire); GEntity *addSphere(GModel *gm,double cx, double cy, double cz, double radius); GEntity *addCylinder(GModel *gm,std::vector<double> p1, std::vector<double> p2, double radius); - std::vector<GFace *> addRuledFaces (GModel *gm, std::vector<std::vector<GEdge *> > edges); - GFace * addFace (GModel *gm, std::vector<GEdge *> edges, std::vector< std::vector<double > > points); - GFace * addPlanarFace (GModel *gm, std::vector<std::vector<GEdge *> > edges); + std::vector<GFace *> addRuledFaces(GModel *gm, std::vector<std::vector<GEdge *> > edges); + GFace *addFace(GModel *gm, std::vector<GEdge *> edges, + std::vector< std::vector<double > > points); + GFace *addPlanarFace(GModel *gm, std::vector<std::vector<GEdge *> > edges); GEntity *addTorus(GModel *gm,std::vector<double> p1, std::vector<double> p2, double radius1, double radius2); GEntity *addBlock(GModel *gm,std::vector<double> p1, std::vector<double> p2); diff --git a/Geo/GModelIO_Geo.cpp b/Geo/GModelIO_Geo.cpp index c15ee550947e94eb54e7268c7e74eac194995a50..8c5d0c15a6665ad62f1786363a1eb2cdcee84573 100644 --- a/Geo/GModelIO_Geo.cpp +++ b/Geo/GModelIO_Geo.cpp @@ -39,9 +39,7 @@ void GModel::_deleteGEOInternals() int GModel::readGEO(const std::string &name) { ParseFile(name, true); - GModel *newModel=GModel::current(); - newModel->setFileName(name); - return newModel->importGEOInternals(); + return GModel::current()->importGEOInternals(); } int GModel::exportDiscreteGEOInternals() diff --git a/Geo/GModelIO_Mesh.cpp b/Geo/GModelIO_Mesh.cpp index 1a4c13a7d9556b5b62b6914be84e1818fad96495..31ddc532a0f9dc3fdf6bfebe3b2adc2054007095 100644 --- a/Geo/GModelIO_Mesh.cpp +++ b/Geo/GModelIO_Mesh.cpp @@ -171,7 +171,7 @@ int GModel::readMSH(const std::string &name) Msg::Error("Unable to open file '%s'", name.c_str()); return 0; } - setFileName(name); + char str[256] = "XXX"; double version = 1.0; bool binary = false, swap = false, postpro = false;