rugnux: use the project's PI in the anomalous map phase, not M_PI

M_PI is not standard C++ and MSVC does not define it without _USE_MATH_DEFINES,
so the Windows rugnux build failed on the anomalous-map phase shift added in
b0234a1b4:

  ModelValidation.cpp(350): error C2065: 'M_PI': undeclared identifier

common/JFJochMath.h carries a plain constexpr PI for exactly this reason - its
header comment names MSVC - and BraggIntegrationEngine.cpp already uses it that
way. Same idiom here, same include comment.

The digits are those of glibc's M_PI, so the phase, the map and the site heights
are bit-identical; this is a portability fix and nothing else. Verified that no
other M_PI is left anywhere in the viewer-reachable subset, and that nothing in
the files this branch adds or changes there reaches for a GCC builtin, a POSIX
header or __attribute__.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016L1qig74oYQzfUJJZbbxFh
This commit is contained in:
2026-08-27 22:09:52 +02:00
committed by leonarski_f
co-authored by Claude Opus 5
parent 06a8a9d143
commit 02f3759ca2
+2 -1
View File
@@ -21,6 +21,7 @@
#include <gemmi/ccp4.hpp> // Ccp4 map I/O
#include <gemmi/mtz.hpp> // Mtz (map-coefficient output)
#include "../common/JFJochMath.h" // PI (M_PI is not standard, and MSVC does not define it)
#include "../common/Logger.h"
#include "../image_analysis/scale_merge/ReindexAmbiguity.h" // ReindexReflections
@@ -348,7 +349,7 @@ ModelValidationResult ValidateAgainstModel(const std::vector<MergedReflection> &
const auto it = danom_by_hkl.find(hkl_key(hv.hkl));
if (it == danom_by_hkl.end())
continue;
const auto phi = static_cast<float>(std::arg(hv.value) - M_PI / 2);
const auto phi = static_cast<float>(std::arg(hv.value) - PI / 2);
mapanom.v.push_back({hv.hkl, it->second * std::polar(1.0f, phi)});
}
result.anomalous_pairs = static_cast<int>(mapanom.v.size());