rugnux: use the project's PI in the anomalous map phase, not M_PI
Build Packages / build:windows:nocuda (push) Successful in 16m16s
Build Packages / build:windows:cuda (push) Successful in 19m55s
Build Packages / build:rugnux:windows (push) Successful in 17m0s
Build Packages / Unit tests (push) Canceled after 0s
Build Packages / build:viewer-tgz:cpu (push) Canceled after 0s
Build Packages / build:viewer-tgz:cuda (push) Canceled after 0s
Build Packages / build:rugnux-tgz (x86_64) (push) Canceled after 0s
Build Packages / build:rugnux:aarch64 (cross) (push) Canceled after 0s
Build Packages / build:rpm (rocky8_nocuda) (push) Canceled after 0s
Build Packages / build:rpm (rocky8_sls9) (push) Canceled after 0s
Build Packages / build:rpm (rocky8) (push) Canceled after 0s
Build Packages / build:rpm (rocky9_nocuda) (push) Canceled after 0s
Build Packages / build:rpm (rocky9_sls9) (push) Canceled after 0s
Build Packages / build:rpm (rocky9) (push) Canceled after 0s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Canceled after 0s
Build Packages / build:rpm (ubuntu2204) (push) Canceled after 0s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Canceled after 0s
Build Packages / build:rpm (ubuntu2404) (push) Canceled after 0s
Build Packages / DIALS test (push) Canceled after 0s
Build Packages / XDS test (durin plugin) (push) Canceled after 0s
Build Packages / XDS test (JFJoch plugin) (push) Canceled after 0s
Build Packages / XDS test (neggia plugin) (push) Canceled after 0s
Build Packages / Generate python client (push) Canceled after 0s
Build Packages / Build documentation (push) Canceled after 0s
Build Packages / Create release (push) Canceled after 0s

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 16:32:04 +02:00
co-authored by Claude Opus 5
parent 7c42439af8
commit 37a77ca334
+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());