Skip to content
Snippets Groups Projects
Commit 81f6beea authored by Amaury Johnen's avatar Amaury Johnen
Browse files

update of plugin AnalyseCurvedMesh. Can now compute metric. Interface improved.

parent 016a5fdf
No related branches found
No related tags found
No related merge requests found
......@@ -468,11 +468,11 @@ void MElement::getSignedJacobian(fullVector<double> &jacobian, int o)
getJacobianFuncSpace(o)->getSignedJacobian(nodesXYZ,jacobian);
}
void MElement::getNodesCoord(fullMatrix<double> &nodesXYZ)
void MElement::getNodesCoord(fullMatrix<double> &nodesXYZ) const
{
const int numNodes = getNumShapeFunctions();
for (int i = 0; i < numNodes; i++) {
MVertex *v = getShapeFunctionNode(i);
const MVertex *v = getShapeFunctionNode(i);
nodesXYZ(i,0) = v->x();
nodesXYZ(i,1) = v->y();
nodesXYZ(i,2) = v->z();
......
......@@ -272,7 +272,7 @@ class MElement
double jac[3][3]; return getJacobian(u, v, w, jac);
}
void getSignedJacobian(fullVector<double> &jacobian, int o = -1);
void getNodesCoord(fullMatrix<double> &nodesXYZ);
void getNodesCoord(fullMatrix<double> &nodesXYZ) const;
virtual int getNumShapeFunctions() const{ return getNumVertices(); }
virtual int getNumPrimaryShapeFunctions() { return getNumPrimaryVertices(); }
virtual const MVertex *getShapeFunctionNode(int i) const{ return getVertex(i); }
......
This diff is collapsed.
......@@ -7,7 +7,10 @@
#define _ANALYSECURVEDMESH_H_
#include "Plugin.h"
#include "JacobianBasis.h"
#include "MetricBasis.h"
#include "MElement.h"
#include <vector>
extern "C"
......@@ -15,41 +18,71 @@ extern "C"
GMSH_Plugin *GMSH_RegisterAnalyseCurvedMeshPlugin();
}
class CurvedMeshPluginData
{
private:
MElement *_el;
double _minJ, _maxJ, _minR;
public:
CurvedMeshPluginData(MElement *e,
double minJ = 2,
double maxJ = 0,
double minR = -1)
: _el(e), _minJ(minJ), _maxJ(maxJ), _minR(minR) {}
void setMinR(double r) {_minR = r;}
MElement* element() {return _el;}
double minJ() {return _minJ;}
double maxJ() {return _maxJ;}
double minR() {return _minR;}
};
class GMSH_AnalyseCurvedMeshPlugin : public GMSH_PostPlugin
{
private :
int _dim;
GModel *_m;
int _maxDepth;
double _jacBreak, _bezBreak, _tol;
int _numAnalysedEl;
int _numInvalid, _numValid, _numUncertain;
double _min_pJmin, _avg_pJmin;
double _min_ratioJ, _avg_ratioJ;
public :
GMSH_AnalyseCurvedMeshPlugin(){}
std::string getName() const { return "AnalyseCurvedMesh"; }
std::string getShortHelp() const {
return "Check validity of elements and/or compute min&max of the jacobian";
}
std::string getHelp() const;
std::string getAuthor() const { return "Amaury Johnen"; }
int getNbOptions() const;
StringXNumber *getOption(int);
PView *execute(PView *);
void checkValidity(MElement *const *, int numEl, std::vector<MElement*> &invalids);
//void storeJMin(MElement *const *, int numEl, std::map<int, std::vector<double> > &data);
private :
void checkValidity(int toDo);
void computeMinMax(std::map<int, std::vector<double> > *data = 0);
void computeMinMax(MElement *const *, int numEl, std::map<int, std::vector<double> > *data = 0);
int subDivision(const JacobianBasis *, const fullVector<double>&, int depth);
void hideValid_ShowInvalid(std::vector<MElement*> &invalids);
private :
int _dim;
GModel *_m;
double _threshold, _tol;
int _numPView, _computeMetric;
bool _recompute;
bool _computedR3D, _computedR2D;
bool _computedJ3D, _computedJ2D, _computedJ1D;
bool _1PViewJ, _2PViewJ, _1PViewR, _2PViewR;
bool _msgHide;
std::vector<CurvedMeshPluginData> _data;
public :
GMSH_AnalyseCurvedMeshPlugin() {
_computedR3D = false;
_computedR2D = false;
_computedJ3D = false;
_computedJ2D = false;
_computedJ1D = false;
_msgHide = true;
_1PViewJ = false;
_2PViewJ = false;
_1PViewR = false;
_2PViewR = false;
}
std::string getName() const { return "AnalyseCurvedMesh"; }
std::string getShortHelp() const {
return "Compute bounds on Jacobian and metric quality.";
}
std::string getHelp() const;
std::string getAuthor() const { return "Amaury Johnen"; }
int getNbOptions() const;
StringXNumber *getOption(int);
PView *execute(PView *);
private :
void _computeMinMaxJandValidity();
void _computeMinMaxJandValidity(MElement *const *, int numEl);
void _computeMinR();
bool _hideWithThreshold();
void _printStatMetric();
void _printStatJacobian();
};
#endif
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