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