mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
set tcl-variables only if values are changed
This commit is contained in:
parent
d1e9b89988
commit
e400c10f07
58
ng/ngpkg.cpp
58
ng/ngpkg.cpp
@ -680,14 +680,32 @@ namespace netgen
|
||||
int argc, tcl_const char *argv[])
|
||||
{
|
||||
char buf[20], lstring[200];
|
||||
static int prev_np = -1;
|
||||
static int prev_ne = -1;
|
||||
static int prev_nse = -1;
|
||||
|
||||
if (mesh)
|
||||
{
|
||||
if (prev_np != mesh->GetNP())
|
||||
{
|
||||
sprintf (buf, "%u", unsigned(mesh->GetNP()));
|
||||
Tcl_SetVar (interp, "::status_np", buf, 0);
|
||||
prev_np = mesh->GetNP();
|
||||
}
|
||||
|
||||
if (prev_ne != mesh->GetNE())
|
||||
{
|
||||
sprintf (buf, "%u", unsigned(mesh->GetNE()));
|
||||
Tcl_SetVar (interp, "::status_ne", buf, 0);
|
||||
prev_ne = mesh->GetNE();
|
||||
}
|
||||
|
||||
if (prev_nse != mesh->GetNSE())
|
||||
{
|
||||
sprintf (buf, "%u", unsigned(mesh->GetNSE()));
|
||||
Tcl_SetVar (interp, "::status_nse", buf, 0);
|
||||
prev_nse = mesh->GetNSE();
|
||||
}
|
||||
|
||||
auto tets_in_qualclass = mesh->GetQualityHistogram();
|
||||
lstring[0] = 0;
|
||||
@ -701,21 +719,57 @@ namespace netgen
|
||||
Tcl_SetVar (interp, "::status_tetqualclasses", lstring, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (prev_np != 0)
|
||||
{
|
||||
Tcl_SetVar (interp, "::status_np", "0", 0);
|
||||
prev_np = 0;
|
||||
}
|
||||
|
||||
if (prev_ne != 0)
|
||||
{
|
||||
Tcl_SetVar (interp, "::status_ne", "0", 0);
|
||||
prev_ne = 0;
|
||||
}
|
||||
|
||||
if (prev_nse != 0)
|
||||
{
|
||||
Tcl_SetVar (interp, "::status_nse", "0", 0);
|
||||
prev_nse = 0;
|
||||
}
|
||||
Tcl_SetVar (interp, "::status_tetqualclasses", "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0", 0);
|
||||
}
|
||||
|
||||
static string prev_working;
|
||||
string working = multithread.running ? "working" : " ";
|
||||
if (working != prev_working)
|
||||
{
|
||||
Tcl_SetVar (interp, "::status_working", working.c_str(), 0);
|
||||
prev_working = working;
|
||||
}
|
||||
|
||||
/*
|
||||
if (multithread.running)
|
||||
Tcl_SetVar (interp, "::status_working", "working", 0);
|
||||
else
|
||||
Tcl_SetVar (interp, "::status_working", " ", 0);
|
||||
*/
|
||||
|
||||
Tcl_SetVar (interp, "::status_task", const_cast<char *>(multithread.task), 0);
|
||||
sprintf (buf, "%lf", multithread.percent);
|
||||
static string prev_task;
|
||||
if (prev_task != string(multithread.task))
|
||||
{
|
||||
prev_task = multithread.task;
|
||||
Tcl_SetVar (interp, "::status_task", prev_task.c_str(), 0);
|
||||
}
|
||||
|
||||
static double prev_percent = -1;
|
||||
if (prev_percent != multithread.percent)
|
||||
{
|
||||
prev_percent = multithread.percent;
|
||||
sprintf (buf, "%lf", prev_percent);
|
||||
Tcl_SetVar (interp, "::status_percent", buf, 0);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
lock_guard<mutex> guard(tcl_todo_mutex);
|
||||
|
Loading…
Reference in New Issue
Block a user