From bd4f5c971e29b08d83abf503c0fe877e1e0203e3 Mon Sep 17 00:00:00 2001 From: ParkSuMin Date: Wed, 19 Nov 2025 22:15:52 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=B2=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=B8=20=D0=B2?= =?UTF-8?q?=D1=8B=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=B3=D1=80=D0=B0=D0=BC=D0=BC=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/Header.hpp | 1 + src/main.cpp | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/Header.hpp b/include/Header.hpp index 221f0dc..405edfe 100644 --- a/include/Header.hpp +++ b/include/Header.hpp @@ -3,6 +3,7 @@ #include #include #include +#include #define M_PI 3.14159265358979323846 diff --git a/src/main.cpp b/src/main.cpp index fd0bf36..d3cf078 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -103,6 +103,8 @@ int main() { double step_count = 0; // Счетчик числа шагов double it_count = 0; // Счетчик числа итераций метода Ньютона int counter = 0; // Счетчик числа шагов + + auto start = std::chrono::steady_clock::now(); while (t_cur < T) { bool is_end = false; // Индикатор завершения итераций метода Ньютона size_t n = 0; // Счетчик числа итераций метода Ньютона @@ -163,14 +165,18 @@ int main() { counter++; step_count += dt; it_count += n; - cout << counter << " n_it=" << n << " t=" << t_cur << endl; + //cout << counter << " n_it=" << n << " t=" << t_cur << endl; if (cur_delta < EPS_MIN) { dt *= 2; } } } - cout << "Число шагов по времени: " << counter << endl; - cout << "Средний шаг по времени: " << step_count / counter << endl; - cout << "Среднее число итераций: " << it_count / counter << endl; + auto end = std::chrono::steady_clock::now(); + auto sec = std::chrono::duration(end - start); + + std::cout << "Time: " << sec.count() << " sec\n"; + cout << "Time steps: " << counter << endl; + cout << "Average step by time: " << step_count / counter << endl; + cout << "Average iteration count: " << it_count / counter << endl; return 0; } \ No newline at end of file