diff --git a/Common/GmshMessage.cpp b/Common/GmshMessage.cpp index 0ed264c8ed3430386ffdec40404d5b8caf7e36d0..b019e280499f4a63960ee9924549754b4c5b5fac 100644 --- a/Common/GmshMessage.cpp +++ b/Common/GmshMessage.cpp @@ -23,6 +23,10 @@ #include <petsc.h> #endif +#if defined(HAVE_SLEPC) +#include <slepc.h> +#endif + #if defined(HAVE_FLTK) #include <FL/fl_ask.H> #include "FlGui.h" @@ -69,6 +73,9 @@ void Msg::Init(int argc, char **argv) #endif #if defined(HAVE_PETSC) PetscInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL); +#endif +#if defined(HAVE_SLEPC) + SlepcInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL); #endif time_t now; time(&now); @@ -91,6 +98,9 @@ void Msg::Exit(int level) // this calls the annoying "report this crash to the mothership" // window... so just exit! if(level){ +#if defined(HAVE_SLEPC) + SlepcFinalize(); +#endif #if defined(HAVE_PETSC) PetscFinalize(); #endif @@ -113,6 +123,9 @@ void Msg::Exit(int level) } #endif +#if defined(HAVE_SLEPC) + SlepcFinalize(); +#endif #if defined(HAVE_PETSC) PetscFinalize(); #endif diff --git a/Geo/GModelIO_Mesh.cpp b/Geo/GModelIO_Mesh.cpp index ee25d5e1feae3becee8adce1c70b9683fd7ccc7e..c69e7f49b0c8b75ec5c7bc43a7d1f48f61d3a679 100644 --- a/Geo/GModelIO_Mesh.cpp +++ b/Geo/GModelIO_Mesh.cpp @@ -871,12 +871,9 @@ int GModel::readSTL(const std::string &name, double tolerance) char buffer[256]; if(!fgets(buffer, sizeof(buffer), fp)) return 0; - // workaround for stupid tools which use "solid" to start their - // binary files - if(!strncmp(buffer, "solid 3D-DOCTOR", 15)) buffer[0] = 'z'; - if(!strncmp(buffer, "solid binary STL from Solid Edge", 32)) buffer[0] = 'z'; + bool binary = strncmp(buffer, "solid", 5); - if(!strncmp(buffer, "solid", 5)){ + if(!binary){ // ASCII STL points.resize(1); while(!feof(fp)) { @@ -909,9 +906,20 @@ int GModel::readSTL(const std::string &name, double tolerance) if(!fgets(buffer, sizeof(buffer), fp)) break; } } - else{ - // Binary STL - Msg::Info("Mesh is in binary format"); + + bool empty = true; + for(unsigned int i = 0; i < points.size(); i++){ + if(points[i].size()){ + empty = false; + break; + } + } + if(empty) points.clear(); + + // try binary read even with wrong header if file is empty + if(binary || empty){ + if(binary) Msg::Info("Mesh is in binary format"); + else Msg::Info("Empty ASCII file or bad ASCII header: trying binary read"); rewind(fp); while(!feof(fp)) { char header[80]; diff --git a/Solver/dofManager.h b/Solver/dofManager.h index 44cb399f2be1e773fb13c8efe2ad6786ff5295a3..525281004bd4cc699dbbf4ed6ba27da37b66fbc5 100644 --- a/Solver/dofManager.h +++ b/Solver/dofManager.h @@ -137,7 +137,6 @@ class dofManager{ } } } - inline void assemble(std::vector<Dof> &R, std::vector<Dof> &C, fullMatrix<dataMat> &m) { if (!_current->isAllocated()) _current->allocate(unknown.size()); @@ -170,7 +169,6 @@ class dofManager{ } } } - inline void assemble(std::vector<Dof> &R, fullMatrix<dataMat> &m) { if (!_current->isAllocated()) _current->allocate(unknown.size()); @@ -199,7 +197,6 @@ class dofManager{ } } } - inline void assemble(int entR, int typeR, int entC, int typeC, const dataMat &value) { assemble(Dof(entR, typeR), Dof(entC, typeC), value); @@ -237,6 +234,10 @@ class dofManager{ _current->zeroMatrix(); _current->zeroRightHandSide(); } + linearSystem<dataMat> *getLinearSystem(std::string &name) + { + return _linearSystems[name]; + } }; #endif diff --git a/Solver/linearSystemPETSc.h b/Solver/linearSystemPETSc.h index ce3dc4b648432bd01c7b0497afae0ebebd361b90..c86bf36033693f7273fd412bc5c637672ddea97d 100644 --- a/Solver/linearSystemPETSc.h +++ b/Solver/linearSystemPETSc.h @@ -158,6 +158,7 @@ class linearSystemPETSc : public linearSystem<scalar> { _try(KSPGetIterationNumber(ksp, &its)); Msg::Info("%d iterations", its); } + Mat &getMatrix(){ return _a; } }; #else