Skip to content
Snippets Groups Projects
Commit 7704e57e authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

fix

parent 8b77da7b
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
// See the LICENSE.txt file for license information. Please report all // See the LICENSE.txt file for license information. Please report all
// bugs and problems to the public mailing list <gmsh@onelab.info>. // bugs and problems to the public mailing list <gmsh@onelab.info>.
#include "GmshConfig.h"
#if defined(HAVE_MESH)
#include "AnalyseCurvedMesh.h" #include "AnalyseCurvedMesh.h"
#include "OS.h" #include "OS.h"
#include "Context.h" #include "Context.h"
...@@ -28,6 +32,7 @@ StringXNumber CurvedMeshOptions_Number[] = { ...@@ -28,6 +32,7 @@ StringXNumber CurvedMeshOptions_Number[] = {
{GMSH_FULLRC, "Tolerance", NULL, 1e-3} {GMSH_FULLRC, "Tolerance", NULL, 1e-3}
// tolerance: To be removed when MetricBasis => qualityMeasuresJacobian // tolerance: To be removed when MetricBasis => qualityMeasuresJacobian
}; };
extern "C" extern "C"
{ {
GMSH_Plugin *GMSH_RegisterAnalyseCurvedMeshPlugin() GMSH_Plugin *GMSH_RegisterAnalyseCurvedMeshPlugin()
...@@ -35,14 +40,17 @@ extern "C" ...@@ -35,14 +40,17 @@ extern "C"
return new GMSH_AnalyseCurvedMeshPlugin(); return new GMSH_AnalyseCurvedMeshPlugin();
} }
} }
int GMSH_AnalyseCurvedMeshPlugin::getNbOptions() const int GMSH_AnalyseCurvedMeshPlugin::getNbOptions() const
{ {
return sizeof(CurvedMeshOptions_Number) / sizeof(StringXNumber); return sizeof(CurvedMeshOptions_Number) / sizeof(StringXNumber);
} }
StringXNumber *GMSH_AnalyseCurvedMeshPlugin::getOption(int iopt) StringXNumber *GMSH_AnalyseCurvedMeshPlugin::getOption(int iopt)
{ {
return &CurvedMeshOptions_Number[iopt]; return &CurvedMeshOptions_Number[iopt];
} }
std::string GMSH_AnalyseCurvedMeshPlugin::getHelp() const std::string GMSH_AnalyseCurvedMeshPlugin::getHelp() const
{ {
return "Plugin(AnalyseCurvedMesh) analyse all elements of a given dimension. " return "Plugin(AnalyseCurvedMesh) analyse all elements of a given dimension. "
...@@ -78,7 +86,6 @@ std::string GMSH_AnalyseCurvedMeshPlugin::getHelp() const ...@@ -78,7 +86,6 @@ std::string GMSH_AnalyseCurvedMeshPlugin::getHelp() const
"the validity of the mesh."; "the validity of the mesh.";
} }
// Execution
PView *GMSH_AnalyseCurvedMeshPlugin::execute(PView *v) PView *GMSH_AnalyseCurvedMeshPlugin::execute(PView *v)
{ {
_m = GModel::current(); _m = GModel::current();
...@@ -421,3 +428,5 @@ void GMSH_AnalyseCurvedMeshPlugin::computeMinR(MElement *const *el, ...@@ -421,3 +428,5 @@ void GMSH_AnalyseCurvedMeshPlugin::computeMinR(MElement *const *el,
} }
} }
} }
#endif
...@@ -20,22 +20,20 @@ class data_elementMinMax ...@@ -20,22 +20,20 @@ class data_elementMinMax
private: private:
MElement *_el; MElement *_el;
double _minJ, _maxJ, _minR, _minRR; double _minJ, _maxJ, _minR, _minRR;
public: public:
data_elementMinMax(MElement *e, data_elementMinMax(MElement *e,
double minJ = 2, double minJ = 2,
double maxJ = 0, double maxJ = 0,
double minR = -1, double minR = -1,
double minRR = -1) double minRR = -1)
: _el(e), _minJ(minJ), _maxJ(maxJ), _minR(minR), _minRR(minRR) {} : _el(e), _minJ(minJ), _maxJ(maxJ), _minR(minR), _minRR(minRR) {}
void setMinR(double r) { _minR = r; }
void setMinR(double r) {_minR = r;} void setMinRR(double r) { _minRR = r; }
void setMinRR(double r) {_minRR = r;} MElement* element() { return _el; }
MElement* element() {return _el;} double minJ() { return _minJ; }
double minJ() {return _minJ;} double maxJ() { return _maxJ; }
double maxJ() {return _maxJ;} double minR() { return _minR; }
double minR() {return _minR;} double minRR() { return _minRR; }
double minRR() {return _minRR;}
}; };
class GMSH_AnalyseCurvedMeshPlugin : public GMSH_PostPlugin class GMSH_AnalyseCurvedMeshPlugin : public GMSH_PostPlugin
...@@ -52,7 +50,8 @@ private : ...@@ -52,7 +50,8 @@ private :
std::vector<data_elementMinMax> _data; std::vector<data_elementMinMax> _data;
public : public :
GMSH_AnalyseCurvedMeshPlugin() { GMSH_AnalyseCurvedMeshPlugin()
{
_m = NULL; _m = NULL;
_threshold = _tol = -1; _threshold = _tol = -1;
_computeMetric = -1; _computeMetric = -1;
...@@ -65,7 +64,8 @@ public : ...@@ -65,7 +64,8 @@ public :
_msgHide = true; _msgHide = true;
} }
std::string getName() const { return "AnalyseCurvedMesh"; } std::string getName() const { return "AnalyseCurvedMesh"; }
std::string getShortHelp() const { std::string getShortHelp() const
{
return "Compute bounds on Jacobian and metric quality."; return "Compute bounds on Jacobian and metric quality.";
} }
std::string getHelp() const; std::string getHelp() const;
...@@ -73,10 +73,11 @@ public : ...@@ -73,10 +73,11 @@ public :
int getNbOptions() const; int getNbOptions() const;
StringXNumber *getOption(int); StringXNumber *getOption(int);
PView *execute(PView *); PView *execute(PView *);
void setTol(double tol) {_tol = tol;} void setTol(double tol) { _tol = tol; }
// For testing // For testing
void computeMinJ(MElement *const *el, int numEl, double *minJ, bool *straight) { void computeMinJ(MElement *const *el, int numEl, double *minJ, bool *straight)
{
std::vector<data_elementMinMax> save(_data); std::vector<data_elementMinMax> save(_data);
_data.clear(); _data.clear();
_computeMinMaxJandValidity(el, numEl); _computeMinMaxJandValidity(el, numEl);
...@@ -93,7 +94,8 @@ public : ...@@ -93,7 +94,8 @@ public :
_data = save; _data = save;
} }
void computeMinR(MElement *const *el, int numEl, double *minR, bool *straight); void computeMinR(MElement *const *el, int numEl, double *minR, bool *straight);
void test(MElement *const *el, int numEl, int dim) { void test(MElement *const *el, int numEl, int dim)
{
_tol = 1e-3; _tol = 1e-3;
std::vector<data_elementMinMax> save(_data); std::vector<data_elementMinMax> save(_data);
_data.clear(); _data.clear();
......
...@@ -187,8 +187,6 @@ void PluginManager::registerDefaultPlugins() ...@@ -187,8 +187,6 @@ void PluginManager::registerDefaultPlugins()
("Skin", GMSH_RegisterSkinPlugin())); ("Skin", GMSH_RegisterSkinPlugin()));
allPlugins.insert(std::pair<std::string, GMSH_Plugin*> allPlugins.insert(std::pair<std::string, GMSH_Plugin*>
("MathEval", GMSH_RegisterMathEvalPlugin())); ("MathEval", GMSH_RegisterMathEvalPlugin()));
allPlugins.insert(std::pair<std::string, GMSH_Plugin*>
("AnalyseCurvedMesh", GMSH_RegisterAnalyseCurvedMeshPlugin()));
allPlugins.insert(std::pair<std::string, GMSH_Plugin*> allPlugins.insert(std::pair<std::string, GMSH_Plugin*>
("CurvedBndDist", GMSH_RegisterCurvedBndDistPlugin())); ("CurvedBndDist", GMSH_RegisterCurvedBndDistPlugin()));
allPlugins.insert(std::pair<std::string, GMSH_Plugin*> allPlugins.insert(std::pair<std::string, GMSH_Plugin*>
...@@ -265,6 +263,10 @@ void PluginManager::registerDefaultPlugins() ...@@ -265,6 +263,10 @@ void PluginManager::registerDefaultPlugins()
("ThinLayerFixMesh", GMSH_RegisterThinLayerFixMeshPlugin())); ("ThinLayerFixMesh", GMSH_RegisterThinLayerFixMeshPlugin()));
allPlugins.insert(std::pair<std::string, GMSH_Plugin*> allPlugins.insert(std::pair<std::string, GMSH_Plugin*>
("MeshSubEntities", GMSH_RegisterMeshSubEntitiesPlugin())); ("MeshSubEntities", GMSH_RegisterMeshSubEntitiesPlugin()));
#if defined(HAVE_MESH)
allPlugins.insert(std::pair<std::string, GMSH_Plugin*>
("AnalyseCurvedMesh", GMSH_RegisterAnalyseCurvedMeshPlugin()));
#endif
#if defined(HAVE_REVOROPT) #if defined(HAVE_REVOROPT)
allPlugins.insert(std::pair<std::string, GMSH_Plugin*> allPlugins.insert(std::pair<std::string, GMSH_Plugin*>
("CVTRemesh", GMSH_RegisterCVTRemeshPlugin())); ("CVTRemesh", GMSH_RegisterCVTRemeshPlugin()));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment