From 2f97f76be56b34d45375388068b28380334cd798 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 9 Nov 2007 08:07:53 +0000
Subject: [PATCH] Removed the "search around point" strategy when we provide a
 background mesh.

(Now that we can have several fields, it's much better to specify another default
field for when a search fails.)
---
 Mesh/BackgroundMesh.cpp | 4 ++--
 Mesh/Field.cpp          | 9 ++++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Mesh/BackgroundMesh.cpp b/Mesh/BackgroundMesh.cpp
index ae164591f6..2e75162e0f 100644
--- a/Mesh/BackgroundMesh.cpp
+++ b/Mesh/BackgroundMesh.cpp
@@ -1,4 +1,4 @@
-// $Id: BackgroundMesh.cpp,v 1.27 2007-11-08 19:29:50 geuzaine Exp $
+// $Id: BackgroundMesh.cpp,v 1.28 2007-11-09 08:07:53 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -184,7 +184,7 @@ double BGM_MeshSize(GEntity *ge, double U, double V, double X, double Y, double
 
   double lc;
 
-  if(!lc_field.empty() && !CTX.mesh.constrained_bgmesh){
+  if(l4 < MAX_LC && !CTX.mesh.constrained_bgmesh){
     // use the fields unconstrained by other characteristic lengths
     lc = l4 * CTX.mesh.lc_factor;
   }
diff --git a/Mesh/Field.cpp b/Mesh/Field.cpp
index 8bb2c69339..2c66a453c1 100644
--- a/Mesh/Field.cpp
+++ b/Mesh/Field.cpp
@@ -1,4 +1,4 @@
-// $Id: Field.cpp,v 1.7 2007-09-24 08:14:29 geuzaine Exp $
+// $Id: Field.cpp,v 1.8 2007-11-09 08:07:53 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -268,9 +268,11 @@ double PostViewField::operator()(double x, double y, double z)
   if(view_index < 0 || view_index >= (int)PView::list.size()) return MAX_LC;
 
   double l = 0.;
-  double fact[9] = {0.001, 0.0025, 0.005, 0.0075, 0.01, 0.025, 0.05, 0.075, 0.1};
   if(!octree->searchScalar(x, y, z, &l, 0)){
-    // try really hard to find an element around the point
+    // uncomment the following to try really hard to find an element
+    // around the point
+    /*
+    double fact[9] = {0.001, 0.0025, 0.005, 0.0075, 0.01, 0.025, 0.05, 0.075, 0.1};
     for(int i = 0; i < 9; i++){
       double eps = CTX.lc * fact[i];
       if(octree->searchScalar(x + eps, y, z, &l, 0)) break;
@@ -288,6 +290,7 @@ double PostViewField::operator()(double x, double y, double z)
       if(octree->searchScalar(x - eps, y - eps, z + eps, &l, 0)) break;
       if(octree->searchScalar(x - eps, y + eps, z + eps, &l, 0)) break;
     }
+    */
   }
   if(l <= 0) return MAX_LC;
   return l;
-- 
GitLab