Skip to content

Commit

Permalink
Merge branch 'master' into ci-misc-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
tzanio committed Aug 10, 2024
2 parents f2b0788 + c8223df commit 92d9ec6
Show file tree
Hide file tree
Showing 30 changed files with 490 additions and 337 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,15 @@ jobs:
- name: package binary (Windows)
if: matrix.os == 'windows-latest'
env:
GLVIS_EXPORT_NAME: glvis-${{ github.ref_name }}-${{ runner.os }}-amd64
GLVIS_EXPORT_NAME: glvis-${{ github.ref_name }}-${{ runner.os }}-${{ runner.arch }}
run: |
cd glvis/build
Copy-Item -Path "Release" -Destination "${Env:GLVIS_EXPORT_NAME}" -Recurse
- name: package binary (Mac)
if: matrix.os == 'macos-latest'
env:
GLVIS_EXPORT_NAME: glvis-${{ github.ref_name }}-${{ runner.os }}-amd64
GLVIS_EXPORT_NAME: glvis-${{ github.ref_name }}-${{ runner.os }}-${{ runner.arch }}
run: |
cd glvis/build
make app
Expand All @@ -222,12 +222,14 @@ jobs:
mkdir dmg_tmp
cp -a ../install-${{ matrix.os }}/GLVis.app dmg_tmp/GLVis.app
# Create DMG since actions/upload-artifact will clobber Unix permissions
hdiutil create -volname "GLVis macOS x86_64" -srcfolder dmg_tmp -ov -format UDZO GLVis.dmg
hdiutil create -volname "GLVis macOS arm64" -srcfolder dmg_tmp -ov -format UDZO GLVis.dmg
mkdir ${GLVIS_EXPORT_NAME}
cp GLVis.dmg ${GLVIS_EXPORT_NAME}
- name: upload binary
uses: actions/upload-artifact@v4
env:
GLVIS_EXPORT_NAME: glvis-${{ github.ref_name }}-${{ runner.os }}-${{ runner.arch }}
with:
name: glvis-${{ github.ref_name }}-${{ runner.os }}-amd64
path: glvis/build/glvis-${{ github.ref_name }}-${{ runner.os }}-amd64
name: ${{ env.GLVIS_EXPORT_NAME }}
path: glvis/build/${{ env.GLVIS_EXPORT_NAME }}
51 changes: 33 additions & 18 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,14 @@
https://glvis.org


Version 4.2.1 (development)
Version 4.3.1 (development)
===========================

- Significantly improved memory usage.
- Fix the Mac binary build in GitHub CI.

- Add support to visualize solutions on 1D elements embedded in 2D and 3D.

- Added support for scalar integral finite elements, where calculation of the
surface normals was not implemented and was crashing GLVis. The normals are
approximately calculated from the point-wise projected value-based elements.

- 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 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'".
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
Expand All @@ -39,7 +26,35 @@ Version 4.2.1 (development)
(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).
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
for resolving the curvature of the data, but only if we can do that with less
than 2M vertices and 16 refinements. Otherwise, we print a warning and the
user may still need to press 'o' to fully resolve the data. For more details,
see the section Auto-refinement in README.md.

- 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'".

- 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
approximately calculated from the point-wise projected value-based elements.

- Added two new modes for visualization of vector fields in 2D, placing the
arrows above the plotted surface and using a single color.

- Added support to visualize solutions on 1D elements embedded in 2D and 3D.

- Significantly improved memory usage.

- Various other bugfixes and improvements.


Version 4.2 released on May 23, 2022
Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,14 @@ if(NOT EMSCRIPTEN)
install(CODE [[
include (BundleUtilities)
fixup_bundle("${CMAKE_INSTALL_PREFIX}/GLVis.app" "" "")
file(GLOB LIBS_TO_SIGN
"${CMAKE_INSTALL_PREFIX}/GLVis.app/Contents/Frameworks/*.dylib")
foreach(LIB ${LIBS_TO_SIGN})
if (NOT IS_SYMLINK ${LIB})
execute_process(COMMAND codesign --force --sign - ${LIB})
endif()
endforeach()
execute_process(COMMAND codesign --force --sign - ${CMAKE_INSTALL_PREFIX}/GLVis.app)
]] COMPONENT RUNTIME)
endif(APPLE)

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
53 changes: 51 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 @@ -68,6 +68,12 @@ is a partial list of the available functionality. Some of these keys can also be
provided as input, using the `-k` command-line option and the `keys` script
command.

For high-order meshes and/or solution data, GLVis performs element subdivision
to try to represent the data more accurately. However, for highly-varying data
or large meshes, the auto-selected subdivision factor (see the
[Auto-refinement](#auto-refinement) section below) may not be sufficient -- use
the keys <kbd>o</kbd> / <kbd>O</kbd>, described below, to manually adjust the
subdivision factor.

SPDX-License-Identifier: BSD-3-Clause <br>
LLNL Release Number: LLNL-CODE-443271 <br>
Expand Down Expand Up @@ -159,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 Expand Up @@ -298,3 +304,46 @@ Key commands
- `x`-component: `v_x`
- `y`-component: `v_y`
- `z`-component: `v_z`

## Auto-refinement

The GLVis auto-refinement algorithm selects a subdivision factor trying to
achieve an accurate representation of high-order meshes and solution data while
keeping the initial time to visualize the data reasonable. The algorithm can be
summarized as follows:
- GLVis draws surface elements; the number of drawn elements, `ne`, is either:
- the number of elements in the mesh for 2D meshes (including surface meshes,
i.e. 2D meshes embedded in 3D space), or
- the number of boundary mesh elements described by the mesh in 3D.
- A tentative upper limit on the number of vertices to be drawn is defined based
on the maximum order of the mesh and the solution, `max_order`:
```
max_vert = ne * (max_order + 1) * (max_order + 1)
```
- To allow more accurate representation for small meshes, this number is
potentially increased:
```
max_vert = max(max_vert, 100 000)
```
- To keep the time to initially visualize the data reasonable, this number is
potentially reduced:
```
max_vert = min(max_vert, 2 000 000)
```
- Finally, the subdivision factor `ref` is chosen to be the largest number such
that:
- the number of vertices needed to draw the `ne` surface elements with `ref`
subdivisions does not exceed `max_vert`:
```
ne * (ref + 1) * (ref + 1) <= max_vert
```
- for large meshes where the above limit cannot be satisfied, set `ref = 1`
- for small meshes, avoid excessive refinements:
```
ref <= 16
```
Note that, for highly-varying data or large meshes, this auto-selected
subdivision factor may not be sufficient for accurate representation. In such
cases the subdivision can be manually adjusted using the keys <kbd>o</kbd> /
<kbd>O</kbd>, described above.
6 changes: 2 additions & 4 deletions 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 Expand Up @@ -1995,8 +1995,6 @@ void SwitchQuadSolution()
{
int iqs = ((int)stream_state.GetQuadSolution()+1)
% ((int)StreamState::QuadSolution::MAX);
stream_state.SetQuadSolution((StreamState::QuadSolution)iqs);
stream_state.Extrude1DMeshAndSolution();
stream_state.ResetMeshAndSolution(vs);
stream_state.SwitchQuadSolution((StreamState::QuadSolution)iqs, vs);
SendExposeEvent();
}
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
48 changes: 37 additions & 11 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 Expand Up @@ -1785,24 +1809,26 @@ void SetFont(const std::string& fn)
#endif
}

function<string(double)> NumberFormatter(int precision, char format, bool showsign)
function<string(double)> NumberFormatter(int precision, char format,
bool showsign)
{
return [precision, format, showsign](double x) -> string
{
ostringstream oss;
switch (format) {
switch (format)
{
case 'f':
oss << fixed;
break;
oss << fixed;
break;
case 's':
oss << scientific;
break;
oss << scientific;
break;
case 'd':
oss << defaultfloat;
break;
oss << defaultfloat;
break;
default:
MFEM_WARNING("Unknown formatting type. Using default. "
<< "Valid options include: ['f', 's', 'd']" << endl);
<< "Valid options include: ['f', 's', 'd']" << endl);
oss << defaultfloat;
break;
};
Expand Down
Loading

0 comments on commit 92d9ec6

Please sign in to comment.