From 9105f5b5072bb4c8ff3719fa9e4e0e6e3a3d4ce6 Mon Sep 17 00:00:00 2001 From: Tzanio Kolev Date: Wed, 11 Mar 2026 09:59:41 -0700 Subject: [PATCH 1/4] Bug fix for glvis -a --- glvis.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/glvis.cpp b/glvis.cpp index c68418b2..f6817b36 100644 --- a/glvis.cpp +++ b/glvis.cpp @@ -77,11 +77,13 @@ class Session public: Session(bool fix_elem_orient, + bool keep_attr, bool save_coloring, string plot_caption, bool headless) { win.data_state.fix_elem_orient = fix_elem_orient; + win.data_state.keep_attr = keep_attr; win.data_state.save_coloring = save_coloring; win.plot_caption = plot_caption; win.headless = headless; @@ -157,7 +159,8 @@ class Session }; void GLVisServer(int portnum, bool save_stream, bool fix_elem_orient, - bool save_coloring, string plot_caption, bool headless = false) + bool keep_attr, bool save_coloring, string plot_caption, + bool headless = false) { std::vector current_sessions; string data_type; @@ -307,7 +310,8 @@ void GLVisServer(int portnum, bool save_stream, bool fix_elem_orient, while (1); } - Session new_session(fix_elem_orient, save_coloring, plot_caption, headless); + Session new_session(fix_elem_orient, keep_attr, + save_coloring, plot_caption, headless); constexpr int tmp_filename_size = 50; char tmp_file[tmp_filename_size]; @@ -692,6 +696,7 @@ int main (int argc, char *argv[]) // Run server in new thread std::thread serverThread{GLVisServer, portnum, save_stream, win.data_state.fix_elem_orient, + win.data_state.keep_attr, win.data_state.save_coloring, win.plot_caption, win.headless}; From 466bc477a63025b1b8a1a20087813d86840db302 Mon Sep 17 00:00:00 2001 From: Tzanio Kolev Date: Thu, 12 Mar 2026 11:26:35 -0700 Subject: [PATCH 2/4] Swapped the order of save_coloring and keep_attr for consistency --- glvis.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/glvis.cpp b/glvis.cpp index f6817b36..6a7f0134 100644 --- a/glvis.cpp +++ b/glvis.cpp @@ -77,14 +77,14 @@ class Session public: Session(bool fix_elem_orient, - bool keep_attr, bool save_coloring, + bool keep_attr, string plot_caption, bool headless) { win.data_state.fix_elem_orient = fix_elem_orient; - win.data_state.keep_attr = keep_attr; win.data_state.save_coloring = save_coloring; + win.data_state.keep_attr = keep_attr; win.plot_caption = plot_caption; win.headless = headless; } @@ -159,7 +159,7 @@ class Session }; void GLVisServer(int portnum, bool save_stream, bool fix_elem_orient, - bool keep_attr, bool save_coloring, string plot_caption, + bool save_coloring, bool keep_attr, string plot_caption, bool headless = false) { std::vector current_sessions; @@ -310,8 +310,8 @@ void GLVisServer(int portnum, bool save_stream, bool fix_elem_orient, while (1); } - Session new_session(fix_elem_orient, keep_attr, - save_coloring, plot_caption, headless); + Session new_session(fix_elem_orient, save_coloring, + keep_attr, plot_caption, headless); constexpr int tmp_filename_size = 50; char tmp_file[tmp_filename_size]; @@ -696,8 +696,8 @@ int main (int argc, char *argv[]) // Run server in new thread std::thread serverThread{GLVisServer, portnum, save_stream, win.data_state.fix_elem_orient, - win.data_state.keep_attr, win.data_state.save_coloring, + win.data_state.keep_attr, win.plot_caption, win.headless}; // Start message loop in main thread From 51de3879d4e1330be9022fc6713fae9e08ae5f50 Mon Sep 17 00:00:00 2001 From: Veselin Dobrev Date: Fri, 10 Apr 2026 17:37:14 -0700 Subject: [PATCH 3/4] Fix for 2D scalar PrepareBoundary() when drawbdr is 2, i.e. the second state cycled with the 'b' key. --- lib/vssolution.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/vssolution.cpp b/lib/vssolution.cpp index 7d25f38f..a9e52d9c 100644 --- a/lib/vssolution.cpp +++ b/lib/vssolution.cpp @@ -2523,9 +2523,21 @@ void VisualizationSceneSolution::PrepareBoundary() T->Loc2.Transform(ir, eir); GetRefinedValues(T->Elem2No, eir, vals, pointmat); bl.glBegin(GL_LINE_STRIP); - for (j = 0; j < vals.Size(); j++) + if (drawbdr == 2) { - bl.glVertex3d(pointmat(0, j), pointmat(1, j), vals(j)); + const double val = mesh->GetBdrAttribute(i); + MySetColor(bl, val, minv, maxv); + for (j = 0; j < vals.Size(); j++) + { + bl.glVertex3d(pointmat(0, j), pointmat(1, j), val); + } + } + else + { + for (j = 0; j < vals.Size(); j++) + { + bl.glVertex3d(pointmat(0, j), pointmat(1, j), vals(j)); + } } bl.glEnd(); } From 25c13cb64e79dce5bf2db70b208cb4e8b7fc1392 Mon Sep 17 00:00:00 2001 From: Veselin Dobrev Date: Fri, 10 Apr 2026 19:11:49 -0700 Subject: [PATCH 4/4] Fix for an issue that was causing an MFEM_ASSERT failure --- lib/vssolution3d.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/vssolution3d.cpp b/lib/vssolution3d.cpp index 2383fb3e..d71d5cb8 100644 --- a/lib/vssolution3d.cpp +++ b/lib/vssolution3d.cpp @@ -181,6 +181,12 @@ void VisualizationSceneSolution3d::PrepareOrderingCurve1(gl3::GlDrawable& buf, DenseMatrix pointmat1; Array vertices1; + const auto shrink_save = shrink; + // If shrink != 1, ShrinkPoints() expects a bdr element index for its second + // parameter when dim == 3. Since in the loop below we call ShrinkPoints() + // with an element index, we temporarily set shrink to 1. + if (mesh->Dimension() == 3) { shrink = 1.0; } + int ne = mesh->GetNE(); for (int k = 0; k < ne-1; k++) { @@ -223,7 +229,7 @@ void VisualizationSceneSolution3d::PrepareOrderingCurve1(gl3::GlDrawable& buf, double dx = xs1-xs; double dy = ys1-ys; double dz = zs1-zs; - double ds = sqrt(dx*dx+dy*dy+dz*dz); + double ds = hypot(dx, dy, dz); // sqrt(dx*dx+dy*dy+dz*dz); double cval = HUGE_VAL; if (color) @@ -247,6 +253,8 @@ void VisualizationSceneSolution3d::PrepareOrderingCurve1(gl3::GlDrawable& buf, } } + if (mesh->Dimension() == 3) { shrink = shrink_save; } + if (GetMultisample() > 0) { SetLineWidthMS(LineWidth);