From 0aa0c248181c6b318cce8a439007254ade365061 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 18 Nov 2005 23:21:57 +0000
Subject: [PATCH] The current behavior of Gmsh when drawing 3D scalar fields is
 not coherent with what is done in 2D: to draw filled iso-values or continuous
 maps in 3D, we should ideally do volume rendering. Right now we draw the
 iso-values (i.e., surfaces), which is both not coherent with the definition
 of continuous maps or filled iso-values, but is also annoying when trying to
 visualize fields that are constant per element (since in that case nothing is
 displayed!)

Until we can do volume rendering, I've changed the behavior to draw the
solution on the boundary of the 3D elements. It's rather slow, but it's the
right thing to do visually.
---
 Graphics/PostElement.cpp | 38 +++++++++++++++++++++++++++++---------
 doc/texinfo/gmsh.texi    |  6 +++++-
 2 files changed, 34 insertions(+), 10 deletions(-)

diff --git a/Graphics/PostElement.cpp b/Graphics/PostElement.cpp
index 28d5d209bb..e5cf53da6a 100644
--- a/Graphics/PostElement.cpp
+++ b/Graphics/PostElement.cpp
@@ -1,4 +1,4 @@
-// $Id: PostElement.cpp,v 1.67 2005-06-27 19:33:21 geuzaine Exp $
+// $Id: PostElement.cpp,v 1.68 2005-11-18 23:21:56 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -601,18 +601,23 @@ void Draw_ScalarTetrahedron(Post_View * View, int preproNormals,
 
   double *vv = &V[4 * View->TimeStep];
 
-  if(!preproNormals && View->Boundary > 0) {
+  // To draw filled iso-values or continuous maps, we should ideally
+  // do volume rendering. Until we can do that, we just draw the
+  // solution on the boundary of the elements
+  if((View->Boundary > 0) ||
+     (View->IntervalsType == DRAW_POST_DISCRETE ||
+      View->IntervalsType == DRAW_POST_CONTINUOUS)) {
     View->Boundary--;
     int ts = View->TimeStep;
     View->TimeStep = 0;
     REORDER3(0, 2, 1);
-    Draw_ScalarTriangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val); // 021
+    Draw_ScalarTriangle(View, preproNormals, ValMin, ValMax, Xp, Yp, Zp, Val); // 021
     REORDER3(0, 1, 3);
-    Draw_ScalarTriangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val); // 013
+    Draw_ScalarTriangle(View, preproNormals, ValMin, ValMax, Xp, Yp, Zp, Val); // 013
     REORDER3(0, 3, 2);
-    Draw_ScalarTriangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val); // 032
+    Draw_ScalarTriangle(View, preproNormals, ValMin, ValMax, Xp, Yp, Zp, Val); // 032
     REORDER3(3, 1, 2);
-    Draw_ScalarTriangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val); // 312
+    Draw_ScalarTriangle(View, preproNormals, ValMin, ValMax, Xp, Yp, Zp, Val); // 312
     View->TimeStep = ts;
     View->Boundary++;
     return;
@@ -709,7 +714,12 @@ void Draw_ScalarHexahedron(Post_View * View, int preproNormals,
   ts = View->TimeStep;
   View->TimeStep = 0;
 
-  if(!preproNormals && View->Boundary > 0) {
+  // To draw filled iso-values or continuous maps, we should ideally
+  // do volume rendering. Until we can do that, we just draw the
+  // solution on the boundary of the elements
+  if((View->Boundary > 0) ||
+     (View->IntervalsType == DRAW_POST_DISCRETE ||
+      View->IntervalsType == DRAW_POST_CONTINUOUS)) {
     View->Boundary--;
     REORDER4(0, 1, 5, 4);
     Draw_ScalarQuadrangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val); // 0154
@@ -765,7 +775,12 @@ void Draw_ScalarPrism(Post_View * View, int preproNormals,
   ts = View->TimeStep;
   View->TimeStep = 0;
 
-  if(!preproNormals && View->Boundary > 0) {
+  // To draw filled iso-values or continuous maps, we should ideally
+  // do volume rendering. Until we can do that, we just draw the
+  // solution on the boundary of the elements
+  if((View->Boundary > 0) ||
+     (View->IntervalsType == DRAW_POST_DISCRETE ||
+      View->IntervalsType == DRAW_POST_CONTINUOUS)) {
     View->Boundary--;
     REORDER4(0, 1, 4, 3);
     Draw_ScalarQuadrangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val);
@@ -810,7 +825,12 @@ void Draw_ScalarPyramid(Post_View * View, int preproNormals,
   ts = View->TimeStep;
   View->TimeStep = 0;
 
-  if(!preproNormals && View->Boundary > 0) {
+  // To draw filled iso-values or continuous maps, we should ideally
+  // do volume rendering. Until we can do that, we just draw the
+  // solution on the boundary of the elements
+  if((View->Boundary > 0) ||
+     (View->IntervalsType == DRAW_POST_DISCRETE ||
+      View->IntervalsType == DRAW_POST_CONTINUOUS)) {
     View->Boundary--;
     REORDER4(0, 3, 2, 1);
     Draw_ScalarQuadrangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val);
diff --git a/doc/texinfo/gmsh.texi b/doc/texinfo/gmsh.texi
index db93f6a84f..dc5dad5579 100644
--- a/doc/texinfo/gmsh.texi
+++ b/doc/texinfo/gmsh.texi
@@ -1,5 +1,5 @@
 \input texinfo.tex @c -*-texinfo-*-
-@c $Id: gmsh.texi,v 1.190 2005-09-20 12:06:36 geuzaine Exp $
+@c $Id: gmsh.texi,v 1.191 2005-11-18 23:21:57 geuzaine Exp $
 @c
 @c Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 @c
@@ -2391,6 +2391,10 @@ displayed, while post-processing plugins either create new post-processing
 views, or modify the data stored in a view (in a destructive, non-reversible
 way).
 
+Plugins are available in the graphical user interface by right-clicking
+on a view button (or by clicking on the black arrow next to the view
+button) and then selecting the `Plugin' submenu.
+
 Here is the list of the plugins that are shipped by default with Gmsh:
 
 @include opt_plugin.texi
-- 
GitLab