mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 21:40:33 +05:00
order of d'tors for global variables: create VSSolution on demand, which is later
This commit is contained in:
parent
e33c859a43
commit
7e83edabf1
@ -4,6 +4,15 @@
|
||||
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
class TraceGlobal
|
||||
{
|
||||
string name;
|
||||
public:
|
||||
TraceGlobal(string _name) : name(_name) { cout << "init global " << name << endl; }
|
||||
~TraceGlobal() { cout << "exit global " << name << endl; }
|
||||
};
|
||||
|
||||
// stringstream emptystr;
|
||||
// ostream * testout = &emptystr;
|
||||
// testout -> clear(ios::failbit);
|
||||
@ -17,8 +26,10 @@ namespace netgen
|
||||
ostream * myerr = &cerr;
|
||||
|
||||
// some functions (visualization) still need a global mesh
|
||||
// TraceGlobal glob1("global1");
|
||||
DLL_HEADER shared_ptr<Mesh> mesh;
|
||||
DLL_HEADER shared_ptr<NetgenGeometry> ng_geometry;
|
||||
// TraceGlobal glob2("global2");
|
||||
|
||||
weak_ptr<Mesh> global_mesh;
|
||||
void SetGlobalMesh (shared_ptr<Mesh> m)
|
||||
|
@ -38,6 +38,7 @@ namespace netgen
|
||||
int argc, tcl_const char *argv[])
|
||||
|
||||
{
|
||||
auto & vssolution = netgen::GetVSSolution();
|
||||
if (argc >= 2)
|
||||
{
|
||||
if (strcmp (argv[1], "parameters") == 0)
|
||||
@ -306,6 +307,7 @@ namespace netgen
|
||||
int i;
|
||||
char buf[1000];
|
||||
buf[0] = 0;
|
||||
auto & vssolution = netgen::GetVSSolution();
|
||||
|
||||
if (argc >= 2)
|
||||
{
|
||||
|
@ -12,14 +12,22 @@
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
VisualSceneSolution vssolution;
|
||||
|
||||
DLL_HEADER VisualSceneSolution & GetVSSolution()
|
||||
{
|
||||
static VisualSceneSolution vssolution;
|
||||
return vssolution;
|
||||
}
|
||||
|
||||
|
||||
// extern shared_ptr<Mesh> mesh;
|
||||
extern VisualSceneMesh vsmesh;
|
||||
|
||||
|
||||
void AddUserVisualizationObject (UserVisualizationObject * vis)
|
||||
{
|
||||
vssolution.AddUserVisualizationObject (vis);
|
||||
// vssolution.AddUserVisualizationObject (vis);
|
||||
GetVSSolution().AddUserVisualizationObject (vis);
|
||||
}
|
||||
|
||||
|
||||
@ -38,6 +46,7 @@ namespace netgen
|
||||
VisualSceneSolution :: VisualSceneSolution ()
|
||||
: VisualScene()
|
||||
{
|
||||
// cout << "init VisualSceneSolution" << endl;
|
||||
surfellist = 0;
|
||||
linelist = 0;
|
||||
element1dlist = 0;
|
||||
@ -68,6 +77,7 @@ namespace netgen
|
||||
|
||||
VisualSceneSolution :: ~VisualSceneSolution ()
|
||||
{
|
||||
// cout << "exit VisualSceneSolution" << endl;
|
||||
ClearSolutionData();
|
||||
}
|
||||
|
||||
@ -416,7 +426,7 @@ namespace netgen
|
||||
else
|
||||
{
|
||||
glTranslatef (0.5, 0, 0);
|
||||
glRotatef(360 * vssolution.time, 0, 0, -1);
|
||||
glRotatef(360 * netgen::GetVSSolution().time, 0, 0, -1);
|
||||
if (fabs (maxval) > 1e-10)
|
||||
glScalef(0.5/maxval, 0.5/maxval, 0.5/maxval);
|
||||
else
|
||||
@ -4773,7 +4783,8 @@ void Ng_ClearSolutionData ()
|
||||
{
|
||||
#ifdef OPENGL
|
||||
// if (nodisplay) return;
|
||||
netgen::vssolution.ClearSolutionData();
|
||||
// netgen::vssolution.ClearSolutionData();
|
||||
netgen::GetVSSolution().ClearSolutionData();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -4810,7 +4821,8 @@ void Ng_SetSolutionData (Ng_SolutionData * soldata)
|
||||
vss->draw_volume = soldata->draw_volume;
|
||||
vss->soltype = netgen::VisualSceneSolution::SolType (soldata->soltype);
|
||||
vss->solclass = soldata->solclass;
|
||||
netgen::vssolution.AddSolutionData (vss);
|
||||
// netgen::vssolution.AddSolutionData (vss);
|
||||
netgen::GetVSSolution().AddSolutionData (vss);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -4824,7 +4836,8 @@ namespace netgen
|
||||
void Ng_Redraw (bool blocking)
|
||||
{
|
||||
#ifdef OPENGL
|
||||
netgen::vssolution.UpdateSolutionTimeStamp();
|
||||
//netgen::vssolution.UpdateSolutionTimeStamp();
|
||||
netgen::GetVSSolution().UpdateSolutionTimeStamp();
|
||||
netgen::Render(blocking);
|
||||
#endif
|
||||
}
|
||||
|
@ -447,7 +447,8 @@ public:
|
||||
|
||||
|
||||
|
||||
DLL_HEADER extern VisualSceneSolution vssolution;
|
||||
// DLL_HEADER extern VisualSceneSolution vssolution;
|
||||
DLL_HEADER extern VisualSceneSolution & GetVSSolution();
|
||||
|
||||
|
||||
}
|
||||
|
@ -470,7 +470,7 @@ namespace netgen
|
||||
const char * filename = argv[1];
|
||||
PrintMessage (1, "Save solution to file ", filename);
|
||||
|
||||
vssolution.SaveSolutionData (filename);
|
||||
netgen::GetVSSolution().SaveSolutionData (filename);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@ -1890,7 +1890,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 = &netgen::GetVSSolution();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2414,7 +2414,7 @@ void Ng_SetMouseEventHandler (netgen::MouseEventHandler * handler)
|
||||
|
||||
void Ng_SetUserVisualizationObject (netgen::UserVisualizationObject * vis)
|
||||
{
|
||||
vssolution.AddUserVisualizationObject (vis);
|
||||
netgen::GetVSSolution().AddUserVisualizationObject (vis);
|
||||
}
|
||||
|
||||
|
||||
@ -2651,7 +2651,7 @@ void PlayAnimFile(const char* name, int speed, int maxcnt)
|
||||
Tcl_Interp * interp,
|
||||
int argc, tcl_const char *argv[])
|
||||
{
|
||||
vssolution.BuildFieldLinesPlot();
|
||||
netgen::GetVSSolution().BuildFieldLinesPlot();
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user