diff --git a/libsrc/include/nginterface.h b/libsrc/include/nginterface.h index 57f55464..08096f3a 100644 --- a/libsrc/include/nginterface.h +++ b/libsrc/include/nginterface.h @@ -288,6 +288,7 @@ extern "C" { namespace netgen { // #include "../visualization/soldata.hpp" class SolutionData; + class MouseEventHandler; } enum Ng_SolutionType @@ -323,6 +324,8 @@ extern "C" { DLL_HEADER void Ng_ClearSolutionData(); // redraw DLL_HEADER void Ng_Redraw(); + /// + DLL_HEADER void Ng_SetMouseEventHandler (netgen::MouseEventHandler * handler); // DLL_HEADER void Ng_SetVisualizationParameter (const char * name, const char * value); diff --git a/libsrc/meshing/parallelmesh.cpp b/libsrc/meshing/parallelmesh.cpp index e1d63f29..55543550 100644 --- a/libsrc/meshing/parallelmesh.cpp +++ b/libsrc/meshing/parallelmesh.cpp @@ -705,7 +705,11 @@ namespace netgen int timerloc2 = NgProfiler::CreateTimer ("CalcSurfacesOfNode"); NgProfiler::RegionTimer regloc(timerloc); - PrintMessage (2, "Got ", GetNE(), " elements and ", GetNSE(), " surface elements"); + stringstream str; + str << "Got " << GetNE() << " elements and " + << GetNSE() << " surface elements"; + cout << str.str() << endl; + // PrintMessage (2, "Got ", GetNE(), " elements and ", GetNSE(), " surface elements"); // PrintMessage (2, "Got ", GetNSE(), " surface elements"); NgProfiler::StartTimer (timerloc2); diff --git a/libsrc/visualization/mvdraw.hpp b/libsrc/visualization/mvdraw.hpp index 211227cd..1fcecadb 100644 --- a/libsrc/visualization/mvdraw.hpp +++ b/libsrc/visualization/mvdraw.hpp @@ -157,6 +157,7 @@ namespace netgen Array par_filledlists; #endif + MouseEventHandler * user_me_handler; NgLock *lock; @@ -174,6 +175,10 @@ namespace netgen virtual void DrawScene (); virtual void MouseDblClick (int px, int py); + void SetMouseEventHandler (MouseEventHandler * handler) + { user_me_handler = handler; } + + int SelectedFace () const { return selface; } void SetSelectedFace (int asf); diff --git a/libsrc/visualization/soldata.hpp b/libsrc/visualization/soldata.hpp index 4fc5faff..d0e14dcb 100644 --- a/libsrc/visualization/soldata.hpp +++ b/libsrc/visualization/soldata.hpp @@ -105,6 +105,14 @@ namespace netgen multidimcomponent = mc; } }; + + + class DLL_HEADER MouseEventHandler + { + public: + virtual void DblClick (int elnr) { ; } + }; + } #endif diff --git a/libsrc/visualization/visual.hpp b/libsrc/visualization/visual.hpp index 405c5b6b..15966c90 100644 --- a/libsrc/visualization/visual.hpp +++ b/libsrc/visualization/visual.hpp @@ -20,8 +20,8 @@ Visualization #include "../include/incvis.hpp" #include "vispar.hpp" -#include "mvdraw.hpp" #include "soldata.hpp" +#include "mvdraw.hpp" #include diff --git a/libsrc/visualization/vsmesh.cpp b/libsrc/visualization/vsmesh.cpp index 0dd83ed8..9fa6ae7f 100644 --- a/libsrc/visualization/vsmesh.cpp +++ b/libsrc/visualization/vsmesh.cpp @@ -61,6 +61,8 @@ namespace netgen minh = 0.0; maxh = 0.0; + user_me_handler = NULL; + } VisualSceneMesh :: ~VisualSceneMesh () @@ -3093,6 +3095,12 @@ namespace netgen MouseDblClickSelect(px,py,clipplane,backcolor,transformationmat,center,rad, filledlist,selelement,selface,seledge,selpoint,selpoint2,locpi); + + if (user_me_handler) + { + if (selelement != -1) + user_me_handler -> DblClick (selelement-1); + } selecttimestamp = NextTimeStamp(); @@ -3427,7 +3435,6 @@ namespace netgen cout << "seledge = " << seledge << endl; } } - } else { diff --git a/libsrc/visualization/vssolution.hpp b/libsrc/visualization/vssolution.hpp index 43ae07ca..e9262cfe 100644 --- a/libsrc/visualization/vssolution.hpp +++ b/libsrc/visualization/vssolution.hpp @@ -139,8 +139,6 @@ public: Array soldata; - - int usetexture; // 0..no, 1..1D texture (standard), 2..2D-texture (complex) @@ -192,7 +190,6 @@ public: void SaveSolutionData (const char * filename); - static void RealVec3d (const double * values, Vec3d & v, bool iscomplex, bool imag); static void RealVec3d (const double * values, Vec3d & v, diff --git a/ng/dialog.tcl b/ng/dialog.tcl index 10b6f343..bfd8cc61 100644 --- a/ng/dialog.tcl +++ b/ng/dialog.tcl @@ -1,6 +1,3 @@ - - - proc meshingoptionsdialog { } { set w .options_dlg diff --git a/ng/ngpkg.cpp b/ng/ngpkg.cpp index a2572395..a5404506 100644 --- a/ng/ngpkg.cpp +++ b/ng/ngpkg.cpp @@ -2718,6 +2718,12 @@ void Ng_SetSolutionData (Ng_SolutionData * soldata) #endif } +void Ng_SetMouseEventHandler (netgen::MouseEventHandler * handler) +{ + vsmesh.SetMouseEventHandler (handler); +} + + void Ng_ClearSolutionData () { #ifdef OPENGL diff --git a/nglib/nglib.cpp b/nglib/nglib.cpp index e566c7ef..8e998272 100644 --- a/nglib/nglib.cpp +++ b/nglib/nglib.cpp @@ -1180,7 +1180,9 @@ namespace netgen //Destination for messages, errors, ... DLL_HEADER void Ng_PrintDest(const char * s) { - (*mycout) << s << flush; + int id = 0; + MPI_Comm_rank(MPI_COMM_WORLD, &id); + if (id == 0) (*mycout) << s << flush; }