diff --git a/.gitignore b/.gitignore index d16386367f7cd7dd3c1842c484239e9e82a25efc..01f9cb9fbe0239c305ee4768b71097f17fe83ca1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -build/ \ No newline at end of file +build/ +.vscode/ \ No newline at end of file diff --git a/main.cpp b/main.cpp index 5b50aff9fcd3f8f43e83e579153c35c74c5aad98..31023b10b7099032469443f0728c5257802f3bbf 100644 --- a/main.cpp +++ b/main.cpp @@ -68,6 +68,7 @@ int main(int argc, char *argv[]) { } auto stop = std::chrono::high_resolution_clock::now(); auto EEtime = std::chrono::duration_cast<std::chrono::microseconds>(stop - start); + std::cout << "Explicit Euler: " << EEtime.count()/1000.0 << " milliseconds" << std::endl; start = std::chrono::high_resolution_clock::now(); for (unsigned i = 0; i < N; ++i) { @@ -75,6 +76,7 @@ int main(int argc, char *argv[]) { } stop = std::chrono::high_resolution_clock::now(); auto RK2time = std::chrono::duration_cast<std::chrono::microseconds>(stop - start); + std::cout << "RK2: " << RK2time.count()/1000.0 << " milliseconds" << std::endl; start = std::chrono::high_resolution_clock::now(); for (unsigned i = 0; i < N; ++i) { @@ -82,6 +84,7 @@ int main(int argc, char *argv[]) { } stop = std::chrono::high_resolution_clock::now(); auto RK4time = std::chrono::duration_cast<std::chrono::microseconds>(stop - start); + std::cout << "RK4: " << RK4time.count()/1000.0 << " milliseconds" << std::endl; start = std::chrono::high_resolution_clock::now(); for (unsigned i = 0; i < N; ++i) { @@ -89,6 +92,7 @@ int main(int argc, char *argv[]) { } stop = std::chrono::high_resolution_clock::now(); auto SItime = std::chrono::duration_cast<std::chrono::microseconds>(stop - start); + std::cout << "Semi-Implicit: " << SItime.count()/1000.0 << " milliseconds" << std::endl; start = std::chrono::high_resolution_clock::now(); for (unsigned i = 0; i < N; ++i) { @@ -96,18 +100,13 @@ int main(int argc, char *argv[]) { } stop = std::chrono::high_resolution_clock::now(); auto LFtime = std::chrono::duration_cast<std::chrono::microseconds>(stop - start); + std::cout << "Leap Frog: " << LFtime.count()/1000.0 << " milliseconds" << std::endl; // save results + std::cout << "Saving results..." << std::endl; std::ofstream datafile("./data.txt"); integrator.print(datafile); datafile.close(); - // print computation times - std::cout << "Explicit Euler: " << EEtime.count()/1000.0 << " milliseconds" << std::endl - << "RK2: " << RK2time.count()/1000.0 << " milliseconds" << std::endl - << "RK4: " << RK4time.count()/1000.0 << " milliseconds" << std::endl - << "Semi-Implicit: " << SItime.count()/1000.0 << " milliseconds" << std::endl - << "Leap Frog: " << LFtime.count()/1000.0 << " milliseconds" << std::endl; - return 0; } \ No newline at end of file