diff --git a/.clang-tidy b/.clang-tidy index d7d6fe1..f0d13b8 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -22,6 +22,7 @@ Checks: > -cppcoreguidelines-avoid-const-or-ref-data-members, -cppcoreguidelines-pro-bounds-constant-array-index, -cppcoreguidelines-pro-bounds-pointer-arithmetic, + -cppcoreguidelines-pro-type-union-access, hicpp-*, @@ -71,4 +72,4 @@ CheckOptions: - key: readability-identifier-naming.UnionCase value: CamelCase - key: readability-identifier-naming.VariableCase - value: camelBack + value: aNy_CasE diff --git a/src/ra/acoustic/StochasticRaytracing.cpp b/src/ra/acoustic/StochasticRaytracing.cpp index 5b96c07..4c93146 100644 --- a/src/ra/acoustic/StochasticRaytracing.cpp +++ b/src/ra/acoustic/StochasticRaytracing.cpp @@ -19,7 +19,7 @@ auto StochasticRaytracing::operator()(Simulation const& sim) const -> Result auto tasks = std::vector>>(numBands); for (auto frequency{0UL}; frequency < numBands; ++frequency) { - tasks[frequency] = std::async(std::launch::async, [=, this] { + tasks[frequency] = std::async(std::launch::async, [numTimeSteps, &rays, &sim, frequency, this] { auto random = std::mt19937{std::random_device{}()}; auto hist = std::vector(numTimeSteps); for (auto const& ray : rays) { diff --git a/src/ra/acoustic/WaveEquation2D.cpp b/src/ra/acoustic/WaveEquation2D.cpp index 743ea2c..c4dcde6 100644 --- a/src/ra/acoustic/WaveEquation2D.cpp +++ b/src/ra/acoustic/WaveEquation2D.cpp @@ -11,7 +11,7 @@ namespace ra { WaveEquation2D::WaveEquation2D(Spec const& spec) : _spec{spec} {} -auto WaveEquation2D::operator()(Callback const& callback) -> void +auto WaveEquation2D::operator()(Callback const& callback) const -> void { // Speed of sound (m/s) static constexpr auto const c = 343.0; @@ -98,8 +98,6 @@ auto WaveEquation2D::operator()(Callback const& callback) -> void callback(u); } } - - return; } } // namespace ra diff --git a/src/ra/acoustic/WaveEquation2D.hpp b/src/ra/acoustic/WaveEquation2D.hpp index 2cd5315..aa95864 100644 --- a/src/ra/acoustic/WaveEquation2D.hpp +++ b/src/ra/acoustic/WaveEquation2D.hpp @@ -25,7 +25,7 @@ struct WaveEquation2D explicit WaveEquation2D(Spec const& spec); - auto operator()(Callback const& callback) -> void; + auto operator()(Callback const& callback) const -> void; private: Spec _spec; diff --git a/tool/RaumAkustik/editor/StochasticRaytracingEditor.cpp b/tool/RaumAkustik/editor/StochasticRaytracingEditor.cpp index e03afda..caae0b9 100644 --- a/tool/RaumAkustik/editor/StochasticRaytracingEditor.cpp +++ b/tool/RaumAkustik/editor/StochasticRaytracingEditor.cpp @@ -128,8 +128,8 @@ auto StochasticRaytracingEditor::run() -> void auto stop = std::chrono::steady_clock::now(); std::cout << std::chrono::duration_cast>(stop - start).count() << "s\n"; - juce::MessageManager::callAsync([simulation, result, this] { - _result = std::move(result); + juce::MessageManager::callAsync([simulation, r = std::move(result), this]() mutable { + _result = std::move(r); for (auto const& frequency : *_result) { _maxGain = std::max(_maxGain, *std::max_element(frequency.begin(), frequency.end())); } diff --git a/tool/RaumAkustik/look/ColorMap.hpp b/tool/RaumAkustik/look/ColorMap.hpp index a24370d..1b6b0e6 100644 --- a/tool/RaumAkustik/look/ColorMap.hpp +++ b/tool/RaumAkustik/look/ColorMap.hpp @@ -265,69 +265,69 @@ inline constexpr auto CividisColorMap = std::array{ }; inline constexpr auto BondColorMap = [] { - constexpr auto const BoneRed = std::array{0.01388888888888889f, 0.02777777777777778f, 0.04166666666666666f, - 0.05555555555555555f, 0.06944444444444445f, 0.08333333333333333f, - 0.09722222222222221f, 0.1111111111111111f, 0.125f, - 0.1388888888888889f, 0.1527777777777778f, 0.1666666666666667f, - 0.1805555555555556f, 0.1944444444444444f, 0.2083333333333333f, - 0.2222222222222222f, 0.2361111111111111f, 0.25f, - 0.2638888888888889f, 0.2777777777777778f, 0.2916666666666666f, - 0.3055555555555555f, 0.3194444444444444f, 0.3333333333333333f, - 0.3472222222222222f, 0.3611111111111111f, 0.375f, - 0.3888888888888888f, 0.4027777777777777f, 0.4166666666666666f, - 0.4305555555555555f, 0.4444444444444444f, 0.4583333333333333f, - 0.4722222222222222f, 0.4861111111111112f, 0.5f, - 0.5138888888888888f, 0.5277777777777778f, 0.5416666666666667f, - 0.5555555555555556f, 0.5694444444444444f, 0.5833333333333333f, - 0.5972222222222222f, 0.611111111111111f, 0.6249999999999999f, - 0.6388888888888888f, 0.6527777777777778f, 0.6726190476190474f, - 0.6944444444444442f, 0.7162698412698412f, 0.7380952380952381f, - 0.7599206349206349f, 0.7817460317460316f, 0.8035714285714286f, - 0.8253968253968254f, 0.8472222222222221f, 0.8690476190476188f, - 0.8908730158730158f, 0.9126984126984128f, 0.9345238095238095f, - 0.9563492063492063f, 0.978174603174603f, 1.0f}; - constexpr auto const BoneGreen = std::array{0.01388888888888889f, 0.02777777777777778f, 0.04166666666666666f, - 0.05555555555555555f, 0.06944444444444445f, 0.08333333333333333f, - 0.09722222222222221f, 0.1111111111111111f, 0.125f, - 0.1388888888888889f, 0.1527777777777778f, 0.1666666666666667f, - 0.1805555555555556f, 0.1944444444444444f, 0.2083333333333333f, - 0.2222222222222222f, 0.2361111111111111f, 0.25f, - 0.2638888888888889f, 0.2777777777777778f, 0.2916666666666666f, - 0.3055555555555555f, 0.3194444444444444f, 0.3353174603174602f, - 0.3544973544973544f, 0.3736772486772486f, 0.3928571428571428f, - 0.412037037037037f, 0.4312169312169312f, 0.4503968253968254f, - 0.4695767195767195f, 0.4887566137566137f, 0.5079365079365078f, - 0.5271164021164021f, 0.5462962962962963f, 0.5654761904761904f, - 0.5846560846560845f, 0.6038359788359787f, 0.623015873015873f, - 0.6421957671957671f, 0.6613756613756612f, 0.6805555555555555f, - 0.6997354497354497f, 0.7189153439153438f, 0.7380952380952379f, - 0.7572751322751322f, 0.7764550264550264f, 0.7916666666666666f, - 0.8055555555555555f, 0.8194444444444444f, 0.8333333333333334f, - 0.8472222222222222f, 0.861111111111111f, 0.875f, - 0.8888888888888888f, 0.9027777777777777f, 0.9166666666666665f, - 0.9305555555555555f, 0.9444444444444444f, 0.9583333333333333f, - 0.9722222222222221f, 0.986111111111111f, 1.0f}; - constexpr auto const BoneBlue = std::array{0.01917989417989418f, 0.03835978835978836f, 0.05753968253968253f, - 0.07671957671957672f, 0.09589947089947089f, 0.1150793650793651f, - 0.1342592592592592f, 0.1534391534391534f, 0.1726190476190476f, - 0.1917989417989418f, 0.210978835978836f, 0.2301587301587301f, - 0.2493386243386243f, 0.2685185185185185f, 0.2876984126984127f, - 0.3068783068783069f, 0.326058201058201f, 0.3452380952380952f, - 0.3644179894179894f, 0.3835978835978835f, 0.4027777777777777f, - 0.4219576719576719f, 0.4411375661375661f, 0.4583333333333333f, - 0.4722222222222222f, 0.4861111111111111f, 0.5f, - 0.5138888888888888f, 0.5277777777777777f, 0.5416666666666666f, - 0.5555555555555556f, 0.5694444444444444f, 0.5833333333333333f, - 0.5972222222222222f, 0.6111111111111112f, 0.625f, - 0.6388888888888888f, 0.6527777777777778f, 0.6666666666666667f, - 0.6805555555555556f, 0.6944444444444444f, 0.7083333333333333f, - 0.7222222222222222f, 0.736111111111111f, 0.7499999999999999f, - 0.7638888888888888f, 0.7777777777777778f, 0.7916666666666666f, - 0.8055555555555555f, 0.8194444444444444f, 0.8333333333333334f, - 0.8472222222222222f, 0.861111111111111f, 0.875f, - 0.8888888888888888f, 0.9027777777777777f, 0.9166666666666665f, - 0.9305555555555555f, 0.9444444444444444f, 0.9583333333333333f, - 0.9722222222222221f, 0.986111111111111f, 1.0f}; + constexpr auto const BoneRed = std::array{0.01388888888888889F, 0.02777777777777778F, 0.04166666666666666F, + 0.05555555555555555F, 0.06944444444444445F, 0.08333333333333333F, + 0.09722222222222221F, 0.1111111111111111F, 0.125F, + 0.1388888888888889F, 0.1527777777777778F, 0.1666666666666667F, + 0.1805555555555556F, 0.1944444444444444F, 0.2083333333333333F, + 0.2222222222222222F, 0.2361111111111111F, 0.25F, + 0.2638888888888889F, 0.2777777777777778F, 0.2916666666666666F, + 0.3055555555555555F, 0.3194444444444444F, 0.3333333333333333F, + 0.3472222222222222F, 0.3611111111111111F, 0.375F, + 0.3888888888888888F, 0.4027777777777777F, 0.4166666666666666F, + 0.4305555555555555F, 0.4444444444444444F, 0.4583333333333333F, + 0.4722222222222222F, 0.4861111111111112F, 0.5F, + 0.5138888888888888F, 0.5277777777777778F, 0.5416666666666667F, + 0.5555555555555556F, 0.5694444444444444F, 0.5833333333333333F, + 0.5972222222222222F, 0.611111111111111F, 0.6249999999999999F, + 0.6388888888888888F, 0.6527777777777778F, 0.6726190476190474F, + 0.6944444444444442F, 0.7162698412698412F, 0.7380952380952381F, + 0.7599206349206349F, 0.7817460317460316F, 0.8035714285714286F, + 0.8253968253968254F, 0.8472222222222221F, 0.8690476190476188F, + 0.8908730158730158F, 0.9126984126984128F, 0.9345238095238095F, + 0.9563492063492063F, 0.978174603174603F, 1.0F}; + constexpr auto const BoneGreen = std::array{0.01388888888888889F, 0.02777777777777778F, 0.04166666666666666F, + 0.05555555555555555F, 0.06944444444444445F, 0.08333333333333333F, + 0.09722222222222221F, 0.1111111111111111F, 0.125F, + 0.1388888888888889F, 0.1527777777777778F, 0.1666666666666667F, + 0.1805555555555556F, 0.1944444444444444F, 0.2083333333333333F, + 0.2222222222222222F, 0.2361111111111111F, 0.25F, + 0.2638888888888889F, 0.2777777777777778F, 0.2916666666666666F, + 0.3055555555555555F, 0.3194444444444444F, 0.3353174603174602F, + 0.3544973544973544F, 0.3736772486772486F, 0.3928571428571428F, + 0.412037037037037F, 0.4312169312169312F, 0.4503968253968254F, + 0.4695767195767195F, 0.4887566137566137F, 0.5079365079365078F, + 0.5271164021164021F, 0.5462962962962963F, 0.5654761904761904F, + 0.5846560846560845F, 0.6038359788359787F, 0.623015873015873F, + 0.6421957671957671F, 0.6613756613756612F, 0.6805555555555555F, + 0.6997354497354497F, 0.7189153439153438F, 0.7380952380952379F, + 0.7572751322751322F, 0.7764550264550264F, 0.7916666666666666F, + 0.8055555555555555F, 0.8194444444444444F, 0.8333333333333334F, + 0.8472222222222222F, 0.861111111111111F, 0.875F, + 0.8888888888888888F, 0.9027777777777777F, 0.9166666666666665F, + 0.9305555555555555F, 0.9444444444444444F, 0.9583333333333333F, + 0.9722222222222221F, 0.986111111111111F, 1.0F}; + constexpr auto const BoneBlue = std::array{0.01917989417989418F, 0.03835978835978836F, 0.05753968253968253F, + 0.07671957671957672F, 0.09589947089947089F, 0.1150793650793651F, + 0.1342592592592592F, 0.1534391534391534F, 0.1726190476190476F, + 0.1917989417989418F, 0.210978835978836F, 0.2301587301587301F, + 0.2493386243386243F, 0.2685185185185185F, 0.2876984126984127F, + 0.3068783068783069F, 0.326058201058201F, 0.3452380952380952F, + 0.3644179894179894F, 0.3835978835978835F, 0.4027777777777777F, + 0.4219576719576719F, 0.4411375661375661F, 0.4583333333333333F, + 0.4722222222222222F, 0.4861111111111111F, 0.5F, + 0.5138888888888888F, 0.5277777777777777F, 0.5416666666666666F, + 0.5555555555555556F, 0.5694444444444444F, 0.5833333333333333F, + 0.5972222222222222F, 0.6111111111111112F, 0.625F, + 0.6388888888888888F, 0.6527777777777778F, 0.6666666666666667F, + 0.6805555555555556F, 0.6944444444444444F, 0.7083333333333333F, + 0.7222222222222222F, 0.736111111111111F, 0.7499999999999999F, + 0.7638888888888888F, 0.7777777777777778F, 0.7916666666666666F, + 0.8055555555555555F, 0.8194444444444444F, 0.8333333333333334F, + 0.8472222222222222F, 0.861111111111111F, 0.875F, + 0.8888888888888888F, 0.9027777777777777F, 0.9166666666666665F, + 0.9305555555555555F, 0.9444444444444444F, 0.9583333333333333F, + 0.9722222222222221F, 0.986111111111111F, 1.0F}; static_assert(BoneRed.size() == BoneGreen.size()); static_assert(BoneRed.size() == BoneBlue.size());