#include "FluidSim/ScenarioCatalog.hpp" #include "FluidSim/DesktopScenario.hpp" #include #include #include #include #include using namespace fluidsim::port; int main() { std::set ids; for(const auto& example:scenario_examples()) { if(!ids.insert(example.id).second)throw std::runtime_error("duplicate example id"); DesktopScenario scenario(example.kind,example.two,example.exhaust,example.v8,example.engine,example.title); scenario.set_audio_scene(OutdoorScene::Dry); const auto started=std::chrono::steady_clock::now(); float peak_power=0; for(int i=0;i<88200;++i) { scenario.set_controls(i<44100?.45f:0.f,0,1); const auto audio=scenario.process(); if(i%4410==0) peak_power=std::max(peak_power,scenario.snapshot().average_power); if(!std::isfinite(audio.left)||!std::isfinite(audio.right))throw std::runtime_error(example.id+" nonfinite audio"); } const auto snapshot=scenario.snapshot(); if(snapshot.pipe_positivity_repairs)throw std::runtime_error(example.id+" required positivity repairs"); if(example.id=="big-carb" && peak_power<10000)throw std::runtime_error("big carb V8 failed to produce power"); if(!std::isfinite(snapshot.rpm)||snapshot.rpm<=0)throw std::runtime_error(example.id+" invalid engine speed"); if(example.engine.cylinders && (snapshot.cylinder_count!=example.engine.cylinders || snapshot.layout!=example.engine.layout))throw std::runtime_error("custom cylinder layout lost"); if(snapshot.example_name!=example.title)throw std::runtime_error("example name lost"); if(example.kind==ScenarioKind::AmericanV8 && snapshot.h_pipe!=example.v8.h_pipe)throw std::runtime_error("example crossover selection lost"); if(example.kind==ScenarioKind::SaabB205 && snapshot.silencers!=example.exhaust.enabled)throw std::runtime_error("example silencer selection lost"); std::cout<