From 11cbf63373f09fb88a7cd06f9030efdc063a335f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Feb 2026 19:05:34 +0000 Subject: [PATCH 1/2] Initial plan From b7748866b4a087d15afabdc6659417b3ce96bf59 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Feb 2026 19:06:33 +0000 Subject: [PATCH 2/2] Fix thread-unsafe lazy initialization: move initialize() to constructor Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com> --- exputil/ExpDeproj.cc | 5 ----- include/ExpDeproj.H | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/exputil/ExpDeproj.cc b/exputil/ExpDeproj.cc index 3982bf1c0..3a8994696 100644 --- a/exputil/ExpDeproj.cc +++ b/exputil/ExpDeproj.cc @@ -48,11 +48,6 @@ double ExpDeproj::density(double R) double ExpDeproj::mass(double R) { - // Initialize precomputed arrays? - if (mv.size() == 0) { - initialize(); - } - if (R < 0) { throw std::invalid_argument("R must be non-negative"); } diff --git a/include/ExpDeproj.H b/include/ExpDeproj.H index 1c9da8a02..a0ff35659 100644 --- a/include/ExpDeproj.H +++ b/include/ExpDeproj.H @@ -15,7 +15,7 @@ class ExpDeproj public: //! Constructor - ExpDeproj(int n=4000) : ngrid(n) {} + ExpDeproj(int n=4000) : ngrid(n) { initialize(); } //! Destructor virtual ~ExpDeproj() {}