NeoN
A framework for CFD software
Loading...
Searching...
No Matches
executor.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 <string>
8#include <variant>
9
13#include "NeoN/core/error.hpp"
14
15namespace NeoN
16{
17
18using Executor = std::variant<SerialExecutor, CPUExecutor, GPUExecutor>;
19
26[[nodiscard]] inline bool operator==(const Executor& lhs, const Executor& rhs)
27{
28 return std::visit(
29 []<typename ExecLhs,
30 typename ExecRhs>([[maybe_unused]] const ExecLhs&, [[maybe_unused]] const ExecRhs&)
31 {
32 if constexpr (std::is_same_v<ExecLhs, ExecRhs>)
33 {
34 return typename ExecLhs::exec() == typename ExecRhs::exec();
35 }
36 else
37 {
38 return false;
39 }
40 },
41 lhs,
42 rhs
43 );
44};
45
53[[nodiscard]] inline bool operator!=(const Executor& lhs, const Executor& rhs)
54{
55 return !(lhs == rhs);
56};
57
58} // namespace NeoN
Definition array.hpp:20
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor
Definition executor.hpp:18
bool operator==(const Executor &lhs, const Executor &rhs)
Checks if two executors are equal, i.e. they are of the same type.
Definition executor.hpp:26
bool operator!=(const Executor &lhs, const Executor &rhs)
Checks if two executors are not equal, i.e. they are not of the same type.
Definition executor.hpp:53