Revision 752 branches/threaded2/src/nh99/model.cpp
model.cpp (revision 752)  

4  4 
* Author: David Fournier 
5  5 
* Copyright (c) 20082012 Regents of the University of California 
6  6 
*/ 
7 
#include <sstream> 

8 
#include <thread> 

9 
#include <cassert> 

7  10 
#include <admodel.h> 
8  11  
9 
int initial_params::num_initial_params=0;


12 
__thread int initial_params::num_initial_params = 0;


10  13  
11  14 
#if !defined(BIG_INIT_PARAMS) 
12 
const int initial_params::max_num_initial_params=4000;


13 
# if (__BORLANDC__ >= 0x0550)


14 
initial_params * initial_params::varsptr[4001]; // this should be a resizeable array


15 
# else


16 
initial_params * initial_params::varsptr[initial_params::max_num_initial_params+1]; // this should be a resizeable array


17 
# endif


15 
__thread const int initial_params::max_num_initial_params=4000;


16 
#if (__BORLANDC__ >= 0x0550)


17 
initial_params* initial_params::varsptr[4001]; // this should be a resizeable array


18 
#else


19 
initial_params* initial_params::varsptr[initial_params::max_num_initial_params+1]; // this should be a resizeable array


20 
#endif


18  21 
#else 
19 
const int initial_params::max_num_initial_params=250;


20 
adlist_ptr initial_params::varsptr(initial_params::max_num_initial_params);


22 
__thread const int initial_params::max_num_initial_params=250;


23 
__thread adlist_ptr* initial_params::varsptr = nullptr;


21  24 
#endif 
22 
int initial_params::max_number_phases=1;


23 
int initial_params::current_phase=1;


24 
int initial_params::restart_phase=0;


25 
int initial_params::sd_phase=0;


26 
int initial_params::mc_phase=0;


27 
int initial_params::mceval_phase=0;


25 
__thread int initial_params::max_number_phases = 1;


26 
__thread int initial_params::current_phase = 1;


27 
__thread int initial_params::restart_phase = 0;


28 
__thread int initial_params::sd_phase = 0;


29 
__thread int initial_params::mc_phase = 0;


30 
__thread int initial_params::mceval_phase = 0;


28  31 
int AD_gaussflag=0; 
29  32 
int ADqd_flag=0; 
30  33  
34 
__thread int initial_params::num_active_initial_params = 0; 

35  
31  36 
double initial_params::get_scalefactor(void) 
32  37 
{ 
33  38 
return scalefactor; 
...  ...  
37  42 
scalefactor=sf; 
38  43 
} 
39  44  
40 
dvector function_minimizer::convergence_criteria; 

41 
dvector function_minimizer::maximum_function_evaluations; 

42 
int function_minimizer::sd_flag; 

43 
adstring function_minimizer::user_data_file; 

44 
adstring function_minimizer::user_par_file; 

45 
__thread dvector* function_minimizer::convergence_criteria = nullptr; 

46 
__thread dvector* function_minimizer::maximum_function_evaluations = nullptr; 

47 
__thread int function_minimizer::sd_flag = 0; 

48 
__thread int function_minimizer::constraint_exit_number = 0; 

49 
__thread adstring* function_minimizer::user_data_file = nullptr; 

50 
__thread adstring* function_minimizer::user_par_file = nullptr; 

45  51  
46  52 
int withinbound(int lb,int n,int ub) 
47  53 
{ 
...  ...  
51  57 
return 0; 
52  58 
} 
53  59 

54 
initial_params::~initial_params() 

60 
initial_params::~initial_params() 

61 
{ 

62 
num_initial_params; 

63 
#if defined(USE_SHARE_FLAGS) 

64 
if (share_flags != nullptr) 

55  65 
{ 
56 
num_initial_params; 

57 
# if defined(USE_SHARE_FLAGS) 

58 
if (share_flags) 

59 
{ 

60 
delete share_flags; 

61 
share_flags=0; 

62 
} 

63 
# endif 

66 
delete share_flags; 

67 
share_flags = nullptr; 

64  68 
} 
69 
#endif: 

70 
if (varsptr) 

71 
{ 

72 
delete varsptr; 

73 
varsptr = nullptr; 

74 
} 
Also available in: Unified diff