From a21023ec9de9e75d6fcedb4d9a993bf59a9ade21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20L=C3=BCbke?= Date: Thu, 14 Sep 2023 13:31:31 +0200 Subject: [PATCH] feat: make OpenMP parallelization optional --- src/BTCS.cpp | 7 ++++++- src/FTCS.cpp | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/BTCS.cpp b/src/BTCS.cpp index 3d162ed..7ddabb5 100644 --- a/src/BTCS.cpp +++ b/src/BTCS.cpp @@ -10,10 +10,15 @@ #include "Schemes.hpp" #include "TugUtils.hpp" -#include #include #include +#ifdef _OPENMP +#include +#else +#define omp_get_thread_num() 0 +#endif + // calculates coefficient for left boundary in constant case static std::tuple calcLeftBoundaryCoeffConstant(Eigen::MatrixXd &alpha, int rowIndex, double sx) { diff --git a/src/FTCS.cpp b/src/FTCS.cpp index 01eaf8d..0ba10b2 100644 --- a/src/FTCS.cpp +++ b/src/FTCS.cpp @@ -10,9 +10,14 @@ #include #include -#include #include +#ifdef _OPENMP +#include +#else +#define omp_get_thread_num() 0 +#endif + // calculates horizontal change on one cell independent of boundary type static double calcHorizontalChange(Grid &grid, int &row, int &col) {