NeoN
A framework for CFD software
Loading...
Searching...
No Matches
operator.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
8#include "NeoN/dsl/coeff.hpp"
9
10namespace NeoN::dsl
11{
12
14{
15public:
16
17 enum class Type
18 {
21 };
22};
23
24
25/* @class OperatorMixin
26 * @brief A mixin class to simplify implementations of concrete operators
27 * in NeoNs dsl
28 *
29 * @ingroup dsl
30 */
31template<typename VectorType>
33{
34
35public:
36
37 OperatorMixin(const Executor exec, const Coeff& coeffs, VectorType& field, Operator::Type type)
38 : exec_(exec), coeffs_(coeffs), field_(field), type_(type) {};
39
40 Operator::Type getType() const { return type_; }
41
42 virtual ~OperatorMixin() = default;
43
44 virtual const Executor& exec() const final { return exec_; }
45
47
48 const Coeff& getCoefficient() const { return coeffs_; }
49
50 VectorType& getVector() { return field_; }
51
52 const VectorType& getVector() const { return field_; }
53
54 /* @brief Given an input this function reads required coeffs */
55 void read([[maybe_unused]] const Input& input) {}
56
57protected:
58
60
62
63 VectorType& field_;
64
66};
67
68} // namespace NeoN::dsl
A class that represents a coefficient for the NeoN dsl.
Definition coeff.hpp:24
const VectorType & getVector() const
Definition operator.hpp:52
void read(const Input &input)
Definition operator.hpp:55
Operator::Type type_
Definition operator.hpp:65
const Coeff & getCoefficient() const
Definition operator.hpp:48
VectorType & getVector()
Definition operator.hpp:50
const Executor exec_
Executor associated with the field. (CPU, GPU, openMP, etc.)
Definition operator.hpp:59
OperatorMixin(const Executor exec, const Coeff &coeffs, VectorType &field, Operator::Type type)
Definition operator.hpp:37
Operator::Type getType() const
Definition operator.hpp:40
virtual ~OperatorMixin()=default
virtual const Executor & exec() const final
Definition operator.hpp:44
std::variant< Dictionary, TokenList > Input
Definition input.hpp:15
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor
Definition executor.hpp:18