77#include < chrono>
88#include < iostream>
99
10- namespace diffeq ::examples {
11-
1210/* *
1311 * @brief Example usage patterns for the general integration interface
1412 *
@@ -21,12 +19,12 @@ namespace diffeq::examples {
2119 */
2220template <system_state StateType>
2321auto create_portfolio_interface () {
24- auto interface = interfaces::make_integration_interface<StateType>();
22+ auto interface = diffeq:: interfaces::make_integration_interface<StateType>();
2523
2624 // Example: Market data signal causes continuous trajectory shift
2725 interface->template register_signal_influence <double >(
2826 " price_update" ,
29- interfaces::IntegrationInterface<StateType>::InfluenceMode::CONTINUOUS_SHIFT,
27+ diffeq:: interfaces::IntegrationInterface<StateType>::InfluenceMode::CONTINUOUS_SHIFT,
3028 [](const double & new_price, StateType& state, auto t) {
3129 // Modify portfolio dynamics based on price update
3230 if (state.size () >= 3 ) {
@@ -42,7 +40,7 @@ auto create_portfolio_interface() {
4240 // Example: Risk alert causes discrete state modification
4341 interface->template register_signal_influence <std::string>(
4442 " risk_alert" ,
45- interfaces::IntegrationInterface<StateType>::InfluenceMode::DISCRETE_EVENT,
43+ diffeq:: interfaces::IntegrationInterface<StateType>::InfluenceMode::DISCRETE_EVENT,
4644 [](const std::string& alert_type, StateType& state, auto t) {
4745 if (alert_type == " high_volatility" && state.size () >= 3 ) {
4846 // Reduce all positions by 10%
@@ -76,12 +74,12 @@ auto create_portfolio_interface() {
7674 */
7775template <system_state StateType>
7876auto create_robotics_interface () {
79- auto interface = interfaces::make_integration_interface<StateType>();
77+ auto interface = diffeq:: interfaces::make_integration_interface<StateType>();
8078
8179 // Example: Control command causes discrete position target update
8280 interface->template register_signal_influence <std::vector<double >>(
8381 " control_command" ,
84- interfaces::IntegrationInterface<StateType>::InfluenceMode::DISCRETE_EVENT,
82+ diffeq:: interfaces::IntegrationInterface<StateType>::InfluenceMode::DISCRETE_EVENT,
8583 [](const std::vector<double >& targets, StateType& state, auto t) {
8684 // Update target positions (assuming state has position targets)
8785 size_t n_joints = std::min (targets.size (), state.size () / 3 );
@@ -98,7 +96,7 @@ auto create_robotics_interface() {
9896 // Example: Emergency stop signal
9997 interface->template register_signal_influence <bool >(
10098 " emergency_stop" ,
101- interfaces::IntegrationInterface<StateType>::InfluenceMode::DISCRETE_EVENT,
99+ diffeq:: interfaces::IntegrationInterface<StateType>::InfluenceMode::DISCRETE_EVENT,
102100 [](const bool & stop, StateType& state, auto t) {
103101 if (stop) {
104102 // Set all velocities to zero
@@ -136,12 +134,12 @@ auto create_robotics_interface() {
136134 */
137135template <system_state StateType>
138136auto create_scientific_interface () {
139- auto interface = interfaces::make_integration_interface<StateType>();
137+ auto interface = diffeq:: interfaces::make_integration_interface<StateType>();
140138
141139 // Example: Parameter update from external optimization
142140 interface->template register_signal_influence <double >(
143141 " parameter_update" ,
144- interfaces::IntegrationInterface<StateType>::InfluenceMode::PARAMETER_UPDATE,
142+ diffeq:: interfaces::IntegrationInterface<StateType>::InfluenceMode::PARAMETER_UPDATE,
145143 [](const double & new_param, StateType& state, auto t) {
146144 // Update system parameters affecting dynamics
147145 // This could modify integration tolerances, system constants, etc.
@@ -151,7 +149,7 @@ auto create_scientific_interface() {
151149 // Example: Data logging triggered by external events
152150 interface->template register_signal_influence <std::string>(
153151 " log_trigger" ,
154- interfaces::IntegrationInterface<StateType>::InfluenceMode::OUTPUT_TRIGGER,
152+ diffeq:: interfaces::IntegrationInterface<StateType>::InfluenceMode::OUTPUT_TRIGGER,
155153 [](const std::string& log_type, StateType& state, auto t) {
156154 // This will trigger all output streams immediately
157155 }
@@ -221,19 +219,17 @@ void demonstrate_usage(StateType initial_state) {
221219 std::cout << " Integration completed successfully!" << std::endl;
222220}
223221
224- } // namespace diffeq::examples
225-
226222int main () {
227223 std::cout << " === diffeq Integration Interface Examples ===" << std::endl;
228224
229225 // Example with vector state
230226 std::vector<double > initial_portfolio = {1000.0 , 2000.0 , 1500.0 };
231- diffeq::examples:: demonstrate_usage (initial_portfolio);
227+ demonstrate_usage (initial_portfolio);
232228
233229 std::cout << " \n === Robotics Interface Example ===" << std::endl;
234230
235231 // Create robotics interface
236- auto robotics_interface = diffeq::examples:: create_robotics_interface<std::vector<double >>();
232+ auto robotics_interface = create_robotics_interface<std::vector<double >>();
237233
238234 // Define robot dynamics
239235 auto robot_ode = [](double t, const std::vector<double >& y, std::vector<double >& dydt) {
@@ -243,7 +239,7 @@ int main() {
243239 };
244240
245241 auto signal_aware_robot_ode = robotics_interface->make_signal_aware_ode (robot_ode);
246- auto robot_integrator = diffeq::make_rk4 <std::vector<double >>(signal_aware_robot_ode);
242+ auto robot_integrator = diffeq::make_rk45 <std::vector<double >>(signal_aware_robot_ode);
247243
248244 std::vector<double > robot_state = {0.1 , 0.0 }; // [angle, angular_velocity]
249245 auto robot_signal_proc = robotics_interface->get_signal_processor ();
@@ -267,7 +263,7 @@ int main() {
267263 std::cout << " \n === Scientific Interface Example ===" << std::endl;
268264
269265 // Create scientific interface
270- auto scientific_interface = diffeq::examples:: create_scientific_interface<std::vector<double >>();
266+ auto scientific_interface = create_scientific_interface<std::vector<double >>();
271267
272268 // Define scientific system (e.g., chemical reaction)
273269 auto chemical_ode = [](double t, const std::vector<double >& y, std::vector<double >& dydt) {
0 commit comments