From 13ad8d0ae4d638c7f3fe6c86fadafd308c8c486a Mon Sep 17 00:00:00 2001
From: Amaury Johnan <amjohnen@gmail.com>
Date: Tue, 17 May 2016 14:13:13 +0000
Subject: [PATCH] scaling tolerance by CTX::instance()->lc when
 establishingcorrespondence of node between periodic surfaces

---
 Geo/GFace.cpp | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/Geo/GFace.cpp b/Geo/GFace.cpp
index c2ba9efc11..26a3f83b63 100644
--- a/Geo/GFace.cpp
+++ b/Geo/GFace.cpp
@@ -1495,7 +1495,7 @@ void GFace::relocateMeshVertices()
   }
 }
 
-void GFace::setMeshMaster(GFace* master,const std::vector<double>& tfo)
+void GFace::setMeshMaster(GFace* master, const std::vector<double>& tfo)
 {
   std::list<GEdge*>::iterator eIter;
   std::list<GVertex*>::iterator vIter;
@@ -1591,18 +1591,16 @@ void GFace::setMeshMaster(GFace* master,const std::vector<double>& tfo)
     for (;lvIter!=l_vertices.end();++lvIter) {
 
       SPoint3 xyz((*lvIter)->x(),(*lvIter)->y(),(*lvIter)->z());
-      SVector3 distTfo = xyz - xyzTfo;
-      SVector3 distOri = xyz - xyzOri;
-
-      if (distTfo.norm() < CTX::instance()->geom.tolerance) {
+      SVector3 dist = xyz - xyzTfo;
 
+      if (dist.norm() < CTX::instance()->geom.tolerance * CTX::instance()->lc) {
         l_vertex = *lvIter;
         break;
       }
     }
 
     if (l_vertex==NULL) {
-      Msg::Error("Was not able to find corresponding node for %d "
+      Msg::Error("Was not able to find corresponding node %d "
                  "for periodic connection of surface %d to %d "
                  "using the specified transformation",
                  m_vertex->tag(),master->tag(),tag());
-- 
GitLab