From 31ab8f5c6d430148ba57e96074ae60a6af693324 Mon Sep 17 00:00:00 2001 From: Loris Ercole Date: Mon, 27 Apr 2026 14:46:52 +0200 Subject: [PATCH 01/14] Fix MSVC C1061 'blocks nested too deeply' in womersley.hpp MSVC has a hard limit of ~128 nesting levels for if-else chains. The Womersley quadrature traits had two functions exceeding this: - generate(): ~125-branch if-else dispatch. Split into two halves by extracting npts >= 2049 into a generate_large_npts_() helper, keeping each half under 64 branches. - next_algebraic_order(): ~125-branch if-else that simply returned the input clamped to [1, 125]. Replaced with a 3-line equivalent. --- .../integratorxx/quadratures/s2/womersley.hpp | 521 +++++------------- 1 file changed, 144 insertions(+), 377 deletions(-) diff --git a/include/integratorxx/quadratures/s2/womersley.hpp b/include/integratorxx/quadratures/s2/womersley.hpp index d4d9a0f..6394f9d 100644 --- a/include/integratorxx/quadratures/s2/womersley.hpp +++ b/include/integratorxx/quadratures/s2/womersley.hpp @@ -51,6 +51,141 @@ struct quadrature_traits> { using point_container = std::vector; using weight_container = std::vector; + // Helper: dispatch for large npts values (>= 2049). + // Split out from generate() to avoid MSVC C1061 "blocks nested too deeply" + // (MSVC has a hard limit of ~128 nesting levels for if-else chains). + inline static void generate_large_npts_( + size_t npts, point_container& points, weight_container& weights) { + using namespace WomersleyGrids; + + if(npts == 2049) + detail::copy_grid>(points, weights); + else if(npts == 2114) + detail::copy_grid>(points, weights); + else if(npts == 2179) + detail::copy_grid>(points, weights); + else if(npts == 2246) + detail::copy_grid>(points, weights); + else if(npts == 2313) + detail::copy_grid>(points, weights); + else if(npts == 2382) + detail::copy_grid>(points, weights); + else if(npts == 2451) + detail::copy_grid>(points, weights); + else if(npts == 2522) + detail::copy_grid>(points, weights); + else if(npts == 2593) + detail::copy_grid>(points, weights); + else if(npts == 2666) + detail::copy_grid>(points, weights); + else if(npts == 2739) + detail::copy_grid>(points, weights); + else if(npts == 2814) + detail::copy_grid>(points, weights); + else if(npts == 2889) + detail::copy_grid>(points, weights); + else if(npts == 2966) + detail::copy_grid>(points, weights); + else if(npts == 3043) + detail::copy_grid>(points, weights); + else if(npts == 3122) + detail::copy_grid>(points, weights); + else if(npts == 3201) + detail::copy_grid>(points, weights); + else if(npts == 3282) + detail::copy_grid>(points, weights); + else if(npts == 3363) + detail::copy_grid>(points, weights); + else if(npts == 3446) + detail::copy_grid>(points, weights); + else if(npts == 3529) + detail::copy_grid>(points, weights); + else if(npts == 3614) + detail::copy_grid>(points, weights); + else if(npts == 3699) + detail::copy_grid>(points, weights); + else if(npts == 3786) + detail::copy_grid>(points, weights); + else if(npts == 3873) + detail::copy_grid>(points, weights); + else if(npts == 3962) + detail::copy_grid>(points, weights); + else if(npts == 4051) + detail::copy_grid>(points, weights); + else if(npts == 4142) + detail::copy_grid>(points, weights); + else if(npts == 4233) + detail::copy_grid>(points, weights); + else if(npts == 4326) + detail::copy_grid>(points, weights); + else if(npts == 4419) + detail::copy_grid>(points, weights); + else if(npts == 4514) + detail::copy_grid>(points, weights); + else if(npts == 4609) + detail::copy_grid>(points, weights); + else if(npts == 4706) + detail::copy_grid>(points, weights); + else if(npts == 4803) + detail::copy_grid>(points, weights); + else if(npts == 4902) + detail::copy_grid>(points, weights); + else if(npts == 5001) + detail::copy_grid>(points, weights); + else if(npts == 5102) + detail::copy_grid>(points, weights); + else if(npts == 5203) + detail::copy_grid>(points, weights); + else if(npts == 5306) + detail::copy_grid>(points, weights); + else if(npts == 5409) + detail::copy_grid>(points, weights); + else if(npts == 5514) + detail::copy_grid>(points, weights); + else if(npts == 5619) + detail::copy_grid>(points, weights); + else if(npts == 5726) + detail::copy_grid>(points, weights); + else if(npts == 5833) + detail::copy_grid>(points, weights); + else if(npts == 5942) + detail::copy_grid>(points, weights); + else if(npts == 6051) + detail::copy_grid>(points, weights); + else if(npts == 6162) + detail::copy_grid>(points, weights); + else if(npts == 6273) + detail::copy_grid>(points, weights); + else if(npts == 6386) + detail::copy_grid>(points, weights); + else if(npts == 6499) + detail::copy_grid>(points, weights); + else if(npts == 6614) + detail::copy_grid>(points, weights); + else if(npts == 6729) + detail::copy_grid>(points, weights); + else if(npts == 6846) + detail::copy_grid>(points, weights); + else if(npts == 6963) + detail::copy_grid>(points, weights); + else if(npts == 7082) + detail::copy_grid>(points, weights); + else if(npts == 7201) + detail::copy_grid>(points, weights); + else if(npts == 7322) + detail::copy_grid>(points, weights); + else if(npts == 7443) + detail::copy_grid>(points, weights); + else if(npts == 7566) + detail::copy_grid>(points, weights); + else if(npts == 7689) + detail::copy_grid>(points, weights); + else if(npts == 7814) + detail::copy_grid>(points, weights); + else if(npts == 7939) + detail::copy_grid>(points, weights); + } + inline static std::tuple generate( size_t npts) { point_container points(npts); @@ -58,7 +193,9 @@ struct quadrature_traits> { using namespace WomersleyGrids; - if(npts == 3) + if(npts >= 2049) + generate_large_npts_(npts, points, weights); + else if(npts == 3) detail::copy_grid>(points, weights); else if(npts == 6) detail::copy_grid>(points, weights); @@ -182,132 +319,6 @@ struct quadrature_traits> { detail::copy_grid>(points, weights); else if(npts == 1986) detail::copy_grid>(points, weights); - else if(npts == 2049) - detail::copy_grid>(points, weights); - else if(npts == 2114) - detail::copy_grid>(points, weights); - else if(npts == 2179) - detail::copy_grid>(points, weights); - else if(npts == 2246) - detail::copy_grid>(points, weights); - else if(npts == 2313) - detail::copy_grid>(points, weights); - else if(npts == 2382) - detail::copy_grid>(points, weights); - else if(npts == 2451) - detail::copy_grid>(points, weights); - else if(npts == 2522) - detail::copy_grid>(points, weights); - else if(npts == 2593) - detail::copy_grid>(points, weights); - else if(npts == 2666) - detail::copy_grid>(points, weights); - else if(npts == 2739) - detail::copy_grid>(points, weights); - else if(npts == 2814) - detail::copy_grid>(points, weights); - else if(npts == 2889) - detail::copy_grid>(points, weights); - else if(npts == 2966) - detail::copy_grid>(points, weights); - else if(npts == 3043) - detail::copy_grid>(points, weights); - else if(npts == 3122) - detail::copy_grid>(points, weights); - else if(npts == 3201) - detail::copy_grid>(points, weights); - else if(npts == 3282) - detail::copy_grid>(points, weights); - else if(npts == 3363) - detail::copy_grid>(points, weights); - else if(npts == 3446) - detail::copy_grid>(points, weights); - else if(npts == 3529) - detail::copy_grid>(points, weights); - else if(npts == 3614) - detail::copy_grid>(points, weights); - else if(npts == 3699) - detail::copy_grid>(points, weights); - else if(npts == 3786) - detail::copy_grid>(points, weights); - else if(npts == 3873) - detail::copy_grid>(points, weights); - else if(npts == 3962) - detail::copy_grid>(points, weights); - else if(npts == 4051) - detail::copy_grid>(points, weights); - else if(npts == 4142) - detail::copy_grid>(points, weights); - else if(npts == 4233) - detail::copy_grid>(points, weights); - else if(npts == 4326) - detail::copy_grid>(points, weights); - else if(npts == 4419) - detail::copy_grid>(points, weights); - else if(npts == 4514) - detail::copy_grid>(points, weights); - else if(npts == 4609) - detail::copy_grid>(points, weights); - else if(npts == 4706) - detail::copy_grid>(points, weights); - else if(npts == 4803) - detail::copy_grid>(points, weights); - else if(npts == 4902) - detail::copy_grid>(points, weights); - else if(npts == 5001) - detail::copy_grid>(points, weights); - else if(npts == 5102) - detail::copy_grid>(points, weights); - else if(npts == 5203) - detail::copy_grid>(points, weights); - else if(npts == 5306) - detail::copy_grid>(points, weights); - else if(npts == 5409) - detail::copy_grid>(points, weights); - else if(npts == 5514) - detail::copy_grid>(points, weights); - else if(npts == 5619) - detail::copy_grid>(points, weights); - else if(npts == 5726) - detail::copy_grid>(points, weights); - else if(npts == 5833) - detail::copy_grid>(points, weights); - else if(npts == 5942) - detail::copy_grid>(points, weights); - else if(npts == 6051) - detail::copy_grid>(points, weights); - else if(npts == 6162) - detail::copy_grid>(points, weights); - else if(npts == 6273) - detail::copy_grid>(points, weights); - else if(npts == 6386) - detail::copy_grid>(points, weights); - else if(npts == 6499) - detail::copy_grid>(points, weights); - else if(npts == 6614) - detail::copy_grid>(points, weights); - else if(npts == 6729) - detail::copy_grid>(points, weights); - else if(npts == 6846) - detail::copy_grid>(points, weights); - else if(npts == 6963) - detail::copy_grid>(points, weights); - else if(npts == 7082) - detail::copy_grid>(points, weights); - else if(npts == 7201) - detail::copy_grid>(points, weights); - else if(npts == 7322) - detail::copy_grid>(points, weights); - else if(npts == 7443) - detail::copy_grid>(points, weights); - else if(npts == 7566) - detail::copy_grid>(points, weights); - else if(npts == 7689) - detail::copy_grid>(points, weights); - else if(npts == 7814) - detail::copy_grid>(points, weights); - else if(npts == 7939) - detail::copy_grid>(points, weights); return std::make_tuple(points, weights); } @@ -826,256 +837,12 @@ inline static int64_t algebraic_order_by_npts(int64_t npts) { } inline static int64_t next_algebraic_order(int64_t order) { - if(order <= 1) - return 1; - else if(order <= 2) - return 2; - else if(order <= 3) - return 3; - else if(order <= 4) - return 4; - else if(order <= 5) - return 5; - else if(order <= 6) - return 6; - else if(order <= 7) - return 7; - else if(order <= 8) - return 8; - else if(order <= 9) - return 9; - else if(order <= 10) - return 10; - else if(order <= 11) - return 11; - else if(order <= 12) - return 12; - else if(order <= 13) - return 13; - else if(order <= 14) - return 14; - else if(order <= 15) - return 15; - else if(order <= 16) - return 16; - else if(order <= 17) - return 17; - else if(order <= 18) - return 18; - else if(order <= 19) - return 19; - else if(order <= 20) - return 20; - else if(order <= 21) - return 21; - else if(order <= 22) - return 22; - else if(order <= 23) - return 23; - else if(order <= 24) - return 24; - else if(order <= 25) - return 25; - else if(order <= 26) - return 26; - else if(order <= 27) - return 27; - else if(order <= 28) - return 28; - else if(order <= 29) - return 29; - else if(order <= 30) - return 30; - else if(order <= 31) - return 31; - else if(order <= 32) - return 32; - else if(order <= 33) - return 33; - else if(order <= 34) - return 34; - else if(order <= 35) - return 35; - else if(order <= 36) - return 36; - else if(order <= 37) - return 37; - else if(order <= 38) - return 38; - else if(order <= 39) - return 39; - else if(order <= 40) - return 40; - else if(order <= 41) - return 41; - else if(order <= 42) - return 42; - else if(order <= 43) - return 43; - else if(order <= 44) - return 44; - else if(order <= 45) - return 45; - else if(order <= 46) - return 46; - else if(order <= 47) - return 47; - else if(order <= 48) - return 48; - else if(order <= 49) - return 49; - else if(order <= 50) - return 50; - else if(order <= 51) - return 51; - else if(order <= 52) - return 52; - else if(order <= 53) - return 53; - else if(order <= 54) - return 54; - else if(order <= 55) - return 55; - else if(order <= 56) - return 56; - else if(order <= 57) - return 57; - else if(order <= 58) - return 58; - else if(order <= 59) - return 59; - else if(order <= 60) - return 60; - else if(order <= 61) - return 61; - else if(order <= 62) - return 62; - else if(order <= 63) - return 63; - else if(order <= 64) - return 64; - else if(order <= 65) - return 65; - else if(order <= 66) - return 66; - else if(order <= 67) - return 67; - else if(order <= 68) - return 68; - else if(order <= 69) - return 69; - else if(order <= 70) - return 70; - else if(order <= 71) - return 71; - else if(order <= 72) - return 72; - else if(order <= 73) - return 73; - else if(order <= 74) - return 74; - else if(order <= 75) - return 75; - else if(order <= 76) - return 76; - else if(order <= 77) - return 77; - else if(order <= 78) - return 78; - else if(order <= 79) - return 79; - else if(order <= 80) - return 80; - else if(order <= 81) - return 81; - else if(order <= 82) - return 82; - else if(order <= 83) - return 83; - else if(order <= 84) - return 84; - else if(order <= 85) - return 85; - else if(order <= 86) - return 86; - else if(order <= 87) - return 87; - else if(order <= 88) - return 88; - else if(order <= 89) - return 89; - else if(order <= 90) - return 90; - else if(order <= 91) - return 91; - else if(order <= 92) - return 92; - else if(order <= 93) - return 93; - else if(order <= 94) - return 94; - else if(order <= 95) - return 95; - else if(order <= 96) - return 96; - else if(order <= 97) - return 97; - else if(order <= 98) - return 98; - else if(order <= 99) - return 99; - else if(order <= 100) - return 100; - else if(order <= 101) - return 101; - else if(order <= 102) - return 102; - else if(order <= 103) - return 103; - else if(order <= 104) - return 104; - else if(order <= 105) - return 105; - else if(order <= 106) - return 106; - else if(order <= 107) - return 107; - else if(order <= 108) - return 108; - else if(order <= 109) - return 109; - else if(order <= 110) - return 110; - else if(order <= 111) - return 111; - else if(order <= 112) - return 112; - else if(order <= 113) - return 113; - else if(order <= 114) - return 114; - else if(order <= 115) - return 115; - else if(order <= 116) - return 116; - else if(order <= 117) - return 117; - else if(order <= 118) - return 118; - else if(order <= 119) - return 119; - else if(order <= 120) - return 120; - else if(order <= 121) - return 121; - else if(order <= 122) - return 122; - else if(order <= 123) - return 123; - else if(order <= 124) - return 124; - else - return 125; + // Clamp to the supported range [1, 125]. + // (The original if-else chain returned order for 1 <= order <= 124, else 125. + // Replaced to avoid MSVC C1061 "blocks nested too deeply" with ~125 branches.) + if(order < 1) return 1; + if(order > 125) return 125; + return order; } }; namespace detail { From 161b1ccf31deae83e8a0a12af1e6c108796c026f Mon Sep 17 00:00:00 2001 From: Loris Ercole Date: Mon, 27 Apr 2026 14:54:26 +0200 Subject: [PATCH 02/14] Fix MSVC native cl.exe build compatibility MSVC does not support C++ alternative operator tokens (and, or, not) without /permissive-. Replace with standard &&, ||, ! across all headers (11 files). Also add MSVC-specific flags to CMakeLists.txt: - _USE_MATH_DEFINES: needed for M_PI in MSVC CRT - /bigobj: test TUs exceed default COFF section limit --- CMakeLists.txt | 6 ++++++ include/integratorxx/batch/spherical_micro_batcher.hpp | 10 +++++----- .../pruned_spherical_quadrature.hpp | 4 ++-- include/integratorxx/generators/spherical_factory.hpp | 8 ++++---- include/integratorxx/quadrature.hpp | 2 +- .../quadratures/primitive/gausslegendre.hpp | 2 +- .../quadratures/primitive/gausslobatto.hpp | 2 +- include/integratorxx/quadratures/radial/becke.hpp | 2 +- include/integratorxx/quadratures/radial/mhl.hpp | 2 +- .../integratorxx/quadratures/radial/muraknowles.hpp | 4 ++-- .../quadratures/radial/treutlerahlrichs.hpp | 2 +- include/integratorxx/util/bound_transform.hpp | 6 +++--- 12 files changed, 28 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c56855e..d1587b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,12 @@ if( INTEGRATORXX_HAS_NO_MISSING_BRACES ) target_compile_options( integratorxx INTERFACE $<$: -Wno-missing-braces> ) endif() +# MSVC: define _USE_MATH_DEFINES for M_PI etc., and /bigobj for large TUs +if(MSVC) + target_compile_definitions( integratorxx ${INTEGRATORXX_TARGET_TYPE} _USE_MATH_DEFINES ) + target_compile_options( integratorxx ${INTEGRATORXX_TARGET_TYPE} /bigobj ) +endif() + diff --git a/include/integratorxx/batch/spherical_micro_batcher.hpp b/include/integratorxx/batch/spherical_micro_batcher.hpp index e0f3214..759fd70 100644 --- a/include/integratorxx/batch/spherical_micro_batcher.hpp +++ b/include/integratorxx/batch/spherical_micro_batcher.hpp @@ -20,9 +20,9 @@ bool point_in_box( const cartesian_pt_t& pt ) { - if( pt[0] > up[0] or pt[0] < lo[0] ) return false; - else if( pt[1] > up[1] or pt[1] < lo[1] ) return false; - else if( pt[2] > up[2] or pt[2] < lo[2] ) return false; + if( pt[0] > up[0] || pt[0] < lo[0] ) return false; + else if( pt[1] > up[1] || pt[1] < lo[1] ) return false; + else if( pt[2] > up[2] || pt[2] < lo[2] ) return false; else return true; } @@ -281,7 +281,7 @@ class SphericalMicroBatcher { } bool operator==( iterator other ){ return idx_it == other.idx_it; } - bool operator!=( iterator other ){ return not (*this == other); } + bool operator!=( iterator other ){ return !(*this == other); } @@ -352,7 +352,7 @@ class SphericalMicroBatcher { } bool operator==( iterator other ){ return idx_it == other.idx_it; } - bool operator!=( iterator other ){ return not (*this == other); } + bool operator!=( iterator other ){ return !(*this == other); } diff --git a/include/integratorxx/composite_quadratures/pruned_spherical_quadrature.hpp b/include/integratorxx/composite_quadratures/pruned_spherical_quadrature.hpp index cb460b0..d90305f 100644 --- a/include/integratorxx/composite_quadratures/pruned_spherical_quadrature.hpp +++ b/include/integratorxx/composite_quadratures/pruned_spherical_quadrature.hpp @@ -110,9 +110,9 @@ class RadialGridPartition { } bool operator==(rgp_iterator other) const { - return idx_it == other.idx_it and quad_it == other.quad_it; + return idx_it == other.idx_it && quad_it == other.quad_it; } - bool operator!=(rgp_iterator other) const { return not (*this == other); } + bool operator!=(rgp_iterator other) const { return !(*this == other); } value_type operator*() { return std::make_pair( std::make_pair(*idx_it, *(idx_it+1)), *quad_it ); diff --git a/include/integratorxx/generators/spherical_factory.hpp b/include/integratorxx/generators/spherical_factory.hpp index 43e2844..701cacc 100644 --- a/include/integratorxx/generators/spherical_factory.hpp +++ b/include/integratorxx/generators/spherical_factory.hpp @@ -51,8 +51,8 @@ struct PruningRegion { /// Check equality of `PruningRegion` instances inline bool operator==(const PruningRegion& other) const noexcept { - return other.idx_st == idx_st and - other.idx_en == idx_en and + return other.idx_st == idx_st && + other.idx_en == idx_en && other.angular_size == angular_size; } }; @@ -85,8 +85,8 @@ struct PrunedSphericalGridSpecification { } inline bool operator==(const PrunedSphericalGridSpecification& other) const noexcept { - return radial_quad == other.radial_quad and - (radial_traits ? (other.radial_traits and radial_traits->compare(*other.radial_traits)) : !other.radial_traits) and + return radial_quad == other.radial_quad && + (radial_traits ? (other.radial_traits && radial_traits->compare(*other.radial_traits)) : !other.radial_traits) && pruning_regions == other.pruning_regions; } }; diff --git a/include/integratorxx/quadrature.hpp b/include/integratorxx/quadrature.hpp index 4903ee8..151992f 100644 --- a/include/integratorxx/quadrature.hpp +++ b/include/integratorxx/quadrature.hpp @@ -222,7 +222,7 @@ class Quadrature : public template , std::decay_t... >::value and + detail::all_are_not< Quadrature, std::decay_t... >::value && detail::all_are_not< Derived , std::decay_t... >::value > > diff --git a/include/integratorxx/quadratures/primitive/gausslegendre.hpp b/include/integratorxx/quadratures/primitive/gausslegendre.hpp index fb62050..d8fef17 100644 --- a/include/integratorxx/quadratures/primitive/gausslegendre.hpp +++ b/include/integratorxx/quadratures/primitive/gausslegendre.hpp @@ -80,7 +80,7 @@ struct quadrature_traits< } } // end while - if(not converged) { + if(!converged) { throw std::runtime_error( "Gauss-Legendre Newton Iterations Failed to Converge" ); diff --git a/include/integratorxx/quadratures/primitive/gausslobatto.hpp b/include/integratorxx/quadratures/primitive/gausslobatto.hpp index 2de2629..1d5d9eb 100644 --- a/include/integratorxx/quadratures/primitive/gausslobatto.hpp +++ b/include/integratorxx/quadratures/primitive/gausslobatto.hpp @@ -76,7 +76,7 @@ struct quadrature_traits> { } } // end while - if(not converged) { + if(!converged) { throw std::runtime_error( "Gauss-Lobatto Newton Iterations Failed to Converge"); } diff --git a/include/integratorxx/quadratures/radial/becke.hpp b/include/integratorxx/quadratures/radial/becke.hpp index 98fb2f9..68a88ad 100644 --- a/include/integratorxx/quadratures/radial/becke.hpp +++ b/include/integratorxx/quadratures/radial/becke.hpp @@ -40,7 +40,7 @@ class BeckeRadialTraits : public RadialTraits { } bool operator==(const BeckeRadialTraits& other) const noexcept { - return npts_ == other.npts_ and R_ == other.R_; + return npts_ == other.npts_ && R_ == other.R_; } /** diff --git a/include/integratorxx/quadratures/radial/mhl.hpp b/include/integratorxx/quadratures/radial/mhl.hpp index 7065ff1..23eb6b6 100644 --- a/include/integratorxx/quadratures/radial/mhl.hpp +++ b/include/integratorxx/quadratures/radial/mhl.hpp @@ -39,7 +39,7 @@ class MurrayHandyLamingRadialTraits : public RadialTraits { } bool operator==(const MurrayHandyLamingRadialTraits& other) const noexcept { - return npts_ == other.npts_ and R_ == other.R_; + return npts_ == other.npts_ && R_ == other.R_; } /** diff --git a/include/integratorxx/quadratures/radial/muraknowles.hpp b/include/integratorxx/quadratures/radial/muraknowles.hpp index 9d242e4..883ccb2 100644 --- a/include/integratorxx/quadratures/radial/muraknowles.hpp +++ b/include/integratorxx/quadratures/radial/muraknowles.hpp @@ -64,7 +64,7 @@ template struct quadrature_traits< MuraKnowles, std::enable_if_t< - std::is_floating_point_v and + std::is_floating_point_v && std::is_floating_point_v > > { @@ -157,7 +157,7 @@ class MuraKnowlesRadialTraits : public RadialTraits { } bool operator==(const MuraKnowlesRadialTraits& other) const noexcept { - return npts_ == other.npts_ and R_ == other.R_; + return npts_ == other.npts_ && R_ == other.R_; } template diff --git a/include/integratorxx/quadratures/radial/treutlerahlrichs.hpp b/include/integratorxx/quadratures/radial/treutlerahlrichs.hpp index c22dab0..43e141d 100644 --- a/include/integratorxx/quadratures/radial/treutlerahlrichs.hpp +++ b/include/integratorxx/quadratures/radial/treutlerahlrichs.hpp @@ -50,7 +50,7 @@ class TreutlerAhlrichsRadialTraits : public RadialTraits { } bool operator==(const TreutlerAhlrichsRadialTraits& other) const noexcept { - return npts_ == other.npts_ and R_ == other.R_ and alpha_ == other.alpha_; + return npts_ == other.npts_ && R_ == other.R_ && alpha_ == other.alpha_; } /** diff --git a/include/integratorxx/util/bound_transform.hpp b/include/integratorxx/util/bound_transform.hpp index 6b28132..dcf4ecd 100644 --- a/include/integratorxx/util/bound_transform.hpp +++ b/include/integratorxx/util/bound_transform.hpp @@ -17,7 +17,7 @@ constexpr inline auto transform_minus_one_to_one( // Both upper and lower bounds are finite: Map (-1,1) -> (lo,up) - if( not up_is_inf and not lo_is_minf ) { + if( !up_is_inf && !lo_is_minf ) { // Factor jacobian into the weights // dx' = ((b-a)/2) * dx @@ -28,7 +28,7 @@ constexpr inline auto transform_minus_one_to_one( pt = (up - lo) * pt / 2. + (up + lo) / 2.; // Lower bound is finite, upper is infinite: Map (-1,1) -> (lo,inf) - } else if( not lo_is_minf ) { + } else if( !lo_is_minf ) { // Factor jacobian into the weights // dx' = \frac{2}{(1-x)^2} dx @@ -39,7 +39,7 @@ constexpr inline auto transform_minus_one_to_one( pt = lo + (1 + pt) / (1 - pt); // Upper bound is finite, low is infinite: Map (-1,1) -> (inf,up) - } else if( not up_is_inf ) { + } else if( !up_is_inf ) { // Factor jacobian into the weights // dx' = - \frac{2}{(1+x)^2} dx From 60e45e74b4a8939a4b0fb9ca3e9e2a7304f9356f Mon Sep 17 00:00:00 2001 From: Loris Ercole Date: Tue, 5 May 2026 10:53:54 +0200 Subject: [PATCH 03/14] silence noisy warnings --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d1587b4..de0f04b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,12 @@ endif() if(MSVC) target_compile_definitions( integratorxx ${INTEGRATORXX_TARGET_TYPE} _USE_MATH_DEFINES ) target_compile_options( integratorxx ${INTEGRATORXX_TARGET_TYPE} /bigobj ) + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + target_compile_options( integratorxx ${INTEGRATORXX_TARGET_TYPE} + -Wno-unused-but-set-variable + -Wno-suggest-override + ) + endif() endif() From bbcd89f3272235feff4650ae83e8cc4d44bdc7fc Mon Sep 17 00:00:00 2001 From: Loris Ercole Date: Wed, 6 May 2026 11:58:09 +0200 Subject: [PATCH 04/14] Fix -Wno-missing-braces not applying to compiled library sources The flag was hardcoded as INTERFACE, which only propagates to consumers. When IntegratorXX builds as a compiled library (INTEGRATORXX_HEADER_ONLY=OFF), its own sources never received the suppression. Use INTEGRATORXX_TARGET_TYPE (PUBLIC or INTERFACE) so it matches the other target_compile_options calls. GCC hides this because it removed -Wmissing-braces from -Wall in GCC 4.8; Clang still enables it, causing thousands of warnings on clang-cl builds. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index de0f04b..f304914 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ target_include_directories( integratorxx include(CheckCXXCompilerFlag) check_cxx_compiler_flag("-Wno-missing-braces" INTEGRATORXX_HAS_NO_MISSING_BRACES ) if( INTEGRATORXX_HAS_NO_MISSING_BRACES ) - target_compile_options( integratorxx INTERFACE $<$: -Wno-missing-braces> ) + target_compile_options( integratorxx ${INTEGRATORXX_TARGET_TYPE} $<$: -Wno-missing-braces> ) endif() # MSVC: define _USE_MATH_DEFINES for M_PI etc., and /bigobj for large TUs From 58012a0b32c45f5b403380fab594047dd4587f55 Mon Sep 17 00:00:00 2001 From: Loris Ercole Date: Wed, 6 May 2026 12:35:01 +0200 Subject: [PATCH 05/14] Add missing numeric header for composite quadratures tests --- test/composite_quadratures.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/test/composite_quadratures.cxx b/test/composite_quadratures.cxx index d1d14f0..435cd8a 100644 --- a/test/composite_quadratures.cxx +++ b/test/composite_quadratures.cxx @@ -5,6 +5,7 @@ #include #include #include +#include //#include //#include From 357af6f9fab3c4791a4f7c8b782b930237975b43 Mon Sep 17 00:00:00 2001 From: Loris Ercole <30901257+lorisercole@users.noreply.github.com> Date: Fri, 22 May 2026 22:00:31 +0200 Subject: [PATCH 06/14] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- include/integratorxx/generators/spherical_factory.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/integratorxx/generators/spherical_factory.hpp b/include/integratorxx/generators/spherical_factory.hpp index 701cacc..4937503 100644 --- a/include/integratorxx/generators/spherical_factory.hpp +++ b/include/integratorxx/generators/spherical_factory.hpp @@ -53,6 +53,7 @@ struct PruningRegion { inline bool operator==(const PruningRegion& other) const noexcept { return other.idx_st == idx_st && other.idx_en == idx_en && + other.angular_quad == angular_quad && other.angular_size == angular_size; } }; From 76b5ae54dbd2f05c6bb2c3d48c995af4b5032851 Mon Sep 17 00:00:00 2001 From: Loris Ercole Date: Fri, 5 Jun 2026 16:06:16 +0200 Subject: [PATCH 07/14] =?UTF-8?q?fix(msvc):=20C4530=20=E2=80=94=20add=20/E?= =?UTF-8?q?Hsc=20via=20add=5Fcompile=5Foptions=20for=20standard=20exceptio?= =?UTF-8?q?n=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f304914..5b2f337 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,7 @@ endif() if(MSVC) target_compile_definitions( integratorxx ${INTEGRATORXX_TARGET_TYPE} _USE_MATH_DEFINES ) target_compile_options( integratorxx ${INTEGRATORXX_TARGET_TYPE} /bigobj ) + add_compile_options(/EHsc) # standard C++ exception-handling model; fixes C4530 from STL headers if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") target_compile_options( integratorxx ${INTEGRATORXX_TARGET_TYPE} -Wno-unused-but-set-variable From b2fe88765ec998e920b409c9223c17993b624d76 Mon Sep 17 00:00:00 2001 From: Loris Ercole Date: Fri, 5 Jun 2026 16:06:40 +0200 Subject: [PATCH 08/14] =?UTF-8?q?fix(msvc):=20C4242=20=E2=80=94=20::touppe?= =?UTF-8?q?r=20returns=20int;=20cast=20to=20char=20via=20unsigned=20char?= =?UTF-8?q?=20lambda?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/integratorxx/generators/impl/radial_factory.hpp | 3 ++- include/integratorxx/generators/impl/s2_factory.hpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/integratorxx/generators/impl/radial_factory.hpp b/include/integratorxx/generators/impl/radial_factory.hpp index ed89d56..b1c01a1 100644 --- a/include/integratorxx/generators/impl/radial_factory.hpp +++ b/include/integratorxx/generators/impl/radial_factory.hpp @@ -8,7 +8,8 @@ namespace IntegratorXX { RadialQuad radial_from_string(std::string name) { - std::transform(name.begin(), name.end(), name.begin(), ::toupper); + std::transform(name.begin(), name.end(), name.begin(), + [](unsigned char c){ return static_cast(std::toupper(c)); }); if(name == "BECKE") return RadialQuad::Becke; if(name == "MURAKNOWLES") return RadialQuad::MuraKnowles; if(name == "MK") return RadialQuad::MuraKnowles; diff --git a/include/integratorxx/generators/impl/s2_factory.hpp b/include/integratorxx/generators/impl/s2_factory.hpp index 6dafb3d..3e0363d 100644 --- a/include/integratorxx/generators/impl/s2_factory.hpp +++ b/include/integratorxx/generators/impl/s2_factory.hpp @@ -8,7 +8,8 @@ namespace IntegratorXX { AngularQuad angular_from_string(std::string name) { - std::transform(name.begin(), name.end(), name.begin(), ::toupper); + std::transform(name.begin(), name.end(), name.begin(), + [](unsigned char c){ return static_cast(std::toupper(c)); }); if(name == "AHRENSBEYLKIN") return AngularQuad::AhrensBeylkin; if(name == "AB") return AngularQuad::AhrensBeylkin; if(name == "DELLEY") return AngularQuad::Delley; From a7d28234505eb8248ca2271346d9a235d7ad43c2 Mon Sep 17 00:00:00 2001 From: Loris Ercole Date: Fri, 5 Jun 2026 16:07:06 +0200 Subject: [PATCH 09/14] =?UTF-8?q?fix(msvc):=20C4244=20=E2=80=94=20explicit?= =?UTF-8?q?=20static=5Fcast=20size=5Ft\u2192point=5Ftype=20in=20Gauss-Lege?= =?UTF-8?q?ndre=20and=20Gauss-Lobatto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/integratorxx/quadratures/primitive/gausslegendre.hpp | 2 +- include/integratorxx/quadratures/primitive/gausslobatto.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/integratorxx/quadratures/primitive/gausslegendre.hpp b/include/integratorxx/quadratures/primitive/gausslegendre.hpp index d8fef17..a5ea0d0 100644 --- a/include/integratorxx/quadratures/primitive/gausslegendre.hpp +++ b/include/integratorxx/quadratures/primitive/gausslegendre.hpp @@ -53,7 +53,7 @@ struct quadrature_traits< const size_t mid = (npts + 1) / 2; for( size_t idx = 0; idx < mid; ++idx ) { // Index - const point_type i = idx+1; + const point_type i = static_cast(idx+1); // Standard initial guess for location of i:th root in [-1, 1] point_type z = std::cos( M_PI * (i - 0.25) / (npts + 0.5)); diff --git a/include/integratorxx/quadratures/primitive/gausslobatto.hpp b/include/integratorxx/quadratures/primitive/gausslobatto.hpp index 1d5d9eb..49a510d 100644 --- a/include/integratorxx/quadratures/primitive/gausslobatto.hpp +++ b/include/integratorxx/quadratures/primitive/gausslobatto.hpp @@ -46,7 +46,7 @@ struct quadrature_traits> { const size_t mid = (npts+1) / 2; for(size_t idx = 1; idx < mid; ++idx) { // Initial guess - const point_type i = npts - 1 - idx; + const point_type i = static_cast(npts - 1 - idx); point_type z = cos (i * M_PI / ( npts - 1.0)); // Old value of root From c2fcc863208526f97ba1b2c38350246daa23c230 Mon Sep 17 00:00:00 2001 From: Loris Ercole Date: Fri, 5 Jun 2026 16:07:29 +0200 Subject: [PATCH 10/14] =?UTF-8?q?fix(msvc):=20C4244=20=E2=80=94=20cast=20f?= =?UTF-8?q?actorial=20result=20to=20double=20in=20SphericalHarmonic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/test_functions.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_functions.hpp b/test/test_functions.hpp index bd7f34f..4a88729 100644 --- a/test/test_functions.hpp +++ b/test/test_functions.hpp @@ -17,7 +17,7 @@ struct AssociatedLegendre { struct SphericalHarmonic { static auto evaluate(int l, int m, double theta, double phi) { - double fac_ratio = detail::factorial(l-m); + double fac_ratio = static_cast(detail::factorial(l-m)); fac_ratio /= detail::factorial(l+m); double prefactor = (2.0 * l + 1.0) / (4.0 * M_PI); prefactor *= fac_ratio; From 489307b6701f5ac2e0a15a98df8cfaea4f075015 Mon Sep 17 00:00:00 2001 From: Loris Ercole Date: Fri, 5 Jun 2026 16:08:18 +0200 Subject: [PATCH 11/14] =?UTF-8?q?fix(msvc):=20C4267=20=E2=80=94=20use=20in?= =?UTF-8?q?t=20p=20in=20ref=5Fvalue=20lambdas=20to=20avoid=20size=5Ft\u219?= =?UTF-8?q?2int=20narrowing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/1d_quadratures.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/1d_quadratures.cxx b/test/1d_quadratures.cxx index aa30f90..d106801 100644 --- a/test/1d_quadratures.cxx +++ b/test/1d_quadratures.cxx @@ -54,7 +54,7 @@ TEST_CASE( "Gauss-Legendre Quadratures", "[1d-quad]" ) { // Reference integral for polynomial evaluated over [-1,1] auto ref_value = [](const std::vector& c) { - const auto p = c.size(); + const int p = static_cast(c.size()); std::vector cp(p+1, 0.0); for(int i = 0; i < p; ++i) { cp[i] = c[i] / (p-i); @@ -74,7 +74,7 @@ TEST_CASE( "Gauss-Lobatto Quadratures", "[1d-quad]" ) { // Reference integral for polynomial evaluated over [-1,1] auto ref_value = [](const std::vector& c) { - const auto p = c.size(); + const int p = static_cast(c.size()); std::vector cp(p+1, 0.0); for(int i = 0; i < p; ++i) { cp[i] = c[i] / (p-i); @@ -95,7 +95,7 @@ TEST_CASE( "Gauss-Chebyshev T1 Quadratures", "[1d-quad]" ) { // Reference integral for polynomial * T1 evaluated over [-1,1] auto ref_value = [](const std::vector& c) { - const auto p = c.size(); + const int p = static_cast(c.size()); double ref = 0.0; for(int i = 0; i < p; ++i) { int k = p - i - 1; @@ -121,7 +121,7 @@ TEST_CASE( "Gauss-Chebyshev T2 Quadratures", "[1d-quad]" ) { // Reference integral for polynomial * T2 evaluated over [-1,1] auto ref_value = [](const std::vector& c) { - const auto p = c.size(); + const int p = static_cast(c.size()); double ref = 0.0; for(int i = 0; i < p; ++i) { int k = p - i - 1; @@ -147,7 +147,7 @@ TEST_CASE( "Gauss-Chebyshev T3 Quadratures", "[1d-quad]" ) { // Reference integral for polynomial * T3 evaluated over [0,1] auto ref_value = [](const std::vector& c) { - const auto p = c.size(); + const int p = static_cast(c.size()); double ref = 0.0; for(int i = 0; i < p; ++i) { int k = p - i - 1; From 79bf569a6a2d3338e6060b55e70e42a4d1b1c876 Mon Sep 17 00:00:00 2001 From: Loris Ercole Date: Fri, 5 Jun 2026 16:08:58 +0200 Subject: [PATCH 12/14] =?UTF-8?q?fix(msvc):=20C4267=20=E2=80=94=20cast=20s?= =?UTF-8?q?ize=5Ft=20index=20to=20ptrdiff=5Ft=20in=20spherical=5Fmicro=5Fb?= =?UTF-8?q?atcher::at()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/integratorxx/batch/spherical_micro_batcher.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/integratorxx/batch/spherical_micro_batcher.hpp b/include/integratorxx/batch/spherical_micro_batcher.hpp index 759fd70..80cd9fb 100644 --- a/include/integratorxx/batch/spherical_micro_batcher.hpp +++ b/include/integratorxx/batch/spherical_micro_batcher.hpp @@ -469,14 +469,14 @@ class SphericalMicroBatcher { if( i >= nbatches() ) throw std::runtime_error("Index out of bounds"); - return *(begin() + i); + return *(begin() + static_cast(i)); } typename const_iterator::value_type at( size_t i ) const { if( i >= nbatches() ) throw std::runtime_error("Index out of bounds"); - return *(cbegin() + i); + return *(cbegin() + static_cast(i)); } From 28d8ad52dc6652bb16635d49535cd48754e384bf Mon Sep 17 00:00:00 2001 From: Loris Ercole Date: Fri, 5 Jun 2026 16:22:46 +0200 Subject: [PATCH 13/14] =?UTF-8?q?fix(msvc):=20C4530/C4267=20=E2=80=94=20mo?= =?UTF-8?q?ve=20/EHsc=20to=20target=5Fcompile=5Foptions;=20cast=20size=5Ft?= =?UTF-8?q?=E2=86=92int=20for=20custom=20iterator::operator+(int)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 3 +-- include/integratorxx/batch/spherical_micro_batcher.hpp | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b2f337..c530923 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,8 +30,7 @@ endif() # MSVC: define _USE_MATH_DEFINES for M_PI etc., and /bigobj for large TUs if(MSVC) target_compile_definitions( integratorxx ${INTEGRATORXX_TARGET_TYPE} _USE_MATH_DEFINES ) - target_compile_options( integratorxx ${INTEGRATORXX_TARGET_TYPE} /bigobj ) - add_compile_options(/EHsc) # standard C++ exception-handling model; fixes C4530 from STL headers + target_compile_options( integratorxx ${INTEGRATORXX_TARGET_TYPE} /bigobj /EHsc ) if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") target_compile_options( integratorxx ${INTEGRATORXX_TARGET_TYPE} -Wno-unused-but-set-variable diff --git a/include/integratorxx/batch/spherical_micro_batcher.hpp b/include/integratorxx/batch/spherical_micro_batcher.hpp index 80cd9fb..03c848b 100644 --- a/include/integratorxx/batch/spherical_micro_batcher.hpp +++ b/include/integratorxx/batch/spherical_micro_batcher.hpp @@ -469,14 +469,14 @@ class SphericalMicroBatcher { if( i >= nbatches() ) throw std::runtime_error("Index out of bounds"); - return *(begin() + static_cast(i)); + return *(begin() + static_cast(i)); } typename const_iterator::value_type at( size_t i ) const { if( i >= nbatches() ) throw std::runtime_error("Index out of bounds"); - return *(cbegin() + static_cast(i)); + return *(cbegin() + static_cast(i)); } From 81e283d20eb3ce3bca49e79926a92801c642c2c5 Mon Sep 17 00:00:00 2001 From: Loris Ercole Date: Fri, 5 Jun 2026 16:39:10 +0200 Subject: [PATCH 14/14] =?UTF-8?q?fix(msvc):=20C4530=20=E2=80=94=20add=20/E?= =?UTF-8?q?Hsc=20to=20FetchContent=20Catch2=20targets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 05bd933..e1a2460 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -13,6 +13,10 @@ if( NOT Catch2_FOUND ) set(CATCH_INSTALL_DOCS OFF CACHE BOOL "Install documentation alongside library" FORCE) set(CATCH_INSTALL_HELPERS OFF CACHE BOOL "Install contrib alongside library" FORCE) add_subdirectory( ${catch2_SOURCE_DIR} ${catch2_BINARY_DIR} ) + if(MSVC) + target_compile_options(Catch2 PRIVATE /EHsc) + target_compile_options(Catch2WithMain PRIVATE /EHsc) + endif() endif() else() message( STATUS "Found Catch2 VERSION ${Catch2_VERSION} DIR ${Catch2_DIR}" )