Browse Subversion Repository
Diff of /EBSDConograph/src/marquardt_codes/levenberg_marquardt/stopx.cc
Parent Directory
| Revision Log
| Patch
| 48 |
{ |
{ |
| 49 |
return interrupted; |
return interrupted; |
| 50 |
} |
} |
|
|
|
|
// for GUI |
|
|
#include <sstream> |
|
|
#include <iomanip> |
|
|
#include <cmath> |
|
|
using namespace std; |
|
|
namespace |
|
|
{ |
|
|
const char *functionName = ""; |
|
|
int progIndiv = 0; |
|
|
int progTotal = 0; |
|
|
} |
|
|
void interruptCansel() { interrupted = 2; } |
|
|
void interruptSkip () { interrupted = 1; } |
|
|
void interruptClear () { interrupted = 0; } |
|
|
string getProgress() |
|
|
{ |
|
|
ostringstream oss; |
|
|
oss <<setw(3)<< ::progTotal <<setw(4)<< ::progIndiv <<"%: "<< ::functionName; |
|
|
return oss.str(); |
|
|
} |
|
|
void setProgress(const int indiv, const int total, const int span, const char *funcName) |
|
|
{ |
|
|
::progIndiv = indiv==0 ? 0 : max(::progIndiv, indiv); |
|
|
::progTotal = total + ::progIndiv * span/100; |
|
|
::functionName = funcName; |
|
|
} |
|
|
bool IS_CANSELED() |
|
|
{ |
|
|
return interrupted == 2; |
|
|
} |
|
|
void CHECK_INTERRUPTION() throw(const char*) |
|
|
{ |
|
|
if(IS_CANSELED()) { throw("abort"); } |
|
|
} |
|
|
|
Legend:
| Removed from v.7 |
|
| changed lines |
| |
Added in v.8 |
|
|
|