NeoN
A framework for CFD software
Loading...
Searching...
No Matches
scalar.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2023 - 2025 NeoN authors
2//
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
7#include <Kokkos_Core.hpp> // IWYU pragma: keep
9
10// TODO this needs to be implemented in the corresponding cmake file
11namespace NeoN
12{
13#ifdef NeoN_DP_SCALAR
14typedef double scalar;
15#else
16typedef float scalar;
17#endif
18
19constexpr scalar ROOTVSMALL = 1e-18;
20
21KOKKOS_INLINE_FUNCTION
22scalar mag(const scalar& s) { return std::abs(s); }
23
24// traits for scalar
25template<>
26KOKKOS_INLINE_FUNCTION scalar one<scalar>()
27{
28 return 1.0;
29};
30
31template<>
32KOKKOS_INLINE_FUNCTION scalar zero<scalar>()
33{
34 return 0.0;
35};
36
37} // namespace NeoN
Definition array.hpp:20
KOKKOS_INLINE_FUNCTION scalar one< scalar >()
Definition scalar.hpp:26
KOKKOS_INLINE_FUNCTION scalar mag(const scalar &s)
Definition scalar.hpp:22
float scalar
Definition scalar.hpp:16
constexpr scalar ROOTVSMALL
Definition scalar.hpp:19
KOKKOS_INLINE_FUNCTION scalar zero< scalar >()
Definition scalar.hpp:32