From 6184877bd404c2536a2c1d252b3d130623d14806 Mon Sep 17 00:00:00 2001
From: Francois Henrotte <francois.henrotte@ulg.ac.be>
Date: Tue, 19 Feb 2013 15:09:14 +0000
Subject: [PATCH] add a gmsh option smoothCrossField

---
 Common/Context.h        | 2 +-
 Common/DefaultOptions.h | 2 ++
 Common/GmshSocket.h     | 1 +
 Common/Options.cpp      | 7 +++++++
 Common/Options.h        | 1 +
 5 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/Common/Context.h b/Common/Context.h
index f18ea0054d..5e9b0f3e1c 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -19,7 +19,7 @@ struct contextMeshOptions {
   int points, lines, triangles, quadrangles, tetrahedra, hexahedra, prisms, pyramids;
   int surfacesEdges, surfacesFaces, volumesEdges, volumesFaces, numSubEdges;
   int pointsNum, linesNum, surfacesNum, volumesNum, qualityType, labelType;
-  int optimize, optimizeNetgen, optimizeLloyd, refineSteps, remove4triangles;
+  int optimize, optimizeNetgen, optimizeLloyd, smoothCrossField, refineSteps, remove4triangles;
   double normals, tangents, explode, angleSmoothNormals, allowSwapEdgeAngle;
   double mshFileVersion, mshFilePartitioned, pointSize, lineWidth;
   double qualityInf, qualitySup, radiusInf, radiusSup;
diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 3417beddf0..a0a4327b06 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -833,6 +833,8 @@ StringXNumber MeshOptions_Number[] = {
     "Apply Bunin optimization on quad meshes (the parameter is the maximal size of a cavity that may be remeshed)" },
   { F|O, "Lloyd" , opt_mesh_lloyd , 0. ,
     "Apply lloyd optimization on surface meshes" },
+  { F|O, "SmoothCrossField" , opt_mesh_smooth_cross_field , 0. ,
+    "Apply n barycentric smoothing passes to the cross field" },
 
   { F|O, "CgnsImportOrder" , opt_mesh_cgns_import_order , 1. ,
    "Enable the creation of high-order mesh from CGNS structured meshes."
diff --git a/Common/GmshSocket.h b/Common/GmshSocket.h
index b153c98983..8435237e7b 100644
--- a/Common/GmshSocket.h
+++ b/Common/GmshSocket.h
@@ -78,6 +78,7 @@ class GmshSocket{
     GMSH_PARAMETER_QUERY = 24,
     GMSH_PARAM_QUERY_ALL = 25,
     GMSH_PARAM_QUERY_END = 26,
+    GMSH_CONNECT         = 27,
     GMSH_SPEED_TEST      = 30,
     GMSH_OPTION_1        = 100,
     GMSH_OPTION_2        = 101,
diff --git a/Common/Options.cpp b/Common/Options.cpp
index 5af7a5f371..e57cb6acd5 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -5167,6 +5167,13 @@ double opt_mesh_lloyd(OPT_ARGS_NUM)
   return CTX::instance()->mesh.optimizeLloyd;
 }
 
+double opt_mesh_smooth_cross_field(OPT_ARGS_NUM)
+{
+  if(action & GMSH_SET)
+    CTX::instance()->mesh.smoothCrossField = (int)val;
+  return CTX::instance()->mesh.smoothCrossField;
+}
+
 double opt_mesh_bdf_field_format(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET){
diff --git a/Common/Options.h b/Common/Options.h
index 17bc72829a..834016f612 100644
--- a/Common/Options.h
+++ b/Common/Options.h
@@ -406,6 +406,7 @@ double opt_mesh_partition_tri_weight(OPT_ARGS_NUM);
 double opt_mesh_binary(OPT_ARGS_NUM);
 double opt_mesh_bunin(OPT_ARGS_NUM);
 double opt_mesh_lloyd(OPT_ARGS_NUM);
+double opt_mesh_smooth_cross_field(OPT_ARGS_NUM);
 double opt_mesh_bdf_field_format(OPT_ARGS_NUM);
 double opt_mesh_nb_smoothing(OPT_ARGS_NUM);
 double opt_mesh_algo2d(OPT_ARGS_NUM);
-- 
GitLab