![]() |
OpenSWMM Engine
6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
|
SIMD abstraction layer for vectorized arithmetic operations. More...
#include <cstddef>#include <cmath>#include <algorithm>#include <cassert>Go to the source code of this file.
Namespaces | |
| namespace | openswmm |
| namespace | openswmm::simd |
Macros | |
| #define | OPENSWMM_RESTRICT __restrict__ |
| #define | OPENSWMM_SIMD_SCALAR 1 |
| #define | OPENSWMM_SIMD_WIDTH 1 |
| Scalar fallback. | |
Functions | |
| void | openswmm::simd::add (const double *OPENSWMM_RESTRICT a, const double *OPENSWMM_RESTRICT b, double *OPENSWMM_RESTRICT dst, std::size_t n) noexcept |
| Element-wise addition: dst[i] = a[i] + b[i]. | |
| void | openswmm::simd::multiply (const double *OPENSWMM_RESTRICT a, const double *OPENSWMM_RESTRICT b, double *OPENSWMM_RESTRICT dst, std::size_t n) noexcept |
| Element-wise multiplication: dst[i] = a[i] * b[i]. | |
| double | openswmm::simd::min (const double *a, std::size_t n) noexcept |
| Find the minimum value in an array. | |
| double | openswmm::simd::max (const double *a, std::size_t n) noexcept |
| Find the maximum value in an array. | |
| void | openswmm::simd::clamp (double *a, double lo, double hi, std::size_t n) noexcept |
| Clamp all elements of an array to [lo, hi]. | |
| double | openswmm::simd::dot (const double *OPENSWMM_RESTRICT a, const double *OPENSWMM_RESTRICT b, std::size_t n) noexcept |
| Dot product of two arrays: sum(a[i] * b[i]). | |
| constexpr std::size_t | openswmm::simd::lane_width () noexcept |
| Returns the SIMD lane width (doubles per register on this platform). | |
SIMD abstraction layer for vectorized arithmetic operations.
Provides a platform-neutral interface over:
The goal is to express numerical loops in a way that the compiler can vectorize, with explicit SIMD intrinsics as hints for the most performance-critical paths.
Do NOT pepper the solver code with raw intrinsics. Instead:
| #define OPENSWMM_RESTRICT __restrict__ |
| #define OPENSWMM_SIMD_SCALAR 1 |
| #define OPENSWMM_SIMD_WIDTH 1 |
Scalar fallback.