mesh for vis

This commit is contained in:
Joachim Schoeberl 2015-01-08 21:18:33 +00:00
parent 537a10945a
commit 0f493c6c14
12 changed files with 89 additions and 56 deletions

View File

@ -158,9 +158,11 @@ void Ng_LoadMeshFromStream ( istream & input )
{
mesh.reset (new Mesh());
mesh -> Load(input);
/*
vssolution.SetMesh(mesh);
vsmesh.SetMesh(mesh);
*/
SetGlobalMesh (mesh);
for (int i = 0; i < geometryregister.Size(); i++)
{
NetgenGeometry * hgeom = geometryregister[i]->LoadFromMeshFile (input);
@ -2345,3 +2347,10 @@ void Ng_GetArgs (int & argc, char ** &argv)
argc = h_argc;
argv = h_argv;
}
void LinkFunction ()
{
Ng_Redraw();
}

View File

@ -25,8 +25,9 @@ namespace netgen
shared_ptr<Mesh> hmesh = netgen::mesh;
netgen::mesh = mesh;
vssolution.SetMesh(mesh);
vsmesh.SetMesh(mesh);
// vssolution.SetMesh(mesh);
// vsmesh.SetMesh(mesh);
SetGlobalMesh (mesh);
return hmesh;
}
@ -59,8 +60,9 @@ namespace netgen
netgen::mesh = make_shared<Mesh>();
netgen::mesh -> Load (ist);
mesh = netgen::mesh;
vssolution.SetMesh(mesh);
vsmesh.SetMesh(mesh);
// vssolution.SetMesh(mesh);
// vsmesh.SetMesh(mesh);
SetGlobalMesh (mesh);
}
void Ngx_Mesh :: SaveMesh (ostream & ost) const

View File

@ -20,6 +20,8 @@ namespace netgen
shared_ptr<Mesh> mesh;
shared_ptr<NetgenGeometry> ng_geometry;
weak_ptr<Mesh> global_mesh;
// Flags parameters;
int silentflag = 0;
int testmode = 0;

View File

@ -52,6 +52,14 @@ namespace netgen
extern int h_argc;
extern char ** h_argv;
extern weak_ptr<Mesh> global_mesh;
inline void SetGlobalMesh (shared_ptr<Mesh> m)
{
cout << "set global mesh" << endl;
global_mesh = m;
}
}
#endif

View File

@ -154,7 +154,7 @@ void ExportNetgenMeshing()
)
*/
.def ("BoundaryLayer", FunctionPointer
([](Mesh & self, int bc, double thickness, string material)
([](Mesh & self, int bc, double thickness, int volnr, string material)
{
BoundaryLayerParameters blp;
@ -174,7 +174,8 @@ void ExportNetgenMeshing()
maxind = max (maxind, self[ei].GetIndex());
cout << "maxind = " << maxind << endl;
self.SetMaterial (maxind+1, material.c_str());
blp.matnr = maxind+1;
blp.new_matnr = maxind+1;
blp.bulk_matnr = volnr;
GenerateBoundaryLayer (self, blp);
}
))

View File

@ -6,14 +6,20 @@ include_HEADERS = soldata.hpp
AM_CPPFLAGS = $(MPI_INCLUDES) -I$(top_srcdir)/libsrc/include -DOPENGL -D$(TOGL_WINDOWINGSYSTEM) $(OCCFLAGS) $(TCL_INCLUDES)
METASOURCES = AUTO
if NGGUI
lib_LTLIBRARIES = libvisual.la
libvisual_la_SOURCES =
if NGGUI
libvisual_la_LIBADD = $(LIBGLU) $(TCL_LIB_SPEC)
libvisual_la_SOURCES += meshdoc.cpp mvdraw.cpp \
vsfieldlines.cpp vsmesh.cpp vssolution.cpp importsolution.cpp visualpkg.cpp
else
libvisual_la_SOURCES += visual_dummy.cpp
endif
libvisual_la_SOURCES = meshdoc.cpp mvdraw.cpp \
vsfieldlines.cpp vsmesh.cpp vssolution.cpp importsolution.cpp visualpkg.cpp

View File

@ -156,7 +156,7 @@ namespace netgen
double minh, maxh; // for meshsize coloring
weak_ptr<Mesh> wp_mesh;
// weak_ptr<Mesh> wp_mesh;
public:
VisualSceneMesh ();
@ -166,8 +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 SetMesh (shared_ptr<Mesh> mesh) { wp_mesh = mesh; }
// shared_ptr<Mesh> GetMesh () { return shared_ptr<Mesh>(wp_mesh); }
shared_ptr<Mesh> GetMesh () const { return shared_ptr<Mesh>(global_mesh); }
void SetMouseEventHandler (MouseEventHandler * handler)
{ user_me_handler = handler; }

View File

@ -303,7 +303,6 @@ namespace netgen
Tcl_Interp * interp,
int argc, tcl_const char *argv[])
{
auto mesh = vssolution.GetMesh();
int i;
char buf[1000];
buf[0] = 0;
@ -366,6 +365,7 @@ namespace netgen
if (strcmp (argv[1], "getdimension") == 0)
{
auto mesh = vssolution.GetMesh();
sprintf (buf, "%d", mesh->GetDimension());
}
}

View File

@ -442,7 +442,7 @@ namespace netgen
void VisualSceneSolution :: BuildFieldLinesFromBox(Array<Point3d> & startpoints)
{
shared_ptr<Mesh> mesh (wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
if (!mesh) return;
if(fieldlines_startarea_parameter[0] > fieldlines_startarea_parameter[3] ||
@ -472,7 +472,7 @@ namespace netgen
void VisualSceneSolution :: BuildFieldLinesFromLine(Array<Point3d> & startpoints)
{
shared_ptr<Mesh> mesh (wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
if (!mesh) return;
@ -491,7 +491,7 @@ namespace netgen
void VisualSceneSolution :: BuildFieldLinesFromFile(Array<Point3d> & startpoints)
{
shared_ptr<Mesh> mesh (wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
if (!mesh) return;
ifstream * infile;
@ -573,7 +573,7 @@ namespace netgen
void VisualSceneSolution :: BuildFieldLinesFromFace(Array<Point3d> & startpoints)
{
shared_ptr<Mesh> mesh (wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
if (!mesh) return;
Array<SurfaceElementIndex> elements_2d;
@ -660,7 +660,7 @@ namespace netgen
void VisualSceneSolution :: BuildFieldLinesPlot ()
{
shared_ptr<Mesh> mesh (wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
if (!mesh) return;
if (fieldlinestimestamp >= solutiontimestamp)

View File

@ -75,7 +75,7 @@ namespace netgen
{
try
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
if (!mesh)
{
@ -91,6 +91,7 @@ namespace netgen
BuildScene();
glEnable(GL_DEPTH_TEST);
glClearColor(backcolor, backcolor, backcolor, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@ -321,7 +322,7 @@ namespace netgen
{
try
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
if (!mesh)
{
@ -911,7 +912,7 @@ namespace netgen
void VisualSceneMesh :: BuildFilledList (bool names)
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
static int timer = NgProfiler::CreateTimer ("Mesh::BuildFilledList");
NgProfiler::RegionTimer reg (timer);
@ -1301,7 +1302,7 @@ namespace netgen
void VisualSceneMesh :: BuildLineList()
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
static int timer = NgProfiler::CreateTimer ("Mesh::BuildLineList");
NgProfiler::RegionTimer reg (timer);
@ -1583,7 +1584,7 @@ namespace netgen
void VisualSceneMesh :: BuildEdgeList()
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
if (!lock)
{
@ -1760,7 +1761,7 @@ namespace netgen
void VisualSceneMesh :: BuildTetList()
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
if (tettimestamp > mesh->GetTimeStamp () &&
tettimestamp > vispar.clipping.timestamp )
@ -2110,7 +2111,7 @@ namespace netgen
void VisualSceneMesh :: BuildPrismList()
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
if (prismtimestamp > mesh->GetTimeStamp () &&
prismtimestamp > vispar.clipping.timestamp )
@ -2440,7 +2441,7 @@ namespace netgen
void VisualSceneMesh :: BuildHexList()
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
if (hextimestamp > mesh->GetTimeStamp () &&
hextimestamp > vispar.clipping.timestamp )
@ -2650,7 +2651,7 @@ namespace netgen
void VisualSceneMesh :: BuildPyramidList()
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
if (pyramidtimestamp > mesh->GetTimeStamp () &&
pyramidtimestamp > vispar.clipping.timestamp )
@ -3006,7 +3007,7 @@ namespace netgen
void VisualSceneMesh :: BuildDomainSurfList()
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
if (domainsurflist)
glDeleteLists (domainsurflist, 1);
@ -3124,7 +3125,7 @@ namespace netgen
void VisualSceneMesh :: MouseDblClick (int px, int py)
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
BuildFilledList (true);
@ -3553,7 +3554,8 @@ void ExportMeshVis()
([](shared_ptr<Mesh> mesh)
{
auto vs = make_shared<VisualSceneMesh>();
vs->SetMesh(mesh);
// vs->SetMesh(mesh);
SetGlobalMesh (mesh);
return vs;
}));

View File

@ -68,15 +68,16 @@ namespace netgen
ClearSolutionData();
}
/*
void VisualSceneSolution :: SetMesh (shared_ptr<Mesh> amesh)
{
wp_mesh = amesh;
}
*/
void VisualSceneSolution :: AddSolutionData (SolData * sd)
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
NgLock meshlock1 (mesh->MajorMutex(), 1);
int funcnr = -1;
@ -160,7 +161,7 @@ namespace netgen
void VisualSceneSolution :: SaveSolutionData (const char * filename)
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
PrintMessage (1, "Write solution data to file ", filename);
@ -351,7 +352,7 @@ namespace netgen
{
try
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
if (!mesh)
{
@ -700,7 +701,7 @@ namespace netgen
{
try
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
if (!mesh)
{
@ -1124,7 +1125,7 @@ namespace netgen
void VisualSceneSolution :: Draw1DElements ()
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
if (element1dlist)
glDeleteLists (element1dlist, 1);
@ -1176,7 +1177,7 @@ namespace netgen
void VisualSceneSolution :: DrawSurfaceElements ()
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
static int timer = NgProfiler::CreateTimer ("Solution::DrawSurfaceElements");
NgProfiler::RegionTimer reg (timer);
@ -1619,7 +1620,7 @@ namespace netgen
void VisualSceneSolution :: DrawSurfaceElementLines ()
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
#ifdef PARALLELGL
if (id == 0 && ntasks > 1)
@ -1728,7 +1729,7 @@ namespace netgen
const SolData * vsol,
int comp)
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
if (!draw_isosurface) return;
if (!sol) return;
@ -1979,7 +1980,7 @@ namespace netgen
const Point<3> & pmin, const Point<3> & pmax,
const int sei, const SolData * vsol)
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
int dir,dir1,dir2;
double s,t;
@ -2091,7 +2092,7 @@ namespace netgen
void VisualSceneSolution :: DrawSurfaceVectors ()
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
SurfaceElementIndex sei;
@ -2427,7 +2428,7 @@ namespace netgen
void VisualSceneSolution ::
GetMinMax (int funcnr, int comp, double & minv, double & maxv) const
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
static int timer1 = NgProfiler::CreateTimer ("getminmax, vol");
static int timer2 = NgProfiler::CreateTimer ("getminmax, surf");
@ -2576,7 +2577,7 @@ namespace netgen
const double xref[], const double x[], const double dxdxref[],
int comp, double & val) const
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
double lam1 = xref[0];
double lam2 = xref[1];
@ -2749,7 +2750,7 @@ namespace netgen
double lam1, double lam2, double lam3,
int comp, double & val) const
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
val = 0;
bool ok = 0;
@ -2920,7 +2921,7 @@ namespace netgen
double lam1, double lam2, double lam3,
int comp, complex<double> & val) const
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
val = 0.0;
bool ok = 0;
@ -3165,7 +3166,7 @@ namespace netgen
double lam1, double lam2,
int comp, double & val) const
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
bool ok;
if (comp == 0)
@ -3399,7 +3400,7 @@ namespace netgen
const double xref[], const double x[], const double dxdxref[],
int comp, double & val) const
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
double lam1 = xref[0], lam2 = xref[1];
@ -3648,7 +3649,7 @@ namespace netgen
Vec<3> VisualSceneSolution ::
GetSurfDeformation (SurfaceElementIndex elnr, int facetnr, double lam1, double lam2) const
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
Vec<3> def;
if (deform && vecfunction != -1)
@ -3675,7 +3676,7 @@ namespace netgen
void VisualSceneSolution :: GetPointDeformation (int pnum, Point<3> & p,
SurfaceElementIndex elnr) const
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
p = mesh->Point (pnum+1);
if (deform && vecfunction != -1)
@ -3715,7 +3716,7 @@ namespace netgen
void VisualSceneSolution :: GetClippingPlaneTrigs (Array<ClipPlaneTrig> & trigs,
Array<ClipPlanePoint> & pts)
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
static int timer_vals = NgProfiler::CreateTimer ("ClipPlaneTrigs - vertex values");
static int timer1 = NgProfiler::CreateTimer ("ClipPlaneTrigs1");
@ -4058,7 +4059,7 @@ namespace netgen
void VisualSceneSolution :: GetClippingPlaneGrid (Array<ClipPlanePoint> & pts)
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
Vec3d n(clipplane[0], clipplane[1], clipplane[2]);
@ -4116,7 +4117,7 @@ namespace netgen
void VisualSceneSolution :: DrawClipPlaneTrigs ()
{
shared_ptr<Mesh> mesh(wp_mesh);
shared_ptr<Mesh> mesh = GetMesh();
#ifdef PARALLELGL

View File

@ -177,7 +177,7 @@ private:
void BuildFieldLinesFromFace(Array<Point3d> & startpoints);
void BuildFieldLinesFromBox(Array<Point3d> & startpoints);
void BuildFieldLinesFromLine(Array<Point3d> & startpoints);
weak_ptr<Mesh> wp_mesh;
// weak_ptr<Mesh> wp_mesh;
public:
VisualSceneSolution ();
virtual ~VisualSceneSolution ();
@ -186,8 +186,9 @@ public:
virtual void DrawScene ();
virtual void MouseDblClick (int px, int py);
void SetMesh (shared_ptr<Mesh> amesh);
shared_ptr<Mesh> GetMesh () { return shared_ptr<Mesh>(wp_mesh); }
// void SetMesh (shared_ptr<Mesh> amesh);
// shared_ptr<Mesh> GetMesh () { return shared_ptr<Mesh>(wp_mesh); }
shared_ptr<Mesh> GetMesh () const { return shared_ptr<Mesh>(global_mesh); }
void BuildFieldLinesPlot ();