From 251dd10f556893e9cb60ae00c1153c4f576c8e36 Mon Sep 17 00:00:00 2001
From: Thomas Toulorge <thomas.toulorge@mines-paristech.fr>
Date: Wed, 6 Jun 2012 14:40:55 +0000
Subject: [PATCH] Added metric for isotropic mesh refinement with linear
 interpolation of mesh size in band E

---
 Mesh/meshMetric.cpp | 7 +++++++
 Mesh/meshMetric.h   | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/Mesh/meshMetric.cpp b/Mesh/meshMetric.cpp
index 242d3a52e7..cbf0b6c7ec 100644
--- a/Mesh/meshMetric.cpp
+++ b/Mesh/meshMetric.cpp
@@ -513,6 +513,13 @@ void meshMetric::computeMetric(){
 
       it++;
     }
+    else if (_technique == meshMetric::ISOTROPIC_LINEARINTERP_H){
+      SVector3 gr = grads[ver];
+      double norm = gr.normalize();
+      double h_dist = (signed_dist < _E && signed_dist > _E_moins && norm != 0.0) ? hmin + ((hmax-hmin)/_E)*dist : hmax;  // the charcteristic element size in all directions - linear interp between hmin and hmax
+      H = SMetric3(1./h_dist/h_dist);
+    }
+
 
     if (_technique != meshMetric::EIGENDIRECTIONS && _technique!=meshMetric::EIGENDIRECTIONS_LINEARINTERP_H){
 
diff --git a/Mesh/meshMetric.h b/Mesh/meshMetric.h
index 24f2a9bd10..3433e1ddcb 100644
--- a/Mesh/meshMetric.h
+++ b/Mesh/meshMetric.h
@@ -21,7 +21,7 @@ class STensor3;
 /**Anisotropic mesh size field based on a metric */
 class meshMetric: public Field {
  public:
-  typedef enum {LEVELSET=1,HESSIAN=2, FREY=3, EIGENDIRECTIONS=4, EIGENDIRECTIONS_LINEARINTERP_H=5} MetricComputationTechnique;
+  typedef enum {LEVELSET=1,HESSIAN=2, FREY=3, EIGENDIRECTIONS=4, EIGENDIRECTIONS_LINEARINTERP_H=5, ISOTROPIC_LINEARINTERP_H=6} MetricComputationTechnique;
  private:
   // intersect all metrics added in "setOfMetrics", preserve eigendirections of the "most anisotropic" metric
   void intersectMetrics();
@@ -72,6 +72,7 @@ class meshMetric: public Field {
   //    parameters[4] = thickness of the interface in the negative ls direction (default: =parameters[0] if not specified)
   //    parameters[3] = the required minimum number of elements to represent a circle - used for curvature-based metric (default: = 15)
   // 5: same as 4, except that the transition in band E uses linear interpolation of h, instead of linear interpolation of metric
+  // 6: fct is a LS, metric is isotropic with linear interpolation of h in band E
   void addMetric(int technique, simpleFunction<double> *fct, std::vector<double> parameters);
 
   inline SMetric3 metricAtVertex (MVertex* v) {
-- 
GitLab