mirror of
https://github.com/nasa/trick.git
synced 2024-12-23 06:52:26 +00:00
19025d77ad
Reorganized. Created a new top level include directory that will hold all of Trick's header files. Moved all of the Trick headers to this directory. Created a libexec directory that holds all of the executables that users don't need to execute directly. Changed all of the executables remaining in bin to start with "trick-". In the sim_services directories changed all source files to find the Trick headers in their new location. Since all of the include files are gone in sim_services, removed the src directories as well, moving all of the source files up a level. Moved the makefiles, docs, man, and other architecture independent files into a top level share directory. Renamed lib_${TRICK_HOST_CPU} to lib64 or lib depending on the platform we're currently on. refs #63
91 lines
2.6 KiB
C++
91 lines
2.6 KiB
C++
#include "trick/MonteCarlo.hh"
|
|
#include "trick/tc_proto.h"
|
|
|
|
Trick::MonteCarlo * the_mc ;
|
|
|
|
Trick::MonteCarlo::MonteCarlo() :
|
|
enabled(false),
|
|
dry_run(false),
|
|
localhost_as_remote(false),
|
|
custom_slave_dispatch(false),
|
|
timeout(120),
|
|
max_tries(2),
|
|
verbosity(INFORMATIONAL),
|
|
default_port_flag(1),
|
|
num_runs(0),
|
|
actual_num_runs(0),
|
|
num_results(0),
|
|
slave_id(0),
|
|
except_return(0)
|
|
{
|
|
the_mc = this;
|
|
|
|
slaves_head = NULL;
|
|
|
|
char hostname[HOST_NAME_MAX + 1];
|
|
gethostname(hostname, HOST_NAME_MAX);
|
|
machine_name = hostname;
|
|
|
|
memset(&listen_device, 0, sizeof(TCDevice)) ;
|
|
memset(&connection_device, 0, sizeof(TCDevice)) ;
|
|
memset(&data_listen_device, 0, sizeof(TCDevice)) ;
|
|
memset(&data_connection_device, 0, sizeof(TCDevice)) ;
|
|
|
|
listen_device.port = 7200;
|
|
connection_device.port = 7200;
|
|
|
|
listen_device.disable_handshaking = TC_COMM_TRUE;
|
|
connection_device.disable_handshaking = TC_COMM_TRUE;
|
|
|
|
data_listen_device.port = 7400;
|
|
data_connection_device.port = 7400;
|
|
|
|
data_listen_device.disable_handshaking = TC_COMM_TRUE;
|
|
data_connection_device.disable_handshaking = TC_COMM_TRUE;
|
|
|
|
tc_error(&listen_device, 0);
|
|
tc_error(&connection_device, 0);
|
|
tc_error(&data_listen_device, 0);
|
|
tc_error(&data_connection_device, 0);
|
|
|
|
int num_classes = 0;
|
|
class_map["monte_master_init"] = num_classes;
|
|
class_to_queue[num_classes++] = &master_init_queue;
|
|
|
|
class_map["monte_master_pre"] = num_classes;
|
|
class_to_queue[num_classes++] = &master_pre_queue;
|
|
|
|
class_map["monte_master_post"] = num_classes;
|
|
class_to_queue[num_classes++] = &master_post_queue;
|
|
|
|
class_map["monte_master_shutdown"] = num_classes;
|
|
class_to_queue[num_classes++] = &master_shutdown_queue;
|
|
|
|
class_map["monte_slave_init"] = num_classes;
|
|
class_to_queue[num_classes++] = &slave_init_queue;
|
|
|
|
class_map["monte_slave_pre"] = num_classes;
|
|
class_to_queue[num_classes++] = &slave_pre_queue;
|
|
|
|
class_map["monte_slave_post"] = num_classes;
|
|
class_to_queue[num_classes++] = &slave_post_queue;
|
|
|
|
class_map["monte_slave_shutdown"] = num_classes;
|
|
class_to_queue[num_classes++] = &slave_shutdown_queue;
|
|
|
|
}
|
|
|
|
Trick::MonteCarlo::~MonteCarlo() {
|
|
/* tc_error allocates memory in the constructor */
|
|
free(listen_device.error_handler) ;
|
|
free(connection_device.error_handler) ;
|
|
free(data_listen_device.error_handler) ;
|
|
free(data_connection_device.error_handler) ;
|
|
listen_device.error_handler = NULL ;
|
|
connection_device.error_handler = NULL ;
|
|
data_listen_device.error_handler = NULL ;
|
|
data_connection_device.error_handler = NULL ;
|
|
}
|
|
|
|
|