Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
8329423
Added visualization of complex functions from file.
najlkin Jan 14, 2026
4757487
Added support for vector spaces.
najlkin Jan 14, 2026
c306818
Added loading of parallel complex grid function.
najlkin Jan 14, 2026
d0eee57
Added streaming of complex solution.
najlkin Jan 14, 2026
437aa1c
Fixed setting of the representation state during updates.
najlkin Jan 15, 2026
4dbc196
Added stream writer for complex gfs.
najlkin Jan 15, 2026
f554774
Added loading of parallel streams of complex gfs.
najlkin Jan 15, 2026
cf8d775
Made the file reader consistency check more strict.
najlkin Jan 15, 2026
7119a69
Fixed shadowing in DataState.
najlkin Jan 15, 2026
19f336e
Added animation of complex phase.
najlkin Jan 15, 2026
0dad8ba
Added optimization for magnitude.
najlkin Jan 15, 2026
cde5753
Minor clarification of phase rate.
najlkin Jan 15, 2026
67ad9eb
Prevented reduction of precision in phase.
najlkin Jan 15, 2026
c709ba9
Decoupled phase animation from spinning.
najlkin Jan 15, 2026
638921e
Replaced the stream command for complex solutions by automatic detect…
najlkin Jan 15, 2026
8cc445e
Reduced the default phase step.
najlkin Jan 15, 2026
a532240
Fixed the phas rate check.
najlkin Jan 15, 2026
5cd8261
Updated Changelog.
najlkin Jan 15, 2026
53ca05d
Added documentation of the keys with Q for cycling for now.
najlkin Jan 15, 2026
c961273
Fixed the value ranges for phase animation.
najlkin Jan 16, 2026
cd2b2da
Added a note about animated phase.
najlkin Jan 16, 2026
d7d4edd
Fixed a typo in max of complex magnitude.
najlkin Jan 16, 2026
4dad4dd
Refactored autoscale modes.
najlkin Jan 16, 2026
60d5711
Changed phase animation keys to Alt+0/./Enter.
najlkin Jan 23, 2026
745f96e
Minor cleanup
najlkin Jan 23, 2026
59ba959
Fixed README for complex phase anim.
najlkin Jan 24, 2026
680561e
Merge branch 'egl-headless' into complex-gf-vis
najlkin Jan 24, 2026
60c3802
Added switching of 3D complex vector grid functions to DGs.
najlkin Jan 24, 2026
50d2b67
Merge branch 'egl-headless' into complex-gf-vis
najlkin Jan 26, 2026
4bc0035
Generalized offsets for numberings to complex grid functions.
najlkin Jan 26, 2026
c6d38c6
Fixed override of UpdateComplexPhase().
najlkin Jan 26, 2026
56eb4cd
Fixed CMake compilation.
najlkin Jan 26, 2026
40a7295
Minor DataState cleanup.
najlkin Jan 27, 2026
e072e45
Generalized the value range for vector functions.
najlkin Jan 27, 2026
57af8e5
Refactored scalar function representation in 3D.
najlkin Jan 27, 2026
ac93a9d
Generalized the value range detection to 3D.
najlkin Jan 27, 2026
660ea8f
Minor consistency.
najlkin Jan 27, 2026
c3495b4
Changed the help string to conditional for quads/complex.
najlkin Jan 28, 2026
85b22b2
Change magnitude/phase to L2 projection.
najlkin Jan 28, 2026
4d5410f
Minor fixes.
najlkin Jan 28, 2026
eec68a7
Added extrusion of complex gfs similar to real to handle 2D3V elements.
najlkin Jan 29, 2026
36e067e
Workaround for recognition of complex streams.
najlkin Jan 29, 2026
8752abb
Fixed writing of streams.
najlkin Jan 29, 2026
7bc5bce
Added example 22 test.
najlkin Jan 29, 2026
9ff2bc7
Updated example 22 test.
najlkin Jan 29, 2026
c0bd62d
Fixed (hopefully) handling of Q on Mac.
najlkin Jan 30, 2026
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
7 changes: 7 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ Unlike previous GLVis releases, this version requires a C++17 compiler.
- Added non-persistent mode of the server, when the server terminates after all
visualization windows are closed.

- Added visualization of complex function data originating from
'(Par)ComplexGridFunction' class in MFEM. The complex values are represented
by their magnitude, phase, real part or imaginary part, which can be switched
by 'Q' key. Additionally, the complex function can be animated by an added
harmonic phase. To increase or decrease the phase frequency, use ';' or ':',
respectively.

- Implemented DOF numbering in 2D scalar mode, pressing the `n` or `N` key cycles
through: None → Elements → Edges → Vertices → DOFs. Parallel numbering is now by
default 'local' to each rank; 'global' vs. 'local' numbering can be toggled with
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ Key commands
- piece-wise constant refined (LOR)
- L2 element dof collocation (interpolation)
- L2 element projection (L2 projection)
- <kbd>Q</kbd> – Cycle between representations of the visualized *complex data*. The options are:
- magnitude
- phase
- real part
- imaginary part
- <kbd>q</kbd> – Exit

## Advanced
Expand Down Expand Up @@ -196,6 +201,7 @@ Key commands
- `on` (default): recompute both the bounding box and the value range
- `value`: recompute only the value range
- `mesh`: recompute only the bounding box
- <kbd>Alt</kbd> + <kbd>.</kbd> – Start/stop harmonic complex phase animation (speed can be controlled with <kbd>Alt</kbd> + <kbd>0</kbd> / <kbd>Alt</kbd> + <kbd>Enter</kbd>)

## 2D scalar data

Expand Down
148 changes: 107 additions & 41 deletions lib/aux_vis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ GLWindow* InitVisualization(const char name[], int x, int y, int w, int h,
wnd->setOnKeyDown (SDLK_s, KeyS);
wnd->setOnKeyDown ('S', KeyS);

wnd->setOnKeyDown (SDLK_q, KeyQPressed);
// wnd->setOnKeyDown (SDLK_Q, KeyQPressed);
wnd->setOnKeyDown (SDLK_q, KeyqPressed);
wnd->setOnKeyDown ('Q', KeyQPressed);

wnd->setOnKeyDown (SDLK_LEFT, KeyLeftPressed);
wnd->setOnKeyDown (SDLK_RIGHT, KeyRightPressed);
Expand Down Expand Up @@ -609,12 +609,28 @@ void RemoveIdleFunc(void (*Func)(void))


thread_local double xang = 0., yang = 0.;
const double xang_step = 0.2; // angle in degrees
thread_local gl3::GlMatrix srot;
thread_local double sph_t, sph_u;
thread_local GLint oldx, oldy, startx, starty;

thread_local int constrained_spinning = 0;

thread_local double phase_rate = 0.;
thread_local int phase_anim = 0;
const double phase_step = 0.001;

void CheckMainIdleFunc()
{
if (locscene->spinning || phase_anim)
{
AddIdleFunc(MainLoop);
}
if (!locscene->spinning && !phase_anim)
{
RemoveIdleFunc(MainLoop);
}
}

void MainLoop()
{
Expand All @@ -624,13 +640,19 @@ void MainLoop()
if (!constrained_spinning)
{
locscene->Rotate(xang, yang);
SendExposeEvent();
}
else
{
locscene->PreRotate(xang, 0.0, 0.0, 1.0);
SendExposeEvent();
}
}
if (phase_anim)
{
locscene->UpdateComplexPhase(phase_rate);
}
if (locscene->spinning || phase_anim)
{
SendExposeEvent();
std::this_thread::sleep_for(std::chrono::milliseconds{10}); // sleep for 0.01 seconds
}
if (locscene->movie)
Expand Down Expand Up @@ -674,7 +696,7 @@ inline void ComputeSphereAngles(int &newx, int &newy,
void LeftButtonDown(GLWindow::MouseEventInfo *event)
{
locscene -> spinning = 0;
RemoveIdleFunc(MainLoop);
CheckMainIdleFunc();

oldx = event->mouse_x;
oldy = event->mouse_y;
Expand Down Expand Up @@ -1334,12 +1356,17 @@ void KeyCtrlP()
#endif
}

void KeyQPressed()
void KeyqPressed()
{
wnd->signalQuit();
visualize = 0;
}

void KeyQPressed()
{
Window::SwitchSolution();
}

void ToggleThreads()
{
static const char *state[] = { "running", "stopped" };
Expand All @@ -1350,7 +1377,7 @@ void ToggleThreads()
}
}

void ThreadsPauseFunc(GLenum state)
void ThreadsPauseFunc(SDL_Keymod state)
{
if (state & KMOD_CTRL)
{
Expand Down Expand Up @@ -1386,57 +1413,96 @@ void CheckSpin()
{
xang = 0.;
}
if (xang != 0. || yang != 0.)
{
locscene->spinning = 1;
AddIdleFunc(MainLoop);
}
else
{
locscene->spinning = 0;
RemoveIdleFunc(MainLoop);
}
locscene->spinning = (xang != 0. || yang != 0.);
CheckMainIdleFunc();
cout << "Spin angle: " << xang << " degrees / frame" << endl;
}

const double xang_step = 0.2; // angle in degrees
void CheckPhaseAnim()
{
if (fabs(phase_rate) < phase_step / 2.)
{
phase_rate = 0.;
}
phase_anim = (phase_rate != 0.);
CheckMainIdleFunc();
cout << "Phase rate: " << phase_rate << " period / frame" << endl;
}

void Key0Pressed()
void Key0Pressed(SDL_Keymod mod)
{
if (!locscene -> spinning)
if (mod & KMOD_ALT)
{
if (!phase_anim)
{
phase_rate = 0.;
}
phase_rate -= phase_step;
CheckPhaseAnim();
}
else
{
xang = 0;
if (!locscene -> spinning)
{
xang = 0;
}
xang -= xang_step;
CheckSpin();
}
xang -= xang_step;
CheckSpin();
}

void KeyDeletePressed()
void KeyDeletePressed(SDL_Keymod mod)
{
if (locscene -> spinning)
if (mod & KMOD_ALT)
{
xang = yang = 0.;
locscene -> spinning = 0;
RemoveIdleFunc(MainLoop);
constrained_spinning = 1;
if (phase_anim)
{
phase_rate = 0.;
phase_anim = 0;
}
else
{
phase_rate = phase_step;
phase_anim = 1;
}
}
else
{
xang = xang_step;
locscene -> spinning = 1;
AddIdleFunc(MainLoop);
if (locscene -> spinning)
{
xang = yang = 0.;
locscene -> spinning = 0;
}
else
{
xang = xang_step;
locscene -> spinning = 1;
}
constrained_spinning = 1;
}
CheckMainIdleFunc();
}

void KeyEnterPressed()
void KeyEnterPressed(SDL_Keymod mod)
{
if (!locscene -> spinning)
if (mod & KMOD_ALT)
{
xang = 0;
if (!phase_anim)
{
phase_rate = 0.;
}
phase_rate += phase_step;
CheckPhaseAnim();
}
else
{
if (!locscene -> spinning)
{
xang = 0;
}
xang += xang_step;
CheckSpin();
}
xang += xang_step;
CheckSpin();
}

void Key7Pressed()
Expand Down Expand Up @@ -1515,7 +1581,7 @@ void ShiftView(double dx, double dy)
locscene->ViewCenterY += dy/scale;
}

void KeyLeftPressed(GLenum state)
void KeyLeftPressed(SDL_Keymod state)
{
if (state & KMOD_CTRL)
{
Expand All @@ -1528,7 +1594,7 @@ void KeyLeftPressed(GLenum state)
SendExposeEvent();
}

void KeyRightPressed(GLenum state)
void KeyRightPressed(SDL_Keymod state)
{
if (state & KMOD_CTRL)
{
Expand All @@ -1541,7 +1607,7 @@ void KeyRightPressed(GLenum state)
SendExposeEvent();
}

void KeyUpPressed(GLenum state)
void KeyUpPressed(SDL_Keymod state)
{
if (state & KMOD_CTRL)
{
Expand All @@ -1554,7 +1620,7 @@ void KeyUpPressed(GLenum state)
SendExposeEvent();
}

void KeyDownPressed(GLenum state)
void KeyDownPressed(SDL_Keymod state)
{
if (state & KMOD_CTRL)
{
Expand Down
18 changes: 10 additions & 8 deletions lib/aux_vis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ void SetLegacyGLOnly(bool status);

void AddIdleFunc(void (*Func)(void));
void RemoveIdleFunc(void (*Func)(void));
void CheckMainIdleFunc();

void LeftButtonDown (GLWindow::MouseEventInfo *event);
void LeftButtonLoc (GLWindow::MouseEventInfo *event);
Expand All @@ -67,9 +68,10 @@ void TouchPinch(SDL_MultiGestureEvent & e);

void KeyCtrlP();
void KeyS();
void KeyqPressed();
void KeyQPressed();
void ToggleThreads();
void ThreadsPauseFunc(GLenum);
void ThreadsPauseFunc(SDL_Keymod);
void ThreadsStop();
void ThreadsRun();

Expand All @@ -83,14 +85,14 @@ void Key7Pressed();
void Key8Pressed();
void Key9Pressed();

void Key0Pressed();
void KeyDeletePressed();
void KeyEnterPressed();
void Key0Pressed(SDL_Keymod);
void KeyDeletePressed(SDL_Keymod);
void KeyEnterPressed(SDL_Keymod);

void KeyLeftPressed(GLenum);
void KeyRightPressed(GLenum);
void KeyUpPressed(GLenum);
void KeyDownPressed(GLenum);
void KeyLeftPressed(SDL_Keymod);
void KeyRightPressed(SDL_Keymod);
void KeyUpPressed(SDL_Keymod);
void KeyDownPressed(SDL_Keymod);
void KeyJPressed();
void KeyMinusPressed();
void KeyPlusPressed();
Expand Down
Loading
Loading