diff --git a/trick_sims/SIM_segments/RUN_test/input.py b/test/SIM_segments/RUN_test/input.py similarity index 89% rename from trick_sims/SIM_segments/RUN_test/input.py rename to test/SIM_segments/RUN_test/input.py index a157ba68..301517f0 100644 --- a/trick_sims/SIM_segments/RUN_test/input.py +++ b/test/SIM_segments/RUN_test/input.py @@ -2,10 +2,6 @@ def main(): drg0 = trick.DRAscii("Ball") - for param in [ 'position' ] : - for index in range(0,2) : - var = "ball.obj.state.output." + param + "[" + str(index) + "]" - drg0.add_variable(var) drg0.set_cycle(0.1) drg0.freq = trick.DR_Always drg0.thisown = 0 diff --git a/trick_sims/SIM_segments/S_define b/test/SIM_segments/S_define similarity index 65% rename from trick_sims/SIM_segments/S_define rename to test/SIM_segments/S_define index a6422d1e..4c0f4425 100644 --- a/trick_sims/SIM_segments/S_define +++ b/test/SIM_segments/S_define @@ -8,51 +8,9 @@ LIBRARY DEPENDENCIES: *************************************************************/ // Include the experimental Segmented Executive. Must be included before default_trick_sys.sm -#include "sim_objects/SegmentedExecutive.sm" +#include "SegmentedExecutive.sm" #include "sim_objects/default_trick_sys.sm" -##include "Ball++/L1/include/Ball.hh" - -/** - This class is the base ball class - */ -class ballSimObject : public Trick::SimObject { - - public: - /** The actual ball object */ - Ball obj ; - - /** Constructor to add the jobs */ - ballSimObject() { - ("default_data") obj.force.default_data() ; - ("default_data") obj.state.default_data() ; - - ("initialization") obj.state_init() ; - - ("derivative") obj.force_field() ; - ("derivative") obj.state_deriv() ; - ("integration") trick_ret = obj.state_integ() ; - ("post_integration") print_me() ; - - {BLUE} (10.0, "scheduled") trick_ret = obj.state_print() ; - {BLUE} (1.0, "freeze_scheduled") trick_ret = obj.state_print() ; - - ("shutdown") obj.shutdown() ; - } - - int print_me() { - message_publish(MSG_NORMAL, "integration run\n") ; - return 0 ; - } - -} ; - -// Instantiations -ballSimObject ball ; - -collect ball.obj.state.work.external_force = {ball.obj.force.output.force[0]}; -IntegLoopSimObject my_integ_loop(0.01, &ball, (void *)NULL); - class fswSimObject : public Trick::SimObject { public: @@ -72,6 +30,7 @@ class fswSimObject : public Trick::SimObject { } ; fswSimObject fsw ; +IntegLoopSimObject my_integ_loop(0.01, 0, &fsw, (void *)NULL); // Includes a derived Segment class, SegmentA ##include "SegmentedExecutive/include/ExampleSegments.hh" @@ -117,6 +76,7 @@ class segmentSimObject : public Trick::SimObject { segmentSimObject segments(trick_sys.sched, my_integ_loop.integ_sched) ; + // Connect objects void create_connections() { @@ -124,10 +84,6 @@ void create_connections() { exec_set_terminate_time(300.0) ; trick_sys.sched.set_freeze_frame(0.10) ; - // Set a default integrator. This statement in create connections allows this - // sim to run without an input file. - my_integ_loop.getIntegrator(Runge_Kutta_2, 4); - fsw.add_tag("A") ; fsw.add_tag_to_job("B", "scheduled_2") ; } diff --git a/test/SIM_segments/S_overrides.mk b/test/SIM_segments/S_overrides.mk new file mode 100644 index 00000000..6ca9ea96 --- /dev/null +++ b/test/SIM_segments/S_overrides.mk @@ -0,0 +1,3 @@ + +TRICK_CFLAGS += -I./models +TRICK_CXXFLAGS += -I./models diff --git a/share/trick/sim_objects/SegmentedExecutive.sm b/test/SIM_segments/SegmentedExecutive.sm similarity index 79% rename from share/trick/sim_objects/SegmentedExecutive.sm rename to test/SIM_segments/SegmentedExecutive.sm index 4668747b..f2ff921f 100644 --- a/share/trick/sim_objects/SegmentedExecutive.sm +++ b/test/SIM_segments/SegmentedExecutive.sm @@ -27,12 +27,13 @@ class SysSimObject : public Trick::SimObject { {TRK} P0 ("default_data") sched.process_sim_args() ; {TRK} ("default_data") sched.get_freeze_job(name + ".sched") ; + {TRK} P65534 ("initialization") exec_collect_init() ; - {TRK} P65534 ("initialization") sched.write_s_job_execution(NULL) ; {TRK} P65534 ("initialization") sched.write_s_run_summary(NULL) ; {TRK} P65535 ("initialization") sched.check_all_jobs_handled() ; {TRK} P65535 ("initialization") sched.check_all_job_cycle_times() ; {TRK} P65535 ("initialization") sched.create_threads() ; + {TRK} P65535 ("initialization") sched.write_s_job_execution(NULL) ; {TRK} P65535 ("initialization") sched.async_freeze_to_exec_command() ; // This is an additional job when using a segmented executive @@ -40,16 +41,15 @@ class SysSimObject : public Trick::SimObject { {TRK} P0 ("checkpoint") sched.checkpoint() ; {TRK} P0 ("post_checkpoint") sched.post_checkpoint() ; - {TRK} P0 ("restart") sched.restart() ; + + //{TRK} P0 ("restart") sched.restart() ; + {TRK} P65534 ("restart") exec_collect_init() ; #ifndef TRICK_NO_DMTCP {TRK} ("dmtcp_restart") sched.write_s_job_execution(NULL) ; {TRK} ("dmtcp_restart") sched.write_s_run_summary(NULL) ; #endif - // This is an additional job when using a segmentd executive - {TRK} ("top_of_frame") sched.segment_switch() ; - {TRK} ("system_moding") sched.sched_freeze_to_exec_command(false) ; {TRK} ("end_of_frame") sched.sched_freeze_to_exec_command(true) ; {TRK} ("end_of_frame") sched.async_freeze_to_exec_command() ; @@ -58,6 +58,7 @@ class SysSimObject : public Trick::SimObject { // required job to advance sim time {TRK} ("system_advance_sim_time") sched.advance_sim_time() ; + } private: @@ -67,6 +68,22 @@ class SysSimObject : public Trick::SimObject { SysSimObject trick_sys ; +class MonteCarloSimObject : public Trick::SimObject { + public: + Trick::MonteCarlo mc ; + + MonteCarloSimObject() { + + // Register the monte_carlo class as a scheduler with the main executive. + exec_register_scheduler(&mc) ; + + {TRK} P0 ("default_data") mc.process_sim_args() ; + {TRK} P0 ("initialization") mc.execute_monte() ; + {TRK} ("shutdown") mc.shutdown() ; + } +} +MonteCarloSimObject trick_mc ; + // define TRICK_NO_EXECUTIVE to exclude the default trick_sys object in default_sim_objects.sm #define TRICK_NO_EXECUTIVE diff --git a/trick_models/SegmentedExecutive/include/ExampleSegments.hh b/test/SIM_segments/models/SegmentedExecutive/include/ExampleSegments.hh similarity index 100% rename from trick_models/SegmentedExecutive/include/ExampleSegments.hh rename to test/SIM_segments/models/SegmentedExecutive/include/ExampleSegments.hh diff --git a/trick_models/SegmentedExecutive/include/Segment.hh b/test/SIM_segments/models/SegmentedExecutive/include/Segment.hh similarity index 98% rename from trick_models/SegmentedExecutive/include/Segment.hh rename to test/SIM_segments/models/SegmentedExecutive/include/Segment.hh index 4bedcc2b..5de160c4 100644 --- a/trick_models/SegmentedExecutive/include/Segment.hh +++ b/test/SIM_segments/models/SegmentedExecutive/include/Segment.hh @@ -25,6 +25,8 @@ class Segment { exit_job_class_str with the exit_jobs queue. This should be the normal constructor to use. */ Segment( std::string segment_name , std::string enter_job_class_str , std::string exit_job_class_str ) ; + virtual ~Segment() {} ; + /* getters and setters */ std::string get_segment_name() ; void set_segment_name(std::string in_segment_name) ; diff --git a/trick_models/SegmentedExecutive/include/SegmentedExecutive.hh b/test/SIM_segments/models/SegmentedExecutive/include/SegmentedExecutive.hh similarity index 95% rename from trick_models/SegmentedExecutive/include/SegmentedExecutive.hh rename to test/SIM_segments/models/SegmentedExecutive/include/SegmentedExecutive.hh index d793a8c6..31ca63a0 100644 --- a/trick_models/SegmentedExecutive/include/SegmentedExecutive.hh +++ b/test/SIM_segments/models/SegmentedExecutive/include/SegmentedExecutive.hh @@ -11,7 +11,7 @@ LIBRARY_DEPENDENCIES: #include #include #include -#include "sim_services/MonteCarlo/include/MonteCarlo.hh" +#include "trick/Executive.hh" #include "SegmentedExecutive/include/Segment.hh" /** @@ -22,7 +22,7 @@ frame, or switch segments immediately. namespace Trick { -class SegmentedExecutive : public Trick::MonteCarlo { +class SegmentedExecutive : public Trick::Executive { friend class InputProcessor ; friend void init_attrTrick__SegmentedExecutive() ; diff --git a/trick_models/SegmentedExecutive/src/ExampleSegments.cpp b/test/SIM_segments/models/SegmentedExecutive/src/ExampleSegments.cpp similarity index 100% rename from trick_models/SegmentedExecutive/src/ExampleSegments.cpp rename to test/SIM_segments/models/SegmentedExecutive/src/ExampleSegments.cpp diff --git a/trick_models/SegmentedExecutive/src/Segment.cpp b/test/SIM_segments/models/SegmentedExecutive/src/Segment.cpp similarity index 100% rename from trick_models/SegmentedExecutive/src/Segment.cpp rename to test/SIM_segments/models/SegmentedExecutive/src/Segment.cpp diff --git a/trick_models/SegmentedExecutive/src/SegmentedExecutive.cpp b/test/SIM_segments/models/SegmentedExecutive/src/SegmentedExecutive.cpp similarity index 100% rename from trick_models/SegmentedExecutive/src/SegmentedExecutive.cpp rename to test/SIM_segments/models/SegmentedExecutive/src/SegmentedExecutive.cpp diff --git a/trick_sims/SIM_segments/S_overrides.mk b/trick_sims/SIM_segments/S_overrides.mk deleted file mode 100644 index 53c0139a..00000000 --- a/trick_sims/SIM_segments/S_overrides.mk +++ /dev/null @@ -1,3 +0,0 @@ - -TRICK_CFLAGS += -I${TRICK_HOME}/trick_models -TRICK_CXXFLAGS += -I${TRICK_HOME}/trick_models