NeoN
A framework for CFD software
Loading...
Searching...
No Matches
vectorFreeFunctions.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 - 2026 NeoN authors
2//
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
9
10#include <type_traits>
11
12namespace NeoN
13{
14
15template<typename ValueType>
16class Vector;
17
18template<typename ValueType>
19void scalarMul(Vector<ValueType>& vect, const scalar value)
20 requires requires(ValueType a, scalar b) { a* b; };
21
22namespace detail
23{
24
25template<typename ValueType, typename BinaryOp>
27 Vector<ValueType>& vect1, const Vector<std::type_identity_t<ValueType>>& vect2, BinaryOp op
28);
29
30}
31
32template<typename ValueType>
33void add(Vector<ValueType>& vect, const std::type_identity_t<ValueType>& value);
34
35template<typename ValueType>
36void add(Vector<ValueType>& vect1, const Vector<std::type_identity_t<ValueType>>& vect2);
37
38template<typename ValueType>
39void sub(Vector<ValueType>& vect, const std::type_identity_t<ValueType>& value);
40
41template<typename ValueType>
42void sub(Vector<ValueType>& vect1, const Vector<std::type_identity_t<ValueType>>& vect2);
43
44template<typename ValueType>
45void mul(Vector<ValueType>& vect, const std::type_identity_t<ValueType>& value)
46 requires requires(ValueType a, ValueType b) { a* b; };
47
48template<typename ValueType>
49void mul(Vector<ValueType>& vect1, const Vector<std::type_identity_t<ValueType>>& vect2)
50 requires requires(ValueType a, ValueType b) { a* b; };
51
56template<unsigned int I>
57[[nodiscard]] Vector<scalar> getComponent(const Vector<Vec3>& in);
58
63template<unsigned int I>
65
69template<typename ValueType>
70Vector<ValueType> take(const Vector<ValueType>& in, std::pair<localIdx, localIdx> range);
71
72} // namespace NeoN
A class to contain the data and executors for a field and define some basic operations.
Definition vector.hpp:27
void fieldBinaryOp(Vector< ValueType > &vect1, const Vector< std::type_identity_t< ValueType > > &vect2, BinaryOp op)
Integer types used throughout NeoN.
Definition array.hpp:18
void sub(Vector< ValueType > &vect, const std::type_identity_t< ValueType > &value)
void add(Vector< ValueType > &vect, const std::type_identity_t< ValueType > &value)
void mul(Vector< ValueType > &vect, const std::type_identity_t< ValueType > &value)
void scalarMul(Vector< ValueType > &vect, const scalar value)
float scalar
Definition scalar.hpp:17
Vector< ValueType > take(const Vector< ValueType > &in, std::pair< localIdx, localIdx > range)
Given a Vector and an index range [first, first+length] a subvector is created.
Vector< scalar > getComponent(const Vector< Vec3 > &in)
Given a Vector of Vec3 this function extracts a single component.
void setComponent(const Vector< scalar > &in, Vector< Vec3 > &out)
Given a Vector of Vec3 this function sets a single component.