diff --git a/glvis.cpp b/glvis.cpp index 6f85c8d0..18b09126 100644 --- a/glvis.cpp +++ b/glvis.cpp @@ -78,11 +78,13 @@ class Session public: Session(bool fix_elem_orient, bool save_coloring, + bool keep_attr, string plot_caption, bool headless) { win.data_state.fix_elem_orient = fix_elem_orient; win.data_state.save_coloring = save_coloring; + win.data_state.keep_attr = keep_attr; win.plot_caption = plot_caption; win.headless = headless; } @@ -157,7 +159,7 @@ class Session }; void GLVisServer(int portnum, bool save_stream, bool fix_elem_orient, - bool save_coloring, string plot_caption, bool secure, + bool save_coloring, bool keep_attr, string plot_caption, bool secure, bool headless = false) { std::vector current_sessions; @@ -310,7 +312,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, save_coloring, + keep_attr, plot_caption, headless); constexpr int tmp_filename_size = 50; char tmp_file[tmp_filename_size]; @@ -696,6 +699,7 @@ int main (int argc, char *argv[]) std::thread serverThread{GLVisServer, portnum, save_stream, win.data_state.fix_elem_orient, win.data_state.save_coloring, + win.data_state.keep_attr, win.plot_caption, secure, win.headless}; // Start message loop in main thread diff --git a/lib/vssolution.cpp b/lib/vssolution.cpp index 902de84c..1c7fc7ff 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(); } diff --git a/lib/vssolution3d.cpp b/lib/vssolution3d.cpp index a1a066ed..5d917fd8 100644 --- a/lib/vssolution3d.cpp +++ b/lib/vssolution3d.cpp @@ -182,6 +182,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++) { @@ -224,7 +230,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) @@ -248,6 +254,8 @@ void VisualizationSceneSolution3d::PrepareOrderingCurve1(gl3::GlDrawable& buf, } } + if (mesh->Dimension() == 3) { shrink = shrink_save; } + if (GetMultisample() > 0) { SetLineWidthMS(LineWidth);