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