mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
vis-library
This commit is contained in:
parent
be8fa7286f
commit
c216e3f3ed
@ -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
|
||||
|
@ -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
|
||||
|
@ -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";
|
||||
|
||||
|
||||
|
||||
|
@ -483,11 +483,20 @@ namespace netgen
|
||||
CalcTransformationMatrices();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Hi () { cout << "hi from csgvis" << endl; }
|
||||
|
||||
#ifdef NG_PYTHON
|
||||
#include <boost/python.hpp>
|
||||
namespace bp = boost::python;
|
||||
|
||||
BOOST_PYTHON_MODULE(libcsgvis)
|
||||
{
|
||||
cout << "exporting csg-vis " << endl;
|
||||
bp::def("hi", &Hi);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -9,7 +9,8 @@
|
||||
#endif
|
||||
|
||||
#include "nginterface.h"
|
||||
#include "../visualization/soldata.hpp"
|
||||
// #include "../visualization/soldata.hpp"
|
||||
#include <visual.hpp>
|
||||
|
||||
|
||||
#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);
|
||||
|
@ -16,10 +16,11 @@ namespace netgen
|
||||
ostream * mycout = &cout;
|
||||
ostream * myerr = &cerr;
|
||||
|
||||
// some functions (visualization) still need a global mesh
|
||||
shared_ptr<Mesh> mesh;
|
||||
shared_ptr<NetgenGeometry> ng_geometry;
|
||||
|
||||
// Flags parameters;
|
||||
|
||||
|
||||
int silentflag = 0;
|
||||
int testmode = 0;
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
|
||||
extern shared_ptr<Mesh> 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));
|
||||
|
@ -1,3 +1,6 @@
|
||||
namespace netgen
|
||||
|
||||
{
|
||||
|
||||
class VisualSceneMeshDoctor : public VisualScene
|
||||
{
|
||||
@ -35,3 +38,5 @@ public:
|
||||
|
||||
|
||||
extern MeshDoctorParameters meshdoctor;
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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<Mesh> 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> mesh) { wp_mesh = mesh; }
|
||||
shared_ptr<Mesh> GetMesh () { return shared_ptr<Mesh>(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
|
||||
{
|
||||
|
@ -24,12 +24,7 @@ Visualization
|
||||
#include "mvdraw.hpp"
|
||||
|
||||
#include <complex>
|
||||
|
||||
namespace netgen
|
||||
{
|
||||
#include "vssolution.hpp"
|
||||
#include "meshdoc.hpp"
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -15,7 +15,7 @@
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
extern shared_ptr<Mesh> mesh;
|
||||
// extern shared_ptr<Mesh> mesh;
|
||||
|
||||
|
||||
|
||||
@ -442,6 +442,9 @@ namespace netgen
|
||||
|
||||
void VisualSceneSolution :: BuildFieldLinesFromBox(Array<Point3d> & startpoints)
|
||||
{
|
||||
shared_ptr<Mesh> 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<Point3d> & startpoints)
|
||||
{
|
||||
shared_ptr<Mesh> 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<Point3d> & startpoints)
|
||||
{
|
||||
shared_ptr<Mesh> 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<Point3d> & startpoints)
|
||||
{
|
||||
shared_ptr<Mesh> mesh (wp_mesh);
|
||||
if (!mesh) return;
|
||||
|
||||
Array<SurfaceElementIndex> elements_2d;
|
||||
|
||||
//cout << "fieldlines_startface " << fieldlines_startface << endl;
|
||||
@ -647,6 +660,9 @@ namespace netgen
|
||||
|
||||
void VisualSceneSolution :: BuildFieldLinesPlot ()
|
||||
{
|
||||
shared_ptr<Mesh> mesh (wp_mesh);
|
||||
if (!mesh) return;
|
||||
|
||||
if (fieldlinestimestamp >= solutiontimestamp)
|
||||
return;
|
||||
fieldlinestimestamp = solutiontimestamp;
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
namespace netgen
|
||||
{
|
||||
extern shared_ptr<Mesh> mesh;
|
||||
// extern shared_ptr<Mesh> mesh;
|
||||
extern NetgenGeometry * ng_geometry;
|
||||
|
||||
VisualSceneMesh vsmesh;
|
||||
@ -73,6 +73,10 @@ namespace netgen
|
||||
|
||||
void VisualSceneMesh :: DrawScene ()
|
||||
{
|
||||
try
|
||||
{
|
||||
shared_ptr<Mesh> 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> 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> 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> 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> mesh(wp_mesh);
|
||||
|
||||
if (!lock)
|
||||
{
|
||||
lock = new NgLock (mesh->Mutex());
|
||||
@ -1730,6 +1760,8 @@ namespace netgen
|
||||
|
||||
void VisualSceneMesh :: BuildTetList()
|
||||
{
|
||||
shared_ptr<Mesh> mesh(wp_mesh);
|
||||
|
||||
if (tettimestamp > mesh->GetTimeStamp () &&
|
||||
tettimestamp > vispar.clipping.timestamp )
|
||||
return;
|
||||
@ -2078,6 +2110,8 @@ namespace netgen
|
||||
|
||||
void VisualSceneMesh :: BuildPrismList()
|
||||
{
|
||||
shared_ptr<Mesh> mesh(wp_mesh);
|
||||
|
||||
if (prismtimestamp > mesh->GetTimeStamp () &&
|
||||
prismtimestamp > vispar.clipping.timestamp )
|
||||
return;
|
||||
@ -2406,6 +2440,8 @@ namespace netgen
|
||||
|
||||
void VisualSceneMesh :: BuildHexList()
|
||||
{
|
||||
shared_ptr<Mesh> mesh(wp_mesh);
|
||||
|
||||
if (hextimestamp > mesh->GetTimeStamp () &&
|
||||
hextimestamp > vispar.clipping.timestamp )
|
||||
return;
|
||||
@ -2614,6 +2650,8 @@ namespace netgen
|
||||
|
||||
void VisualSceneMesh :: BuildPyramidList()
|
||||
{
|
||||
shared_ptr<Mesh> mesh(wp_mesh);
|
||||
|
||||
if (pyramidtimestamp > mesh->GetTimeStamp () &&
|
||||
pyramidtimestamp > vispar.clipping.timestamp )
|
||||
return;
|
||||
@ -2968,6 +3006,8 @@ namespace netgen
|
||||
|
||||
void VisualSceneMesh :: BuildDomainSurfList()
|
||||
{
|
||||
shared_ptr<Mesh> mesh(wp_mesh);
|
||||
|
||||
if (domainsurflist)
|
||||
glDeleteLists (domainsurflist, 1);
|
||||
|
||||
@ -3084,6 +3124,8 @@ namespace netgen
|
||||
|
||||
void VisualSceneMesh :: MouseDblClick (int px, int py)
|
||||
{
|
||||
shared_ptr<Mesh> 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
|
||||
|
@ -14,9 +14,12 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
|
||||
namespace netgen
|
||||
{
|
||||
extern shared_ptr<Mesh> mesh;
|
||||
|
||||
VisualSceneSolution vssolution;
|
||||
// extern shared_ptr<Mesh> 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> 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> mesh(wp_mesh);
|
||||
|
||||
PrintMessage (1, "Write solution data to file ", filename);
|
||||
|
||||
|
||||
@ -339,6 +346,10 @@ namespace netgen
|
||||
|
||||
void VisualSceneSolution :: DrawScene ()
|
||||
{
|
||||
try
|
||||
{
|
||||
shared_ptr<Mesh> 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> 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> mesh(wp_mesh);
|
||||
|
||||
if (element1dlist)
|
||||
glDeleteLists (element1dlist, 1);
|
||||
|
||||
@ -1144,6 +1173,8 @@ namespace netgen
|
||||
|
||||
void VisualSceneSolution :: DrawSurfaceElements ()
|
||||
{
|
||||
shared_ptr<Mesh> 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> mesh(wp_mesh);
|
||||
|
||||
#ifdef PARALLELGL
|
||||
if (id == 0 && ntasks > 1)
|
||||
{
|
||||
@ -1692,6 +1725,8 @@ namespace netgen
|
||||
const SolData * vsol,
|
||||
int comp)
|
||||
{
|
||||
shared_ptr<Mesh> 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> mesh(wp_mesh);
|
||||
|
||||
int dir,dir1,dir2;
|
||||
double s,t;
|
||||
|
||||
@ -2051,6 +2088,8 @@ namespace netgen
|
||||
|
||||
void VisualSceneSolution :: DrawSurfaceVectors ()
|
||||
{
|
||||
shared_ptr<Mesh> 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> 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> 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> mesh(wp_mesh);
|
||||
|
||||
val = 0;
|
||||
bool ok = 0;
|
||||
@ -2874,6 +2917,8 @@ namespace netgen
|
||||
double lam1, double lam2, double lam3,
|
||||
int comp, complex<double> & val) const
|
||||
{
|
||||
shared_ptr<Mesh> 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> 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> 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> 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> mesh(wp_mesh);
|
||||
|
||||
p = mesh->Point (pnum+1);
|
||||
if (deform && vecfunction != -1)
|
||||
{
|
||||
@ -3659,6 +3712,8 @@ namespace netgen
|
||||
void VisualSceneSolution :: GetClippingPlaneTrigs (Array<ClipPlaneTrig> & trigs,
|
||||
Array<ClipPlanePoint> & pts)
|
||||
{
|
||||
shared_ptr<Mesh> 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<ClipPlanePoint> & pts)
|
||||
{
|
||||
shared_ptr<Mesh> 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> 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
|
||||
|
@ -1,7 +1,8 @@
|
||||
#ifndef FILE_VSSOLUTION
|
||||
#define FILE_VSSOLUTION
|
||||
|
||||
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
#ifndef SMALLLIB
|
||||
#ifndef NOTCL
|
||||
@ -173,7 +174,7 @@ private:
|
||||
void BuildFieldLinesFromFace(Array<Point3d> & startpoints);
|
||||
void BuildFieldLinesFromBox(Array<Point3d> & startpoints);
|
||||
void BuildFieldLinesFromLine(Array<Point3d> & startpoints);
|
||||
|
||||
weak_ptr<Mesh> 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<Mesh> amesh) { wp_mesh = amesh; }
|
||||
shared_ptr<Mesh> GetMesh () { return shared_ptr<Mesh>(wp_mesh); }
|
||||
|
||||
void BuildFieldLinesPlot ();
|
||||
|
||||
void AddSolutionData (SolData * soldata);
|
||||
@ -437,7 +441,7 @@ public:
|
||||
extern VisualSceneSolution vssolution;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
52
ng/ngpkg.cpp
52
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<Mesh> (hmesh);
|
||||
*/
|
||||
mesh = make_shared<Mesh> ();
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1221,10 +1221,9 @@ namespace netgen
|
||||
|
||||
|
||||
|
||||
void Render()
|
||||
{
|
||||
;
|
||||
}
|
||||
void Render() { ; }
|
||||
void MyOpenGLText (const char * text) { ; }
|
||||
|
||||
} // End of namespace netgen
|
||||
|
||||
|
||||
|
@ -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 *
|
||||
|
Loading…
Reference in New Issue
Block a user