File: Optimizer_thread.cpp

package info (click to toggle)
cgal 6.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 144,952 kB
  • sloc: cpp: 811,597; ansic: 208,576; sh: 493; python: 411; makefile: 286; javascript: 174
file content (71 lines) | stat: -rw-r--r-- 1,285 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright (c) 2010 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
//
// $URL$
// $Id$
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s)     : Stephane Tayeb
//
//******************************************************************************
// File Description :
//******************************************************************************

#include "config_mesh_3.h"

#include <QElapsedTimer>
#include <QTimer>
#include "Optimizer_thread.h"
#include "Scene_c3t3_item.h"


Optimizer_thread::
Optimizer_thread(Optimization_function_interface* f, Scene_c3t3_item* item)
  : f_(f)
  , item_(item)
  , rc_()
  , time_(0)
  , timer_(new QTimer(this))
  , timer_period_(1)
{
  connect(timer_, SIGNAL(timeout()),
          this,   SLOT(emit_status()));
  timer_->start(static_cast<int>(timer_period_*1000));
}


Optimizer_thread::~Optimizer_thread()
{
  delete f_;
}


void
Optimizer_thread::
run()
{
  QElapsedTimer timer;
  timer.start();
  //SEGFAULT
  rc_ = f_->launch();
  time_ = double(timer.elapsed()) / 1000;
  Q_EMIT done(this);
}


void
Optimizer_thread::
stop()
{
  f_->stop();
}

void
Optimizer_thread::
emit_status()
{
  Q_EMIT (status_report(f_->status(timer_period_)));
}