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

global mesh size constraint per entity

parent e349a9c1
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include "SBoundingBox3d.h" #include "SBoundingBox3d.h"
#include "SOrientedBoundingBox.h" #include "SOrientedBoundingBox.h"
#define MAX_LC 1.e22
class GModel; class GModel;
class GVertex; class GVertex;
class GEdge; class GEdge;
...@@ -299,6 +301,9 @@ class GEntity { ...@@ -299,6 +301,9 @@ class GEntity {
// reset the mesh attributes to default values // reset the mesh attributes to default values
virtual void resetMeshAttributes() { return; } virtual void resetMeshAttributes() { return; }
// global mesh size constraint for the entity
virtual double getMeshSize() const { return MAX_LC; }
// number of types of elements // number of types of elements
virtual int getNumElementTypes() const { return 0; } virtual int getNumElementTypes() const { return 0; }
......
...@@ -196,6 +196,7 @@ void GFace::resetMeshAttributes() ...@@ -196,6 +196,7 @@ void GFace::resetMeshAttributes()
meshAttributes.transfiniteSmoothing = -1; meshAttributes.transfiniteSmoothing = -1;
meshAttributes.extrude = 0; meshAttributes.extrude = 0;
meshAttributes.reverseMesh = false; meshAttributes.reverseMesh = false;
meshAttributes.meshSize = MAX_LC;
} }
SBoundingBox3d GFace::bounds() const SBoundingBox3d GFace::bounds() const
......
...@@ -314,12 +314,15 @@ class GFace : public GEntity{ ...@@ -314,12 +314,15 @@ class GFace : public GEntity{
ExtrudeParams *extrude; ExtrudeParams *extrude;
// reverse mesh orientation // reverse mesh orientation
bool reverseMesh; bool reverseMesh;
// global mesh size constraint for the surface
double meshSize;
} meshAttributes ; } meshAttributes ;
int getMeshingAlgo() const; int getMeshingAlgo() const;
void setMeshingAlgo(int); void setMeshingAlgo(int);
int getCurvatureControlParameter () const; int getCurvatureControlParameter () const;
void setCurvatureControlParameter(int); void setCurvatureControlParameter(int);
virtual double getMeshSize() const { return meshAttributes.meshSize; }
struct { struct {
mutable GEntity::MeshGenerationStatus status; mutable GEntity::MeshGenerationStatus status;
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
#include "SPoint2.h" #include "SPoint2.h"
#include "SPoint3.h" #include "SPoint3.h"
#define MAX_LC 1.e22
class MElement; class MElement;
class MPoint; class MPoint;
......
...@@ -273,8 +273,11 @@ double BGM_MeshSize(GEntity *ge, double U, double V, ...@@ -273,8 +273,11 @@ double BGM_MeshSize(GEntity *ge, double U, double V,
if(f) l4 = (*f)(X, Y, Z, ge); if(f) l4 = (*f)(X, Y, Z, ge);
} }
// global lc from entity
double l5 = ge->getMeshSize();
// take the minimum, then constrain by lcMin and lcMax // take the minimum, then constrain by lcMin and lcMax
double lc = std::min(std::min(std::min(l1, l2), l3), l4); double lc = std::min(std::min(std::min(std::min(l1, l2), l3), l4), l5);
lc = std::max(lc, CTX::instance()->mesh.lcMin); lc = std::max(lc, CTX::instance()->mesh.lcMin);
lc = std::min(lc, CTX::instance()->mesh.lcMax); lc = std::min(lc, CTX::instance()->mesh.lcMax);
...@@ -284,12 +287,6 @@ double BGM_MeshSize(GEntity *ge, double U, double V, ...@@ -284,12 +287,6 @@ double BGM_MeshSize(GEntity *ge, double U, double V,
lc = l1; lc = l1;
} }
//Msg::Debug("BGM X,Y,Z=%g,%g,%g L4=%g L3=%g L2=%g L1=%g LC=%g LFINAL=%g DIM =%d ",
//X, Y, Z, l4, l3, l2, l1, lc, lc * CTX::instance()->mesh.lcFactor, ge->dim());
//Emi fix
//if (lc == l1) lc /= 10.;
return lc * CTX::instance()->mesh.lcFactor; return lc * CTX::instance()->mesh.lcFactor;
} }
...@@ -304,7 +301,9 @@ SMetric3 BGM_MeshMetric(GEntity *ge, ...@@ -304,7 +301,9 @@ SMetric3 BGM_MeshMetric(GEntity *ge,
// Element size = min. between default lc and lc from point (if applicable), // Element size = min. between default lc and lc from point (if applicable),
// constrained by lcMin and lcMax // constrained by lcMin and lcMax
double lc = CTX::instance()->lc; double lc = CTX::instance()->lc;
if(CTX::instance()->mesh.lcFromPoints && ge->dim() < 2) lc = std::min(lc, LC_MVertex_PNTS(ge, U, V)); if(CTX::instance()->mesh.lcFromPoints && ge->dim() < 2)
lc = std::min(lc, LC_MVertex_PNTS(ge, U, V));
lc = std::min(lc, ge->getMeshSize());
lc = std::max(lc, CTX::instance()->mesh.lcMin); lc = std::max(lc, CTX::instance()->mesh.lcMin);
lc = std::min(lc, CTX::instance()->mesh.lcMax); lc = std::min(lc, CTX::instance()->mesh.lcMax);
if(lc <= 0.){ if(lc <= 0.){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment