glvis icon indicating copy to clipboard operation
glvis copied to clipboard

Updating GLVis mesh vector or scalar solution without drawing a new mesh

Open altineller opened this issue 1 year ago • 4 comments

Hello,

I am about to make a plugin for glVis that listens on a different socket, and updates the mesh node positions.

My purpose is to get an animation of displacements.

I have read the code for the b button press, which is at vsvector3d.cpp and

` void VisualizationSceneVector3d::NPressed() { if (drawdisp) { PrepareDisplacedMesh(); } else { Prepare(); PrepareLines(); }

SendExposeEvent(); } `

I am intending to make a connector, that triggers a method like NPressed above, so I can edit displace mesh, or update solution.

But before I do this, has there been any work done in similar direction?

Any ideas / reccomendations / help greatly appreciated.

Best Regards, C.

altineller avatar Feb 08 '24 19:02 altineller

How is this different than what happens e.g. in ex10 by pushing updated fields to the same socket?

tzanio avatar Feb 08 '24 19:02 tzanio

Hello,

In ex10.cpp, line 381: void visualize(ostream &os, Mesh *mesh, GridFunction *deformed_nodes, GridFunction *field, const char *field_name, bool init_vis) ..

GridFunction *nodes = deformed_nodes;
int owns_nodes = 0;
mesh->SwapNodes(nodes, owns_nodes);
os << "solution\n" << *mesh << *field;
mesh->SwapNodes(nodes, owns_nodes);

Where the nodes of the mesh are temporarily swapped, and sent to glVis trough socket. but mesh is being resent again.

I am interesting modifying mesh inside glVis programmatically, and also pass binary data, instead of ascii, to get at least 10hz update rate, for a mesh with around 65K nodes. So I would like to pass as little as possible data.

Is there any reason for the underlying visualized mesh in glVis memory to be unmodifiable?

Best Regards, Can

altineller avatar Feb 11 '24 16:02 altineller

Interesting 👍

Currently when the solution is updated the mesh is also sent as if it is done for the first time. See the logic in https://github.com/GLVis/glvis/blob/master/lib/threads.cpp#L760

This and https://github.com/GLVis/glvis/blob/master/lib/threads.cpp#L425 could probably be changed, e.g. by adding a new keyword, to just send the grid function and reuse the current mesh.

Tzanio

tzanio avatar Feb 12 '24 19:02 tzanio

Would love to have this feature!!!! Was just wondering about the same thing. Redundant data tranfer can be easily eliminated...

joetristano avatar Feb 17 '24 15:02 joetristano