NeoN
A framework for CFD software
Loading...
Searching...
No Matches
include
NeoN
core
primitives
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
8
#include "
NeoN/core/primitives/traits.hpp
"
9
10
// TODO this needs to be implemented in the corresponding cmake file
11
namespace
NeoN
12
{
13
#ifdef NeoN_DP_SCALAR
14
typedef
double
scalar
;
15
#else
16
typedef
float
scalar
;
17
#endif
18
19
constexpr
scalar
ROOTVSMALL
= 1e-18;
20
21
KOKKOS_INLINE_FUNCTION
22
scalar
mag
(
const
scalar
& s) {
return
std::abs(s); }
23
24
// traits for scalar
25
template
<>
26
KOKKOS_INLINE_FUNCTION
scalar
one<scalar>
()
27
{
28
return
1.0;
29
};
30
31
template
<>
32
KOKKOS_INLINE_FUNCTION
scalar
zero<scalar>
()
33
{
34
return
0.0;
35
};
36
37
}
// namespace NeoN
NeoN
Definition
array.hpp:20
NeoN::one< scalar >
KOKKOS_INLINE_FUNCTION scalar one< scalar >()
Definition
scalar.hpp:26
NeoN::mag
KOKKOS_INLINE_FUNCTION scalar mag(const scalar &s)
Definition
scalar.hpp:22
NeoN::scalar
float scalar
Definition
scalar.hpp:16
NeoN::ROOTVSMALL
constexpr scalar ROOTVSMALL
Definition
scalar.hpp:19
NeoN::zero< scalar >
KOKKOS_INLINE_FUNCTION scalar zero< scalar >()
Definition
scalar.hpp:32
traits.hpp
Generated by
1.9.8