diff --git a/libsrc/Makefile.am b/libsrc/Makefile.am index 8337b4b7..bd28ed0c 100644 --- a/libsrc/Makefile.am +++ b/libsrc/Makefile.am @@ -2,4 +2,4 @@ AM_CPPFLAGS = METASOURCES = AUTO -SUBDIRS = general gprim linalg include meshing interface csg geom2d occ stlgeom visualization +SUBDIRS = general gprim linalg include meshing visualization interface csg geom2d occ stlgeom diff --git a/libsrc/csg/Makefile.am b/libsrc/csg/Makefile.am index b0fe2dd6..8c596b11 100644 --- a/libsrc/csg/Makefile.am +++ b/libsrc/csg/Makefile.am @@ -26,7 +26,7 @@ if NGGUI lib_LTLIBRARIES += libcsgvis.la libcsgvis_la_SOURCES = vscsg.cpp csgpkg.cpp -libcsgvis_la_LIBADD = libcsg.la +libcsgvis_la_LIBADD = libcsg.la $(top_builddir)/libsrc/visualization/libvisual.la endif # $(top_builddir)/libsrc/geom2d/libgeom2d.la diff --git a/libsrc/csg/csgpkg.cpp b/libsrc/csg/csgpkg.cpp index 53f012aa..cfb4e69b 100644 --- a/libsrc/csg/csgpkg.cpp +++ b/libsrc/csg/csgpkg.cpp @@ -24,8 +24,8 @@ namespace netgen static VisualSceneGeometry vsgeom; char * err_needscsgeometry = (char*) "This operation needs an CSG geometry"; - extern char * err_needsmesh; - extern char * err_jobrunning; + char * err_needsmesh = (char*) "This operation needs a mesh"; + char * err_jobrunning = (char*) "Meshing Job already running"; diff --git a/libsrc/csg/vscsg.cpp b/libsrc/csg/vscsg.cpp index 3ee322f1..c204aaff 100644 --- a/libsrc/csg/vscsg.cpp +++ b/libsrc/csg/vscsg.cpp @@ -483,11 +483,20 @@ namespace netgen CalcTransformationMatrices(); } - - - - - } +void Hi () { cout << "hi from csgvis" << endl; } + +#ifdef NG_PYTHON +#include +namespace bp = boost::python; + +BOOST_PYTHON_MODULE(libcsgvis) +{ + cout << "exporting csg-vis " << endl; + bp::def("hi", &Hi); +} +#endif + + diff --git a/libsrc/interface/Makefile.am b/libsrc/interface/Makefile.am index 0f751225..675a7bda 100644 --- a/libsrc/interface/Makefile.am +++ b/libsrc/interface/Makefile.am @@ -10,6 +10,7 @@ libinterface_la_SOURCES = nginterface.cpp nginterface_v2.cpp \ wuchemnitz.cpp writegmsh2.cpp writeOpenFOAM15x.cpp -libinterface_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la +libinterface_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la \ + $(top_builddir)/libsrc/visualization/libvisual.la # libinterface_la_LDFLAGS = -rdynamic diff --git a/libsrc/interface/nginterface.cpp b/libsrc/interface/nginterface.cpp index 1251cc32..33220257 100644 --- a/libsrc/interface/nginterface.cpp +++ b/libsrc/interface/nginterface.cpp @@ -9,7 +9,8 @@ #endif #include "nginterface.h" -#include "../visualization/soldata.hpp" +// #include "../visualization/soldata.hpp" +#include #ifdef _MSC_VER @@ -160,7 +161,9 @@ void Ng_LoadMeshFromStream ( istream & input ) { mesh.reset (new Mesh()); mesh -> Load(input); - + vssolution.SetMesh(mesh); + vsmesh.SetMesh(mesh); + for (int i = 0; i < geometryregister.Size(); i++) { NetgenGeometry * hgeom = geometryregister[i]->LoadFromMeshFile (input); diff --git a/libsrc/meshing/global.cpp b/libsrc/meshing/global.cpp index 7208c24f..2d2bf582 100644 --- a/libsrc/meshing/global.cpp +++ b/libsrc/meshing/global.cpp @@ -16,10 +16,11 @@ namespace netgen ostream * mycout = &cout; ostream * myerr = &cerr; + // some functions (visualization) still need a global mesh + shared_ptr mesh; + shared_ptr ng_geometry; // Flags parameters; - - int silentflag = 0; int testmode = 0; diff --git a/libsrc/visualization/Makefile.am b/libsrc/visualization/Makefile.am index 917ba722..4bf6ae3b 100644 --- a/libsrc/visualization/Makefile.am +++ b/libsrc/visualization/Makefile.am @@ -7,7 +7,9 @@ AM_CPPFLAGS = $(MPI_INCLUDES) -I$(top_srcdir)/libsrc/include -DOPENGL -D$(TOGL METASOURCES = AUTO if NGGUI -noinst_LTLIBRARIES = libvisual.la +lib_LTLIBRARIES = libvisual.la +libvisual_la_LIBADD = $(LIBGLU) $(TCL_LIB_SPEC) + endif diff --git a/libsrc/visualization/importsolution.cpp b/libsrc/visualization/importsolution.cpp index cf182d71..3a93bbf9 100644 --- a/libsrc/visualization/importsolution.cpp +++ b/libsrc/visualization/importsolution.cpp @@ -16,7 +16,7 @@ namespace netgen { - + extern shared_ptr mesh; void ImportSolution (const char * filename) { @@ -56,7 +56,7 @@ void ImportSolution (const char * filename) flags.PrintFlags (*testout); (*testout) << "done" << endl; - size = int(flags.GetNumFlag ("size", Ng_GetNP())); + size = int(flags.GetNumFlag ("size", mesh->GetNP())); // Ng_GetNP())); comps = int(flags.GetNumFlag ("components", 1)); type = flags.GetStringFlag ("type", "nodal"); order = int(flags.GetNumFlag ("order", 1)); diff --git a/libsrc/visualization/meshdoc.hpp b/libsrc/visualization/meshdoc.hpp index 65763385..3fa92fad 100644 --- a/libsrc/visualization/meshdoc.hpp +++ b/libsrc/visualization/meshdoc.hpp @@ -1,3 +1,6 @@ +namespace netgen + +{ class VisualSceneMeshDoctor : public VisualScene { @@ -35,3 +38,5 @@ public: extern MeshDoctorParameters meshdoctor; + +} diff --git a/libsrc/visualization/mvdraw.cpp b/libsrc/visualization/mvdraw.cpp index cec04277..76d9f069 100644 --- a/libsrc/visualization/mvdraw.cpp +++ b/libsrc/visualization/mvdraw.cpp @@ -35,6 +35,13 @@ namespace netgen #endif */ + + void MyOpenGLText (const char * text) + { + cout << "MyOpenGLText: " << text << endl; + } + + // texture for color decoding // GLubyte * VisualScene :: colortexture = NULL; GLuint VisualScene :: coltexname = 1; diff --git a/libsrc/visualization/mvdraw.hpp b/libsrc/visualization/mvdraw.hpp index 71093f00..8126c613 100644 --- a/libsrc/visualization/mvdraw.hpp +++ b/libsrc/visualization/mvdraw.hpp @@ -5,16 +5,6 @@ namespace netgen { - /* - extern void InitDrawMesh (); - extern void DrawMesh (); - extern void MouseMove(int oldx, int oldy, - int newx, int newy, - char mode); - - extern void Render (); - */ - class VisualScene { @@ -44,11 +34,9 @@ namespace netgen static int selecttimestamp; public: - static int viewport[4]; - // static GLubyte * colortexture; + static int viewport[4]; static GLuint coltexname; static int ntexcols; - // static bool linear_colors; int invcolor; @@ -168,6 +156,8 @@ namespace netgen double minh, maxh; // for meshsize coloring + weak_ptr wp_mesh; + public: VisualSceneMesh (); virtual ~VisualSceneMesh (); @@ -176,6 +166,9 @@ namespace netgen virtual void DrawScene (); virtual void MouseDblClick (int px, int py); + void SetMesh (shared_ptr mesh) { wp_mesh = mesh; } + shared_ptr GetMesh () { return shared_ptr(wp_mesh); } + void SetMouseEventHandler (MouseEventHandler * handler) { user_me_handler = handler; } @@ -207,7 +200,8 @@ namespace netgen void BuildDomainSurfList(); }; - + extern VisualSceneMesh vsmesh; + class VisualSceneSpecPoints : public VisualScene { diff --git a/libsrc/visualization/visual.hpp b/libsrc/visualization/visual.hpp index 15966c90..1015fe00 100644 --- a/libsrc/visualization/visual.hpp +++ b/libsrc/visualization/visual.hpp @@ -24,12 +24,7 @@ Visualization #include "mvdraw.hpp" #include - -namespace netgen -{ #include "vssolution.hpp" #include "meshdoc.hpp" -} - #endif diff --git a/libsrc/visualization/vsfieldlines.cpp b/libsrc/visualization/vsfieldlines.cpp index c990a540..e3ed1dbd 100644 --- a/libsrc/visualization/vsfieldlines.cpp +++ b/libsrc/visualization/vsfieldlines.cpp @@ -15,7 +15,7 @@ namespace netgen { - extern shared_ptr mesh; + // extern shared_ptr mesh; @@ -442,6 +442,9 @@ namespace netgen void VisualSceneSolution :: BuildFieldLinesFromBox(Array & startpoints) { + shared_ptr mesh (wp_mesh); + if (!mesh) return; + if(fieldlines_startarea_parameter[0] > fieldlines_startarea_parameter[3] || fieldlines_startarea_parameter[1] > fieldlines_startarea_parameter[4] || fieldlines_startarea_parameter[2] > fieldlines_startarea_parameter[5]) @@ -469,6 +472,10 @@ namespace netgen void VisualSceneSolution :: BuildFieldLinesFromLine(Array & startpoints) { + shared_ptr mesh (wp_mesh); + if (!mesh) return; + + for (int i = 1; i <= startpoints.Size(); i++) { double s = double (rand()) / RAND_MAX; @@ -484,6 +491,9 @@ namespace netgen void VisualSceneSolution :: BuildFieldLinesFromFile(Array & startpoints) { + shared_ptr mesh (wp_mesh); + if (!mesh) return; + ifstream * infile; infile = new ifstream(fieldlines_filename.c_str()); @@ -563,6 +573,9 @@ namespace netgen void VisualSceneSolution :: BuildFieldLinesFromFace(Array & startpoints) { + shared_ptr mesh (wp_mesh); + if (!mesh) return; + Array elements_2d; //cout << "fieldlines_startface " << fieldlines_startface << endl; @@ -647,6 +660,9 @@ namespace netgen void VisualSceneSolution :: BuildFieldLinesPlot () { + shared_ptr mesh (wp_mesh); + if (!mesh) return; + if (fieldlinestimestamp >= solutiontimestamp) return; fieldlinestimestamp = solutiontimestamp; diff --git a/libsrc/visualization/vsmesh.cpp b/libsrc/visualization/vsmesh.cpp index 0216e513..69ad72db 100644 --- a/libsrc/visualization/vsmesh.cpp +++ b/libsrc/visualization/vsmesh.cpp @@ -15,7 +15,7 @@ namespace netgen { - extern shared_ptr mesh; + // extern shared_ptr mesh; extern NetgenGeometry * ng_geometry; VisualSceneMesh vsmesh; @@ -73,6 +73,10 @@ namespace netgen void VisualSceneMesh :: DrawScene () { + try + { + shared_ptr mesh(wp_mesh); + if (!mesh) { VisualScene::DrawScene(); @@ -301,12 +305,25 @@ namespace netgen } glFinish(); + + + } + catch (bad_weak_ptr e) + { + cout << "don't have a mesh to visualize" << endl; + VisualScene::DrawScene(); + } + } void VisualSceneMesh :: BuildScene (int zoomall) { - if (!mesh) + try + { + shared_ptr mesh(wp_mesh); + + if (!mesh) { VisualScene::BuildScene (zoomall); return; @@ -880,6 +897,13 @@ namespace netgen } vstimestamp = meshtimestamp; + } + catch (bad_weak_ptr e) + { + cout << "vsmesh::buildscene: don't have a mesh to visualize" << endl; + VisualScene::BuildScene (zoomall); + } + } @@ -887,6 +911,8 @@ namespace netgen void VisualSceneMesh :: BuildFilledList (bool names) { + shared_ptr mesh(wp_mesh); + static int timer = NgProfiler::CreateTimer ("Mesh::BuildFilledList"); NgProfiler::RegionTimer reg (timer); @@ -1275,6 +1301,8 @@ namespace netgen void VisualSceneMesh :: BuildLineList() { + shared_ptr mesh(wp_mesh); + static int timer = NgProfiler::CreateTimer ("Mesh::BuildLineList"); NgProfiler::RegionTimer reg (timer); @@ -1555,6 +1583,8 @@ namespace netgen void VisualSceneMesh :: BuildEdgeList() { + shared_ptr mesh(wp_mesh); + if (!lock) { lock = new NgLock (mesh->Mutex()); @@ -1730,6 +1760,8 @@ namespace netgen void VisualSceneMesh :: BuildTetList() { + shared_ptr mesh(wp_mesh); + if (tettimestamp > mesh->GetTimeStamp () && tettimestamp > vispar.clipping.timestamp ) return; @@ -2078,6 +2110,8 @@ namespace netgen void VisualSceneMesh :: BuildPrismList() { + shared_ptr mesh(wp_mesh); + if (prismtimestamp > mesh->GetTimeStamp () && prismtimestamp > vispar.clipping.timestamp ) return; @@ -2406,6 +2440,8 @@ namespace netgen void VisualSceneMesh :: BuildHexList() { + shared_ptr mesh(wp_mesh); + if (hextimestamp > mesh->GetTimeStamp () && hextimestamp > vispar.clipping.timestamp ) return; @@ -2614,6 +2650,8 @@ namespace netgen void VisualSceneMesh :: BuildPyramidList() { + shared_ptr mesh(wp_mesh); + if (pyramidtimestamp > mesh->GetTimeStamp () && pyramidtimestamp > vispar.clipping.timestamp ) return; @@ -2968,6 +3006,8 @@ namespace netgen void VisualSceneMesh :: BuildDomainSurfList() { + shared_ptr mesh(wp_mesh); + if (domainsurflist) glDeleteLists (domainsurflist, 1); @@ -3084,6 +3124,8 @@ namespace netgen void VisualSceneMesh :: MouseDblClick (int px, int py) { + shared_ptr mesh(wp_mesh); + BuildFilledList (true); MouseDblClickSelect(px,py,clipplane,backcolor,transformationmat,center,rad, @@ -3302,6 +3344,8 @@ namespace netgen int & selelement, int & selface, int & seledge, int & selpoint, int & selpoint2, int & locpi) { + auto mesh = vsmesh.GetMesh(); + int i, hits; // select surface triangle by mouse click diff --git a/libsrc/visualization/vssolution.cpp b/libsrc/visualization/vssolution.cpp index 751c2fd7..a8035923 100644 --- a/libsrc/visualization/vssolution.cpp +++ b/libsrc/visualization/vssolution.cpp @@ -14,9 +14,12 @@ #include + namespace netgen { - extern shared_ptr mesh; + + VisualSceneSolution vssolution; + // extern shared_ptr mesh; extern VisualSceneMesh vsmesh; @@ -60,7 +63,7 @@ namespace netgen surface_vector_timestamp = GetTimeStamp(); isosurface_timestamp = GetTimeStamp(); timetimestamp = GetTimeStamp(); - AddVisualizationScene ("solution", &vssolution); + // AddVisualizationScene ("solution", &vssolution); } VisualSceneSolution :: ~VisualSceneSolution () @@ -70,6 +73,8 @@ namespace netgen void VisualSceneSolution :: AddSolutionData (SolData * sd) { + shared_ptr mesh(wp_mesh); + NgLock meshlock1 (mesh->MajorMutex(), 1); int funcnr = -1; for (int i = 0; i < soldata.Size(); i++) @@ -152,6 +157,8 @@ namespace netgen void VisualSceneSolution :: SaveSolutionData (const char * filename) { + shared_ptr mesh(wp_mesh); + PrintMessage (1, "Write solution data to file ", filename); @@ -339,6 +346,10 @@ namespace netgen void VisualSceneSolution :: DrawScene () { + try + { + shared_ptr mesh(wp_mesh); + if (!mesh) { VisualScene::DrawScene(); @@ -600,6 +611,12 @@ namespace netgen // delete lock; // mem_lock.UnLock(); + } + catch (bad_weak_ptr e) + { + cout << "don't have a mesh to visualize" << endl; + VisualScene::DrawScene(); + } } @@ -678,6 +695,10 @@ namespace netgen void VisualSceneSolution :: BuildScene (int zoomall) { + try + { + shared_ptr mesh(wp_mesh); + if (!mesh) { VisualScene::BuildScene (zoomall); @@ -1090,10 +1111,18 @@ namespace netgen } clipplanetimestamp = max2 (vispar.clipping.timestamp, solutiontimestamp); + } + catch (bad_weak_ptr e) + { + cout << "vssolution::buildscene: don't have a mesh to visualize" << endl; + VisualScene::BuildScene (zoomall); + } } void VisualSceneSolution :: Draw1DElements () { + shared_ptr mesh(wp_mesh); + if (element1dlist) glDeleteLists (element1dlist, 1); @@ -1144,6 +1173,8 @@ namespace netgen void VisualSceneSolution :: DrawSurfaceElements () { + shared_ptr mesh(wp_mesh); + static int timer = NgProfiler::CreateTimer ("Solution::DrawSurfaceElements"); NgProfiler::RegionTimer reg (timer); @@ -1585,6 +1616,8 @@ namespace netgen void VisualSceneSolution :: DrawSurfaceElementLines () { + shared_ptr mesh(wp_mesh); + #ifdef PARALLELGL if (id == 0 && ntasks > 1) { @@ -1692,6 +1725,8 @@ namespace netgen const SolData * vsol, int comp) { + shared_ptr mesh(wp_mesh); + if (!draw_isosurface) return; if (!sol) return; @@ -1941,6 +1976,8 @@ namespace netgen const Point<3> & pmin, const Point<3> & pmax, const int sei, const SolData * vsol) { + shared_ptr mesh(wp_mesh); + int dir,dir1,dir2; double s,t; @@ -2051,6 +2088,8 @@ namespace netgen void VisualSceneSolution :: DrawSurfaceVectors () { + shared_ptr mesh(wp_mesh); + SurfaceElementIndex sei; const SolData * vsol = NULL; @@ -2385,6 +2424,8 @@ namespace netgen void VisualSceneSolution :: GetMinMax (int funcnr, int comp, double & minv, double & maxv) const { + shared_ptr mesh(wp_mesh); + static int timer1 = NgProfiler::CreateTimer ("getminmax, vol"); static int timer2 = NgProfiler::CreateTimer ("getminmax, surf"); @@ -2532,6 +2573,7 @@ namespace netgen const double xref[], const double x[], const double dxdxref[], int comp, double & val) const { + shared_ptr mesh(wp_mesh); double lam1 = xref[0]; double lam2 = xref[1]; @@ -2704,6 +2746,7 @@ namespace netgen double lam1, double lam2, double lam3, int comp, double & val) const { + shared_ptr mesh(wp_mesh); val = 0; bool ok = 0; @@ -2874,6 +2917,8 @@ namespace netgen double lam1, double lam2, double lam3, int comp, complex & val) const { + shared_ptr mesh(wp_mesh); + val = 0.0; bool ok = 0; @@ -3117,6 +3162,8 @@ namespace netgen double lam1, double lam2, int comp, double & val) const { + shared_ptr mesh(wp_mesh); + bool ok; if (comp == 0) { @@ -3349,6 +3396,8 @@ namespace netgen const double xref[], const double x[], const double dxdxref[], int comp, double & val) const { + shared_ptr mesh(wp_mesh); + double lam1 = xref[0], lam2 = xref[1]; bool ok; @@ -3596,6 +3645,8 @@ namespace netgen Vec<3> VisualSceneSolution :: GetSurfDeformation (SurfaceElementIndex elnr, int facetnr, double lam1, double lam2) const { + shared_ptr mesh(wp_mesh); + Vec<3> def; if (deform && vecfunction != -1) { @@ -3621,6 +3672,8 @@ namespace netgen void VisualSceneSolution :: GetPointDeformation (int pnum, Point<3> & p, SurfaceElementIndex elnr) const { + shared_ptr mesh(wp_mesh); + p = mesh->Point (pnum+1); if (deform && vecfunction != -1) { @@ -3659,6 +3712,8 @@ namespace netgen void VisualSceneSolution :: GetClippingPlaneTrigs (Array & trigs, Array & pts) { + shared_ptr mesh(wp_mesh); + static int timer_vals = NgProfiler::CreateTimer ("ClipPlaneTrigs - vertex values"); static int timer1 = NgProfiler::CreateTimer ("ClipPlaneTrigs1"); // static int timer1a = NgProfiler::CreateTimer ("ClipPlaneTrigs1a"); @@ -4000,6 +4055,8 @@ namespace netgen void VisualSceneSolution :: GetClippingPlaneGrid (Array & pts) { + shared_ptr mesh(wp_mesh); + Vec3d n(clipplane[0], clipplane[1], clipplane[2]); double mu = -clipplane[3] / n.Length2(); @@ -4056,6 +4113,8 @@ namespace netgen void VisualSceneSolution :: DrawClipPlaneTrigs () { + shared_ptr mesh(wp_mesh); + #ifdef PARALLELGL if (id == 0 && ntasks > 1) @@ -4764,6 +4823,7 @@ namespace netgen Tcl_Interp * interp, int argc, tcl_const char *argv[]) { + auto mesh = vssolution.GetMesh(); int i; char buf[1000]; buf[0] = 0; @@ -4850,6 +4910,62 @@ namespace netgen return TCL_OK; } + + + + + + +void Ng_ClearSolutionData () +{ +#ifdef OPENGL + // if (nodisplay) return; + vssolution.ClearSolutionData(); +#endif +} } +#include "../include/nginterface.h" + +// namespace netgen +// { +void Ng_InitSolutionData (Ng_SolutionData * soldata) +{ + soldata -> name = NULL; + soldata -> data = NULL; + soldata -> components = 1; + soldata -> dist = 1; + soldata -> order = 1; + soldata -> iscomplex = 0; + soldata -> draw_surface = 1; + soldata -> draw_volume = 1; + soldata -> soltype = NG_SOLUTION_NODAL; + soldata -> solclass = 0; +} + +void Ng_SetSolutionData (Ng_SolutionData * soldata) +{ +#ifdef OPENGL + // if (nodisplay) return; + // vssolution.ClearSolutionData (); + netgen::VisualSceneSolution::SolData * vss = new netgen::VisualSceneSolution::SolData; + + vss->name = new char[strlen (soldata->name)+1]; + strcpy (vss->name, soldata->name); + + vss->data = soldata->data; + vss->components = soldata->components; + vss->dist = soldata->dist; + vss->order = soldata->order; + vss->iscomplex = bool(soldata->iscomplex); + vss->draw_surface = soldata->draw_surface; + vss->draw_volume = soldata->draw_volume; + vss->soltype = netgen::VisualSceneSolution::SolType (soldata->soltype); + vss->solclass = soldata->solclass; + netgen::vssolution.AddSolutionData (vss); +#endif +} + +// } + #endif // NOTCL diff --git a/libsrc/visualization/vssolution.hpp b/libsrc/visualization/vssolution.hpp index eecb8154..a4e789b5 100644 --- a/libsrc/visualization/vssolution.hpp +++ b/libsrc/visualization/vssolution.hpp @@ -1,7 +1,8 @@ #ifndef FILE_VSSOLUTION #define FILE_VSSOLUTION - +namespace netgen +{ #ifndef SMALLLIB #ifndef NOTCL @@ -173,7 +174,7 @@ private: void BuildFieldLinesFromFace(Array & startpoints); void BuildFieldLinesFromBox(Array & startpoints); void BuildFieldLinesFromLine(Array & startpoints); - + weak_ptr wp_mesh; public: VisualSceneSolution (); virtual ~VisualSceneSolution (); @@ -182,6 +183,9 @@ public: virtual void DrawScene (); virtual void MouseDblClick (int px, int py); + void SetMesh (shared_ptr amesh) { wp_mesh = amesh; } + shared_ptr GetMesh () { return shared_ptr(wp_mesh); } + void BuildFieldLinesPlot (); void AddSolutionData (SolData * soldata); @@ -437,7 +441,7 @@ public: extern VisualSceneSolution vssolution; - +} #endif diff --git a/ng/ngpkg.cpp b/ng/ngpkg.cpp index 66a4e19f..a993068e 100644 --- a/ng/ngpkg.cpp +++ b/ng/ngpkg.cpp @@ -111,13 +111,10 @@ namespace netgen static VisualScene vscross; extern VisualSceneSurfaceMeshing vssurfacemeshing; - extern VisualSceneMesh vsmesh; extern VisualSceneMeshDoctor vsmeshdoc; static VisualSceneSpecPoints vsspecpoints; - VisualSceneSolution vssolution; - VisualScene *vs = &vscross; @@ -1279,6 +1276,7 @@ namespace netgen mesh = shared_ptr (hmesh); */ mesh = make_shared (); + vsmesh.SetMesh (mesh); int res = ng_geometry -> GenerateMesh (mesh, mparam, perfstepsstart, perfstepsend); // int res = ng_geometry -> GenerateMesh (mesh.Ptr(), mparam, perfstepsstart, perfstepsend); @@ -1845,7 +1843,7 @@ namespace netgen // if (strcmp (vismode, "surfmeshing") == 0) vs = &vssurfacemeshing; if (strcmp (vismode, "specpoints") == 0) vs = &vsspecpoints; - // if (strcmp (vismode, "solution") == 0) vs = &vssolution; + if (strcmp (vismode, "solution") == 0) vs = &vssolution; } } @@ -2737,44 +2735,6 @@ namespace netgen using namespace netgen; -void Ng_InitSolutionData (Ng_SolutionData * soldata) -{ - - soldata -> name = NULL; - soldata -> data = NULL; - soldata -> components = 1; - soldata -> dist = 1; - soldata -> order = 1; - soldata -> iscomplex = 0; - soldata -> draw_surface = 1; - soldata -> draw_volume = 1; - soldata -> soltype = NG_SOLUTION_NODAL; - soldata -> solclass = 0; -} - -void Ng_SetSolutionData (Ng_SolutionData * soldata) -{ -#ifdef OPENGL - if (nodisplay) - return; - // vssolution.ClearSolutionData (); - VisualSceneSolution::SolData * vss = new VisualSceneSolution::SolData; - - vss->name = new char[strlen (soldata->name)+1]; - strcpy (vss->name, soldata->name); - - vss->data = soldata->data; - vss->components = soldata->components; - vss->dist = soldata->dist; - vss->order = soldata->order; - vss->iscomplex = bool(soldata->iscomplex); - vss->draw_surface = soldata->draw_surface; - vss->draw_volume = soldata->draw_volume; - vss->soltype = VisualSceneSolution::SolType (soldata->soltype); - vss->solclass = soldata->solclass; - vssolution.AddSolutionData (vss); -#endif -} void Ng_SetMouseEventHandler (netgen::MouseEventHandler * handler) { @@ -2786,14 +2746,6 @@ void Ng_SetUserVisualizationObject (netgen::UserVisualizationObject * vis) vssolution.AddUserVisualizationObject (vis); } -void Ng_ClearSolutionData () -{ -#ifdef OPENGL - if (nodisplay) - return; - vssolution.ClearSolutionData(); -#endif -} diff --git a/nglib/nglib.cpp b/nglib/nglib.cpp index c7f5c898..7186f132 100644 --- a/nglib/nglib.cpp +++ b/nglib/nglib.cpp @@ -1221,10 +1221,9 @@ namespace netgen - void Render() - { - ; - } + void Render() { ; } + void MyOpenGLText (const char * text) { ; } + } // End of namespace netgen diff --git a/python/csg.py b/python/csg.py index 1324a0a7..32e79d07 100644 --- a/python/csg.py +++ b/python/csg.py @@ -2,7 +2,9 @@ from netgen import __platform if __platform.startswith('linux') or __platform.startswith('darwin'): # Linux or Mac OS X from libcsg.csg import * - from libmesh.meshing import * + from libcsgvis import * + import libmesh.meshing +# from libmesh.meshing import * if __platform.startswith('win'): # Windows from nglib.csg import *