diff --git a/Solver/eigenSolver.h b/Solver/eigenSolver.h index 1610d8274a41b14578d7cf9047f5f6940f518bb4..ae995791d0955b9daf790844b58d27942e7266d3 100644 --- a/Solver/eigenSolver.h +++ b/Solver/eigenSolver.h @@ -15,7 +15,6 @@ #if defined(HAVE_SLEPC) #include "linearSystemPETSc.h" -#include <slepc.h> class eigenSolver{ private: diff --git a/contrib/HighOrderMeshOptimizer/OptHomRun.cpp b/contrib/HighOrderMeshOptimizer/OptHomRun.cpp index 7efd16762bfb796af7f293140f227f56cba66a1f..4bf9c0b05806233bdabc9c1bad43198ea9b06d38 100644 --- a/contrib/HighOrderMeshOptimizer/OptHomRun.cpp +++ b/contrib/HighOrderMeshOptimizer/OptHomRun.cpp @@ -221,7 +221,7 @@ static void calcVertex2Elements(int dim, GEntity *entity, std::map<MVertex*, std static std::vector<std::pair<std::set<MElement*>, std::set<MVertex*> > > getConnectedBlobs( const std::map<MVertex*, std::vector<MElement *> > &vertex2elements, - const std::set<MElement*> &badElements, int depth, const double distFactor) + const std::set<MElement*> &badElements, int depth, const double distFactor, bool weakMerge = false) { OptHomMessage("Starting blob generation from %i bad elements...",badElements.size()); @@ -242,7 +242,7 @@ static std::vector<std::pair<std::set<MElement*>, std::set<MVertex*> > > getConn std::set<MElement*> &blob = primBlobs[iB]; for(std::set<MElement*>::iterator itEl = blob.begin(); itEl != blob.end(); ++itEl) { std::set<int> &blobInd = tags[*itEl]; - if (!blobInd.empty()) { + if (!blobInd.empty() && (badElements.find(*itEl) != badElements.end() || !weakMerge)) { for (std::set<int>::iterator itBS = blobInd.begin(); itBS != blobInd.end(); ++itBS) blobConnect[*itBS].insert(iB); blobConnect[iB].insert(blobInd.begin(), blobInd.end()); } @@ -288,7 +288,7 @@ static std::vector<std::pair<std::set<MElement*>, std::set<MVertex*> > > getConn static void optimizeConnectedBlobs(const std::map<MVertex*, std::vector<MElement *> > &vertex2elements, std::set<MElement*> &badasses, - OptHomParameters &p, int samples) + OptHomParameters &p, int samples, bool weakMerge = false) { p.SUCCESS = 1; @@ -296,7 +296,7 @@ static void optimizeConnectedBlobs(const std::map<MVertex*, std::vector<MElement p.maxJac = -1.e100; std::vector<std::pair<std::set<MElement*>, std::set<MVertex*> > > toOptimize = - getConnectedBlobs(vertex2elements, badasses, p.nbLayers, p.distanceFactor); + getConnectedBlobs(vertex2elements, badasses, p.nbLayers, p.distanceFactor, weakMerge); //#pragma omp parallel for schedule(dynamic, 1) for (int i = 0; i < toOptimize.size(); ++i) { @@ -515,6 +515,11 @@ static void optimizeOneByOne(const std::map<MVertex*, std::vector<MElement *> > //opt->mesh.writeMSH(ossI1.str().c_str()); success = opt->optimize(p.weightFixed, p.weightFree, p.BARRIER_MIN, p.BARRIER_MAX, false, samples, p.itMax, p.optPassMax); + if (success >= 0 && p.BARRIER_MIN_METRIC > 0) { + OptHomMessage("Jacobian optimization succeed, starting svd optimization"); + success = opt->optimize(p.weightFixed, p.weightFree, p.BARRIER_MIN_METRIC, p.BARRIER_MAX, + true, samples, p.itMax, p.optPassMax); + } } else { OptHomMessage("Primary blob %i did not break new elements, no correction needed", iBadEl); @@ -775,7 +780,8 @@ void HighOrderMeshOptimizer (GModel *gm, OptHomParameters &p) } } - if (p.strategy == 0) optimizeConnectedBlobs(vertex2elements, badasses, p, samples); + if (p.strategy == 0) optimizeConnectedBlobs(vertex2elements, badasses, p, samples, false); + else if (p.strategy == 2) optimizeConnectedBlobs(vertex2elements, badasses, p, samples, true); else optimizeOneByOne(vertex2elements, badasses, p, samples); double DTF = Cpu()-tf1; diff --git a/wrappers/gmshpy/CMakeLists.txt b/wrappers/gmshpy/CMakeLists.txt index 56e3aa4f697ba5735743818df9e09ebf65c9dc35..69c11df7febbfa93fd6d45d74482363ee7c18a4d 100644 --- a/wrappers/gmshpy/CMakeLists.txt +++ b/wrappers/gmshpy/CMakeLists.txt @@ -127,6 +127,7 @@ set (GMSH_PYTHON_EXTRA_INCLUDE Fltk/FlGui.h Solver/frameSolver.h Solver/functionSpace.h + Solver/eigenSolver.h Mesh/Generator.h Geo/GeomMeshMatcher.h Geo/GFaceCompound.h diff --git a/wrappers/gmshpy/gmshSolver.i b/wrappers/gmshpy/gmshSolver.i index 61e1a2da181ac8e045fccd0d7ab4dd4ab7560207..cff31d8144ad39b786325f1f0e0824aee706b8ed 100644 --- a/wrappers/gmshpy/gmshSolver.i +++ b/wrappers/gmshpy/gmshSolver.i @@ -2,6 +2,7 @@ %module gmshSolver %include std_string.i %include std_vector.i +%include std_complex.i %{ #include "GmshConfig.h" @@ -13,6 +14,7 @@ #include "linearSystemCSR.h" #include "linearSystemFull.h" #include "linearSystemPETSc.h" + #include "eigenSolver.h" #endif %} @@ -34,4 +36,5 @@ %include "linearSystemPETSc.h" %template(linearSystemPETScDouble) linearSystemPETSc<double>; #endif +%include "eigenSolver.h" #endif diff --git a/wrappers/gmshpy/setup.py.in b/wrappers/gmshpy/setup.py.in index 1fc75ea0c856cda20acb560adcc69f9afaf5a60f..5e286e45ea4477e2108dffb5b37661b91678a106 100644 --- a/wrappers/gmshpy/setup.py.in +++ b/wrappers/gmshpy/setup.py.in @@ -1,5 +1,5 @@ from distutils.core import setup, Extension -gmshroot = "." +gmshroot = ".." gmshmodules = [${GMSH_PYTHON_MODULES}] setup( name = 'gmshpy',