From 6ccaab77a63fca7d9270f85c975cb43e8f3b1042 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 12 Aug 2016 15:43:53 +0000
Subject: [PATCH] better (?) View.ShowTime options

---
 Common/Context.cpp          |  2 +-
 Common/DefaultOptions.h     |  4 +--
 Common/Options.cpp          |  2 +-
 Fltk/optionWindow.cpp       | 10 +++---
 Graphics/drawScales.cpp     | 63 +++++++++++++++++++++++++++++++------
 doc/texinfo/opt_mesh.texi   |  2 +-
 doc/texinfo/opt_plugin.texi | 51 +++++++++++++++++++++---------
 doc/texinfo/opt_print.texi  | 20 ++++++++++++
 doc/texinfo/opt_solver.texi |  2 +-
 doc/texinfo/opt_view.texi   |  2 +-
 10 files changed, 123 insertions(+), 35 deletions(-)

diff --git a/Common/Context.cpp b/Common/Context.cpp
index 76b59c1176..2374eeb9d9 100644
--- a/Common/Context.cpp
+++ b/Common/Context.cpp
@@ -41,7 +41,7 @@ CTX::CTX() : gamepad(0)
     homeDir += "/";
 
   batch = batchAfterMesh = 0;
-  meshDiscrete=0;
+  meshDiscrete = 0;
   outputFileName = "";
   bgmFileName = "";
   createAppendMeshStatReport = 0;
diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 6f60ba5a82..43c88e12bd 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -1609,8 +1609,8 @@ StringXNumber ViewOptions_Number[] = {
   { F|O, "ShowScale" , opt_view_show_scale , 1. ,
     "Show value scale?" },
   { F|O, "ShowTime" , opt_view_show_time , 3. ,
-    "Time display mode (0=hidden, 1=time value if multi-step, 2=time value always, "
-    "3=time step if multi-step, 4=time step always)" },
+    "Time display mode (0=none, 1=time series, 2=harmonic data, "
+    "3=automatic, 4=multi-step data, 5=real eigenvalues, 6=complex eigenvalues)" },
   { F|O, "SmoothNormals" , opt_view_smooth_normals , 0. ,
     "Smooth the normals?" },
   { F|O, "Stipple" , opt_view_use_stipple , 0. ,
diff --git a/Common/Options.cpp b/Common/Options.cpp
index 090971edf0..21d728f195 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -8088,7 +8088,7 @@ double opt_view_show_time(OPT_ARGS_NUM)
   GET_VIEWo(0.);
   if(action & GMSH_SET) {
     opt->showTime = (int)val;
-    if(opt->showTime < 0 || opt->showTime > 4)
+    if(opt->showTime < 0 || opt->showTime > 6)
       opt->showTime = 0;
   }
 #if defined(HAVE_FLTK)
diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp
index 841cd0d825..2d25ad9131 100644
--- a/Fltk/optionWindow.cpp
+++ b/Fltk/optionWindow.cpp
@@ -3090,10 +3090,12 @@ optionWindow::optionWindow(int deltaFontSize)
 
       static Fl_Menu_Item time_display[] = {
         {"None", 0, 0, 0},
-        {"Value if multi-step", 0, 0, 0},
-        {"Value", 0, 0, 0},
-        {"Step if multi-step", 0, 0, 0},
-        {"Step", 0, 0, 0},
+        {"Time series", 0, 0, 0},
+        {"Harmonic data", 0, 0, 0},
+        {"Automatic", 0, 0, 0},
+        {"Multi-step data", 0, 0, 0},
+        {"Real eigenvalues", 0, 0, 0},
+        {"Complex eigenvalues", 0, 0, 0},
         {0}
       };
       view.choice[12] = new Fl_Choice
diff --git a/Graphics/drawScales.cpp b/Graphics/drawScales.cpp
index 09e5b2377e..3c133781ce 100644
--- a/Graphics/drawScales.cpp
+++ b/Graphics/drawScales.cpp
@@ -172,17 +172,62 @@ static void drawScaleLabel(drawContext *ctx, PView *p, double xmin, double ymin,
   char label[1024];
 
   int nt = data->getNumTimeSteps();
-  if((opt->showTime == 1 && nt > 1) || opt->showTime == 2){
-    char tmp[256];
-    sprintf(tmp, opt->format.c_str(), data->getTime(opt->timeStep));
-    sprintf(label, "%s - Time: %s", data->getName().c_str(), tmp);
+  char time[256];
+  sprintf(time, opt->format.c_str(), data->getTime(opt->timeStep));
+  int choice = opt->showTime;
+  if(choice == 3){ // automatic
+    if(nt == 1) choice = 0; // nothing
+    else if(nt == 2) choice = 2; // harmonic
+    else choice = 4; // multi-step data
   }
-  else if((opt->showTime == 3 && nt > 1) || opt->showTime == 4){
-    sprintf(label, "%s - Step %d in [0,%d]", data->getName().c_str(), opt->timeStep,
-            data->getNumTimeSteps()-1);
-  }
-  else
+  switch(choice){
+  case 1: // time series
+    if(nt == 1)
+      sprintf(label, "%s - time %s", data->getName().c_str(), time);
+    else
+      sprintf(label, "%s - time %s (%d/%d)", data->getName().c_str(),
+              time, opt->timeStep + 1, data->getNumTimeSteps());
+    break;
+  case 2: // harmonic data
+    if(nt <= 2)
+      sprintf(label, "%s - %s part", data->getName().c_str(),
+              (opt->timeStep % 2) ? "imaginary" : "real");
+    else
+      sprintf(label, "%s - harmonic %s (%d/%d, %s part)", data->getName().c_str(),
+              time, opt->timeStep / 2 + 1, data->getNumTimeSteps() / 2,
+              (opt->timeStep % 2) ? "imaginary" : "real");
+    break;
+  case 3: // automatic
+    // never here
+    break;
+  case 4: // multi-step data
+    if(nt == 1)
+      sprintf(label, "%s - step %d", data->getName().c_str(), opt->timeStep);
+    else
+      sprintf(label, "%s - step %d (%d/%d)", data->getName().c_str(),
+              opt->timeStep, opt->timeStep + 1, data->getNumTimeSteps());
+    break;
+  case 5: // real eigenvalues
+    if(nt == 1)
+      sprintf(label, "%s - eigenvalue %s", data->getName().c_str(),
+              time);
+    else
+      sprintf(label, "%s - eigenvalue %s (%d/%d)", data->getName().c_str(),
+              time, opt->timeStep + 1, data->getNumTimeSteps());
+    break;
+  case 6: // complex eigenvalues
+    if(nt == 1)
+      sprintf(label, "%s - eigenvalue %s (%s part)", data->getName().c_str(),
+              time, (opt->timeStep % 2) ? "imaginary" : "real");
+    else
+      sprintf(label, "%s - eigenvalue %s (%d/%d, %s part)", data->getName().c_str(),
+              time, opt->timeStep / 2 + 1, data->getNumTimeSteps() / 2,
+              (opt->timeStep % 2) ? "imaginary" : "real");
+    break;
+  default:
     sprintf(label, "%s", data->getName().c_str());
+    break;
+  }
 
   if(horizontal){
     ctx->drawString(label, xmin + width / 2., ymin + height + tic + 1.4 * font_h, 0.,
diff --git a/doc/texinfo/opt_mesh.texi b/doc/texinfo/opt_mesh.texi
index 745b83fc88..17c9a61c4d 100644
--- a/doc/texinfo/opt_mesh.texi
+++ b/doc/texinfo/opt_mesh.texi
@@ -5,7 +5,7 @@
 
 @ftable @code
 @item Mesh.Algorithm
-2D mesh algorithm (1=MeshAdapt, 2=Automatic, 5=Delaunay, 6=Frontal, 7=bamg, 8=delquad)@*
+2D mesh algorithm (1=MeshAdapt, 2=Automatic, 5=Delaunay, 6=Frontal, 7=BAMG, 8=DelQuad)@*
 Default value: @code{2}@*
 Saved in: @code{General.OptionsFileName}
 
diff --git a/doc/texinfo/opt_plugin.texi b/doc/texinfo/opt_plugin.texi
index 59073cad62..df8050929f 100644
--- a/doc/texinfo/opt_plugin.texi
+++ b/doc/texinfo/opt_plugin.texi
@@ -5,37 +5,40 @@
 
 @ftable @code
 @item Plugin(AnalyseCurvedMesh)
-Plugin(AnalyseCurvedMesh) analyse all elements of a given dimension. It computes, min(J) where J is the scaled Jacobian determinant and, if asked, min(R) where R is the ratio between the smaller and the greater of the eigenvalues of the metric. It creates a PView and hides elements for which min(@{J, R@}) < 'Hidding threshold'.@*
+Plugin(AnalyseCurvedMesh) analyse all elements of a given dimension. According to what is asked, it computes the minimum of the Jacobian determinant (J), of the scaled Jacobian and/or of the isotropy measure. Statistics are printed and if asked a Pview is created for each measure. The plugin hides elements for which the measure mu > 'Hidding threshold', where mu is the isotropy measure if asked otherwise the scaled Jacobian if asked otherwise the Jacobian determinant.@*
 @*
-J is faster to compute but gives informations only on validity while R gives also informations on quality.@*
+J is faster to compute but gives informations only on validity while the other measure gives also informations on quality.@*
+Warning: the scaled Jacobian is experimental for triangles, tetrahedra, prisms and pyramids. Computation may take a lot of time for those elements!@*
 @*
 Parameters:@*
 @*
-- Show [...] = @{0, 1, 2@}: If 0, computes Jacobian and shows min(J). If 1, computes Jacobian and metric and shows min(R). If 2, behaves like it is 1 but draw the two min(J) and min(R) PView@*
+- Jacobian determinant = @{0, 1@}@*
+- Scaled Jacobian = @{0, 1@}@*
+- Isotropy = @{0, 1@}@*
 @*
-- Draw PView = @{0, 1@}: Creates a PView of min(@{J, R@}) if it does not exist already. If 'Recompute' = 1, a new PView is redrawed.@*
+- Hidding threshold = [0, 1]: Does nothing if Isotropy == 0 and Scaled Jacobian == 0. Otherwise, hides all element for which min(mu) is strictly greater than the threshold, where mu is the isotropy if Isotropy == 1, otherwise it is the Scaled Jacobian. If threshold == 1, no effect, if == 0 hide all elements except invalid.@*
 @*
-- Hidding threshold = [0,1]: Hides all element for which min(R) or min(J) is strictly greater than the threshold. If = 1, no effect, if = 0 hide all elements except invalid.@*
-@*
-- Dimension = @{-1, 1, 2, 3, 4@}: If = -1, analyse element of the greater dimension. If = 4, analyse 2D and 3D elements@*
+- Draw PView = @{0, 1@}: Creates a PView of min(J)/max(J), min(scaled Jac) and/or min(isotropy) according to what is asked. If 'Recompute' = 1, a new PView is redrawed.@*
 @*
 - Recompute = @{0,1@}: If the mesh has changed, set to 1 to recompute the bounds.@*
 @*
-- Tolerance = ]0, 1[: Tolerance on the computation of min(@{R, J@}). It should be at most 0.01 but it can be set to 1 or greater to just check the validity of the mesh.
+- Dimension = @{-1, 1, 2, 3, 4@}: If == -1, analyse element of the greater dimension. If == 4, analyse 2D and 3D elements.
 Numeric options:
 @table @code
-@item Show: 0:J, 1:R, 2:J&&R
+@item Jacobian determinant
 Default value: @code{1}
-@item Draw PView
+@item Scaled Jacobian
+Default value: @code{0}
+@item Isotropy
 Default value: @code{1}
 @item Hidding threshold
-Default value: @code{10}
+Default value: @code{9}
+@item Draw PView
+Default value: @code{0}
+@item Recompute
+Default value: @code{0}
 @item Dimension of elements
 Default value: @code{-1}
-@item Recompute bounds
-Default value: @code{0}
-@item Tolerance
-Default value: @code{0.001}
 @end table
 
 @item Plugin(Annotate)
@@ -1065,6 +1068,24 @@ Default value: @code{-1}
 Default value: @code{-1}
 @end table
 
+@item Plugin(ShowNeighborElements)
+Plugin(ShowNeighborElements) allows to set visible some given elements  and a layer of elements around them, the other being set invisible.
+Numeric options:
+@table @code
+@item NumLayers
+Default value: @code{1}
+@item Element1
+Default value: @code{0}
+@item Element2
+Default value: @code{0}
+@item Element3
+Default value: @code{0}
+@item Element4
+Default value: @code{0}
+@item Element5
+Default value: @code{0}
+@end table
+
 @item Plugin(SimplePartition)
 Plugin(SimplePartition) partitions the current mesh into `NumSlices' slices, along the X-, Y- or Z-axis depending on the value of `Direction' (0,1,2). The plugin creates partition boundaries if `CreateBoundaries' is set.
 String options:
diff --git a/doc/texinfo/opt_print.texi b/doc/texinfo/opt_print.texi
index b1ce1d062e..b9e51319f6 100644
--- a/doc/texinfo/opt_print.texi
+++ b/doc/texinfo/opt_print.texi
@@ -184,6 +184,26 @@ Print text strings?@*
 Default value: @code{1}@*
 Saved in: @code{General.OptionsFileName}
 
+@item Print.X3dCompatibility
+Produce highliy compatible X3D output (no scale bar)@*
+Default value: @code{0}@*
+Saved in: @code{General.OptionsFileName}
+
+@item Print.X3dPrecision
+Precision of X3D output@*
+Default value: @code{1e-09}@*
+Saved in: @code{General.OptionsFileName}
+
+@item Print.X3dRemoveInnerBorders
+Remove inner borders in X3D output@*
+Default value: @code{0}@*
+Saved in: @code{General.OptionsFileName}
+
+@item Print.X3dTransparency
+Transparency for X3D output@*
+Default value: @code{0}@*
+Saved in: @code{General.OptionsFileName}
+
 @item Print.Width
 Width of printed image; use (possibly scaled) current width if < 0)@*
 Default value: @code{-1}@*
diff --git a/doc/texinfo/opt_solver.texi b/doc/texinfo/opt_solver.texi
index 28c38f8ff0..a10b4af494 100644
--- a/doc/texinfo/opt_solver.texi
+++ b/doc/texinfo/opt_solver.texi
@@ -215,7 +215,7 @@ Default value: @code{""}@*
 Saved in: @code{General.SessionFileName}
 
 @item Solver.SocketName
-Base name of socket (UNIX socket if the name does not contain a colon, TCP/IP otherwise, in the form 'host:baseport'; the actual name/port is constructed by appending the unique client id. If baseport is 0, the port is chosen automatically (recommended))@*
+Base name of socket (UNIX socket if the name does not contain a colon, TCP/IP otherwise, in the form 'host:baseport'; the actual name/port is constructed by appending the unique client id. If baseport is 0 or is not provided, the port is chosen automatically (recommended))@*
 Default value: @code{".gmshsock"}@*
 Saved in: @code{General.OptionsFileName}
 
diff --git a/doc/texinfo/opt_view.texi b/doc/texinfo/opt_view.texi
index 93ebb300f2..2f66f1b0df 100644
--- a/doc/texinfo/opt_view.texi
+++ b/doc/texinfo/opt_view.texi
@@ -650,7 +650,7 @@ Default value: @code{1}@*
 Saved in: @code{General.OptionsFileName}
 
 @item View.ShowTime
-Time display mode (0=hidden, 1=time value if multi-step, 2=time value always, 3=time step if multi-step, 4=time step always)@*
+Time display mode (0=none, 1=time series, 2=harmonic data, 3=automatic, 4=multi-step data, 5=real eigenvalues, 6=complex eigenvalues)@*
 Default value: @code{3}@*
 Saved in: @code{General.OptionsFileName}
 
-- 
GitLab