Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Final changes for glvis-4.3 #284

Merged
merged 18 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,18 @@
https://glvis.org


Version 4.2.1 (development)
===========================
Version 4.3 released on Aug 7, 2024
===================================

- Added visualization of quadrature data (QuadratureFunction in MFEM). Both
loading from file, with the new command line argument '-q', or from a socket
stream, with the keyword 'quadrature', are supported. Three visualization
options are provided: piece-wise constants on a refined mesh (LOR), L2 field
with DOFs collocated (interpolation), or projection to discontinuous elements
(L2 projection). Use 'Q' to switch between them. High-order quadrature data is
supported only for tensor finite elements with the first two options. With the
first option, only the mesh lines of the original mesh are visualized. This
feature is also supported for the element-wise cutting plane in 3D (cplane=2).

- The GLVis auto refinement algorithm now takes into account the order of the
data (mesh and grid function). The new refinement is chosen to be sufficient
Expand All @@ -19,9 +29,13 @@ Version 4.2.1 (development)
user may still need to press 'o' to fully resolve the data. For more details,
see the section Auto-refinement in README.md.

- Significantly improved memory usage.
- Added option to specify the floating point number formatting in GLVis axes and
colorbar. Use 'Alt+a' for the axes and 'Alt+c' for the colorbar. Formatting
can also be specified in socket stream or glvis script with axis_numberformat
or colorbar_numberformat, followed by a C-like formatting string, for example
"colorbar_numberformat '%+06.1f'".

- Add support to visualize solutions on 1D elements embedded in 2D and 3D.
- Added a building option for setting the default font size.

- Added support for scalar integral finite elements, where calculation of the
surface normals was not implemented and was crashing GLVis. The normals are
Expand All @@ -30,23 +44,11 @@ Version 4.2.1 (development)
- Added two new modes for visualization of vector fields in 2D, placing the
arrows above the plotted surface and using a single color.

- Added a compilation parameter for the default font size.
- Added support to visualize solutions on 1D elements embedded in 2D and 3D.

- Added option to specify the floating point number formatting in GLVis axes and
colorbar. Use 'Alt+a' for the axes and 'Alt+c' for the colorbar. Formatting
can also be specified in socket stream or glvis script with axis_numberformat
or colorbar_numberformat, followed by a C-like formatting string, for example
"colorbar_numberformat '%+06.1f'".
- Significantly improved memory usage.

- Added visualization of quadrature data (QuadratureFunction in MFEM). Both
loading from file, with the new command line argument '-q', or from a socket
stream, with the keyword 'quadrature', are supported. Three visualization
options are provided: piece-wise constants on a refined mesh (LOR), L2 field
with DOFs collocated (interpolation), or projection to discontinuous elements
(L2 projection). Use 'Q' to switch between them. High-order quadrature data is
supported only for tensor finite elements with the first two options. With the
first option, only the mesh lines of the original mesh are visualized. This
feature is also supported for the element-wise cutting plane (cplane=2).
- Various other bugfixes and improvements.


Version 4.2 released on May 23, 2022
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</p>

<p align="center">
<a href="https://github.com/GLVis/glvis/releases/latest"><img alt="Release" src="https://img.shields.io/badge/release-v4.2-success.svg"></a>
<a href="https://github.com/GLVis/glvis/releases/latest"><img alt="Release" src="https://img.shields.io/badge/release-v4.3-success.svg"></a>
<a href="https://github.com/GLVis/glvis/actions/workflows/builds.yml"><img alt="Build" src="https://github.com/GLVis/glvis/actions/workflows/builds.yml/badge.svg"></a>
<a href="https://github.com/glvis/glvis/blob/master/LICENSE"><img alt="License" src="https://img.shields.io/badge/License-BSD-success.svg"></a>
<a href="https://glvis.github.io/doxygen/html/index.html"><img alt="Doxygen" src="https://img.shields.io/badge/code-documented-success.svg"></a>
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

https://glvis.org

<a href="https://github.com/GLVis/glvis/releases/latest"><img alt="Release" src="https://img.shields.io/badge/release-v4.2-success.svg"></a>
<a href="https://github.com/GLVis/glvis/releases/latest"><img alt="Release" src="https://img.shields.io/badge/release-v4.3-success.svg"></a>
<a href="https://github.com/GLVis/glvis/actions/workflows/builds.yml"><img alt="Build" src="https://github.com/GLVis/glvis/actions/workflows/builds.yml/badge.svg"></a>
<a href="https://github.com/glvis/glvis/blob/master/LICENSE"><img alt="License" src="https://img.shields.io/badge/License-BSD-success.svg"></a>
<a href="https://glvis.github.io/doxygen/html/index.html"><img alt="Doxygen" src="https://img.shields.io/badge/code-documented-success.svg"></a>
Expand Down Expand Up @@ -165,7 +165,7 @@ Key commands
functions and curvilinear elements (use <kbd>o</kbd> / <kbd>O</kbd> to control subdivisions)
- <kbd>\\</kbd> – Set light source position (see <kbd>Right</kbd> + <kbd>Shift</kbd>)
- <kbd>*</kbd> / <kbd>/</kbd> – Zoom in/out
- <kbd>+</kbd> / <kbd>-</kbd> – Stretch/compree in `z`-direction
- <kbd>+</kbd> / <kbd>-</kbd> – Stretch/compress in `z`-direction
- <kbd>[</kbd> / <kbd>]</kbd> – Shrink/enlarge the bounding box (relative to the colorbar)
- <kbd>(</kbd> / <kbd>)</kbd> – Shrink/enlarge the visualization window
- <kbd>.</kbd> – Start/stop `z`-spinning (speed/direction can be controlled with <kbd>0</kbd> / <kbd>Enter</kbd>)
Expand Down
2 changes: 1 addition & 1 deletion glvis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@ int main (int argc, char *argv[])
return 0;
}

//turn off the server mode if other options are present
// turn off the server mode if other options are present
if (input & ~INPUT_SERVER_MODE) { input &= ~INPUT_SERVER_MODE; }

// print help for wrong input
Expand Down
4 changes: 2 additions & 2 deletions lib/aux_js.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ using StringArray = std::vector<std::string>;
int processParallelStreams(StreamState & state, const StringArray & streams,
std::stringstream * commands = nullptr)
{
//std::cerr << "got " << streams.size() << " streams" << std::endl;
// std::cerr << "got " << streams.size() << " streams" << std::endl;
// HACK: match unique_ptr<istream> interface for ReadStreams:
std::vector<std::stringstream> sstreams(streams.size());
StreamCollection istreams(streams.size());
Expand All @@ -248,7 +248,7 @@ int processParallelStreams(StreamState & state, const StringArray & streams,
std::string word;
int nproc, rank;
sstreams[i] >> word >> nproc >> rank;
//std::cerr << "packing " << rank+1 << "/" << nproc << std::endl;
// std::cerr << "packing " << rank+1 << "/" << nproc << std::endl;
istreams[i] = std::unique_ptr<std::istream>(&sstreams[i]);
}

Expand Down
28 changes: 26 additions & 2 deletions lib/aux_vis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,18 @@ void SendKeySequence(const char *seq)
case '7': // F7
wnd->signalKeyDown(SDLK_F7);
break;
case '1': // F11 or F12
key++;
switch (*key)
{
case '1': // F11
wnd->signalKeyDown(SDLK_F11);
break;
case '2': // F12
wnd->callKeyDown(SDLK_F12);
break;
}
break;
case '.': // Keypad ./Del
wnd->signalKeyDown(SDLK_PERIOD);
break;
Expand Down Expand Up @@ -291,6 +303,18 @@ void CallKeySequence(const char *seq)
case '7': // F7
wnd->callKeyDown(SDLK_F7);
break;
case '1': // F11 or F12
key++;
switch (*key)
{
case '1': // F11
wnd->callKeyDown(SDLK_F11);
break;
case '2': // F12
wnd->callKeyDown(SDLK_F12);
break;
}
break;
case '.': // Keypad ./Del
wnd->callKeyDown(SDLK_PERIOD);
break;
Expand Down Expand Up @@ -1156,7 +1180,7 @@ inline GL2PSvertex CreatePrintVtx(gl3::FeedbackVertex v)

void PrintCaptureBuffer(gl3::CaptureBuffer& cbuf)
{
//print lines
// print lines
for (size_t i = 0; i < cbuf.lines.size(); i += 2)
{
GL2PSvertex lineOut[2] =
Expand Down Expand Up @@ -1214,7 +1238,7 @@ void KeyCtrlP()
// GL2PS_OCCLUSION_CULL |
// GL2PS_BEST_ROOT |
GL2PS_SILENT |
//GL2PS_DRAW_BACKGROUND |
// GL2PS_DRAW_BACKGROUND |
GL2PS_NO_BLENDING |
GL2PS_NO_OPENGL_CONTEXT,
GL_RGBA, 0, NULL, 16, 16, 16, 0, fp, "a" );
Expand Down
2 changes: 1 addition & 1 deletion lib/gl/renderer_ff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ void FFGLDevice::captureXfbBuffer(PaletteState& pal, CaptureBuffer& cbuf,
if (disp_lists[hnd].layout == VertexTex::layout
|| disp_lists[hnd].layout == VertexNormTex::layout)
{
//capture texture values too
// capture texture values too
// [ X Y Z ] [ R G B A ] [ U V - - ]
fbType = GL_3D_COLOR_TEXTURE;
fbStride = 11;
Expand Down
2 changes: 1 addition & 1 deletion lib/sdl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class SdlWindow

bool update_before_expose{false};

//bool requiresExpose;
// bool requiresExpose;
bool takeScreenshot{false};
std::string screenshot_file;
bool screenshot_convert;
Expand Down
16 changes: 8 additions & 8 deletions lib/stream_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ void StreamState::Extrude1DMeshAndSolution()
void StreamState::CollectQuadratures(QuadratureFunction *qf_array[],
int npieces)
{
//assume the same vdim
// assume the same vdim
const int vdim = qf_array[0]->GetVDim();
//assume the same quadrature rule
// assume the same quadrature rule
QuadratureSpace *qspace = new QuadratureSpace(*mesh,
qf_array[0]->GetIntRule(0));
SetQuadFunction(new QuadratureFunction(qspace, vdim));
Expand Down Expand Up @@ -213,16 +213,16 @@ void StreamState::SetMeshSolution()

void StreamState::SetQuadSolution(QuadSolution type)
{
//assume identical order
const int order = quad_f->GetIntRule(0).GetOrder()/2;//<---Gauss-Legendre
//use the original mesh when available
// assume identical order
const int order = quad_f->GetIntRule(0).GetOrder()/2; // <-- Gauss-Legendre
// use the original mesh when available
if (mesh_quad.get())
{
internal.mesh.swap(internal.mesh_quad);
internal.mesh_quad.reset();
}

//check for tensor-product basis
// check for tensor-product basis
if (order > 0 && type != QuadSolution::HO_L2_projected)
{
Array<Geometry::Type> geoms;
Expand All @@ -245,7 +245,7 @@ void StreamState::SetQuadSolution(QuadSolution type)
const int ref_factor = order + 1;
if (ref_factor <= 1)
{
SetQuadSolution(QuadSolution::HO_L2_collocated);//low-order
SetQuadSolution(QuadSolution::HO_L2_collocated); // low-order
return;
}
Mesh *mesh_lor = new Mesh(Mesh::MakeRefined(*mesh, ref_factor,
Expand Down Expand Up @@ -767,7 +767,7 @@ void StreamState::ResetMeshAndSolution(StreamState &ss, VisualizationScene* vs)
QuadratureFunction *Extrude1DQuadFunction(Mesh *mesh, Mesh *mesh2d,
QuadratureFunction *qf, int ny)
{
//assume identical orders
// assume identical orders
const int order = qf->GetIntRule(0).GetOrder();
const int vdim = qf->GetVDim();
QuadratureSpace *qspace2d = new QuadratureSpace(mesh2d, order);
Expand Down
2 changes: 1 addition & 1 deletion lib/stream_reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ struct StreamState
/// Set the quadrature function representation producing a proxy grid function
void SetQuadSolution(QuadSolution type = QuadSolution::LOR_ClosedGL);

/// Switch the quadrature function represenation and update the visualization
/// Switch the quadrature function representation and update the visualization
void SwitchQuadSolution(QuadSolution type, VisualizationScene* vs);

/// Get the current representation of quadrature solution
Expand Down
16 changes: 7 additions & 9 deletions lib/vsdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,11 +681,9 @@ void Key_Mod_a_Pressed(GLenum state)

int precision = prompt<int>("Enter precision (4): ",
&default_precision, [](int p) { return p>=0; });

char format =
prompt<char>("Enter format [(d)efault, (f)ixed, (s)cientific] (d): ",
&default_format, [](char c) { return c=='d' || c=='f' || c=='s'; });

bool showsign = prompt<bool>("Show sign? [(1)true, (0)false] (0): ",
&default_showsign);
vsdata->SetAxisNumberFormat(precision, format, showsign);
Expand Down Expand Up @@ -1438,15 +1436,15 @@ void VisualizationSceneScalarData::Init()
wnd->setOnKeyDown(SDLK_EXCLAIM, KeyToggleTexture);
}

//Set_Light();
// Set_Light();

//glEnable (GL_COLOR_MATERIAL);
//glShadeModel (GL_SMOOTH);
// glEnable (GL_COLOR_MATERIAL);
// glShadeModel (GL_SMOOTH);

//gl->enableLight();
//gl->enableDepthTest();
//glEnable(GL_AUTO_NORMAL);
//glEnable(GL_NORMALIZE);
// gl->enableLight();
// gl->enableDepthTest();
// glEnable(GL_AUTO_NORMAL);
// glEnable(GL_NORMALIZE);

if (GetMultisample() > 0)
{
Expand Down
24 changes: 11 additions & 13 deletions lib/vssolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ int VisualizationSceneSolution::GetRefinedValuesAndNormals(
{
const IntegrationPoint &ip = nodes.IntPoint(n);
Trans->SetIntPoint(&ip);
lval(n) /= Trans->Weight();//value = dof / |J|
lval(n) /= Trans->Weight(); // value = dof / |J|
}

// Gradient calculation
Expand Down Expand Up @@ -1725,10 +1725,9 @@ void VisualizationSceneSolution::PrepareLines()

MFEM_ASSERT(pointmat.Size() == 4, "Not a quadrilateral!");

//we assume that mesh_course is used only for tensor finite elements,
//like for representation of quadratures, so in 2D it is square
const int geom =
Geometry::Type::SQUARE; //ref.embeddings[i].geom; //<---- bugged!?
// we assume that mesh_course is used only for tensor finite elements,
// like for representation of quadratures, so in 2D it is square
const int geom = Geometry::Type::SQUARE;
const int mat = ref.embeddings[i].matrix;
const DenseMatrix &emb_mat = ref.point_matrices[geom](mat);
trans.SetPointMat(emb_mat);
Expand All @@ -1741,7 +1740,7 @@ void VisualizationSceneSolution::PrepareLines()
emb_pointmat.GetColumnReference(j, emb_ip1);
emb_pointmat.GetColumnReference(jp1, emb_ip2);

//check if we are on the parent edge
// check if we are on the parent edge
if (!(( emb_ip1(0) == 0. && emb_ip2(0) == 0.)
|| (emb_ip1(0) == 1. && emb_ip2(0) == 1.)
|| (emb_ip1(1) == 0. && emb_ip2(1) == 0.)
Expand Down Expand Up @@ -1925,8 +1924,8 @@ void VisualizationSceneSolution::PrepareVertexNumbering1()
DenseMatrix pointmat;
Array<int> vertices;

// Draw the vertices for each element. This is redundant, except
// when the elements or domains are shrunk.
// Draw the vertices for each element. This is redundant, except when the
// elements or domains are shrunk.

const int ne = mesh->GetNE();
for (int k = 0; k < ne; k++)
Expand Down Expand Up @@ -2204,10 +2203,9 @@ void VisualizationSceneSolution::PrepareLines3()
if (mesh_coarse)
{
auto &ref = mesh->GetRefinementTransforms();
//we assume that mesh_course is used only for tensor finite elements,
//like for representation of quadratures, so in 2D it is square
const int geom =
Geometry::Type::SQUARE; //ref.embeddings[i].geom; //<---- bugged!?
// we assume that mesh_course is used only for tensor finite elements,
// like for representation of quadratures, so in 2D it is square
najlkin marked this conversation as resolved.
Show resolved Hide resolved
const int geom = Geometry::Type::SQUARE;
const int mat = ref.embeddings[i].matrix;
const DenseMatrix &emb_mat = ref.point_matrices[geom](mat);
IsoparametricTransformation trans;
Expand All @@ -2220,7 +2218,7 @@ void VisualizationSceneSolution::PrepareLines3()
trans.Transform(RefG->RefPts[RE[2*k]], emb_ip1);
trans.Transform(RefG->RefPts[RE[2*k+1]], emb_ip2);

//check if we are on the parent edge
// check if we are on the parent edge
if (!(( emb_ip1(0) == 0. && emb_ip2(0) == 0.)
|| (emb_ip1(0) == 1. && emb_ip2(0) == 1.)
|| (emb_ip1(1) == 0. && emb_ip2(1) == 0.)
Expand Down
11 changes: 5 additions & 6 deletions lib/vssolution3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1456,10 +1456,9 @@ void VisualizationSceneSolution3d::DrawCoarseSurfEdges(
trans.SetFE(&fe);
DenseMatrix emb_pointmat;

//we assume that mesh_course is used only for tensor finite elements,
//like for representation of quadratures, so in 2D it is square
const int geom = (dim == 3)?(Geometry::Type::CUBE)
:(Geometry::Type::SQUARE); //ref.embeddings[e1].geom; //<---- bugged!?
// we assume that mesh_course is used only for tensor finite elements,
// like for representation of quadratures, so in 2D it is square
const int geom = (dim == 3)?(Geometry::Type::CUBE):(Geometry::Type::SQUARE);
const int mat = ref.embeddings[e1].matrix;
const DenseMatrix &emb_mat = ref.point_matrices[geom](mat);
trans.SetPointMat(emb_mat);
Expand Down Expand Up @@ -1511,7 +1510,7 @@ void VisualizationSceneSolution3d::DrawCoarseSurfEdges(
emb_pointmat.GetColumnReference(jp1, emb_ip2);
}

//check if we are on the outer edge
// check if we are on the outer edge
int inter = 0;
for (int d = 0; d < 3; d++)
if ((emb_ip1(d) != 0. && emb_ip1(d) != 1.)
Expand Down Expand Up @@ -4116,7 +4115,7 @@ void VisualizationSceneSolution3d::PrepareLevelSurf()
{
const IntegrationPoint &ip = nodes.IntPoint(n);
Trans->SetIntPoint(&ip);
lval(n) /= Trans->Weight();//value = dof / |J|
lval(n) /= Trans->Weight(); // value = dof / |J|
}

// Gradient calculation
Expand Down
2 changes: 1 addition & 1 deletion share/Info.cmake.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<key>CFBundleIconFile</key>
<string>GLVis.icns</string>
<key>CFBundleShortVersionString</key>
<string>4.2</string>
<string>4.3</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
Expand Down
Loading
Loading