Loading...
Searching...
No Matches
Functors.hpp
Go to the documentation of this file.
1// This code is based on Jet framework.
2// Copyright (c) 2018 Doyub Kim
3// CubbyFlow is voxel-based fluid simulation engine for computer games.
4// Copyright (c) 2020 CubbyFlow Team
5// Core Part: Chris Ohk, Junwoo Hwang, Jihong Sin, Seungwoo Yoo
6// AI Part: Dongheon Cho, Minseo Kim
7// We are making my contributions/submissions to this project solely in our
8// personal capacity and are not conveying any rights to any intellectual
9// property of any third parties.
10
11#ifndef CUBBYFLOW_FUNCTORS_HPP
12#define CUBBYFLOW_FUNCTORS_HPP
13
14#include <limits>
15
16namespace CubbyFlow
17{
19template <typename T>
20struct NoOp
21{
22 constexpr T operator()(const T& a) const;
23};
24
26template <typename T, typename U>
28{
29 constexpr U operator()(const T& a) const;
30};
31
33template <typename T>
34struct DoCeil
35{
36 constexpr T operator()(const T& a) const;
37};
38
40template <typename T>
41struct DoFloor
42{
43 constexpr T operator()(const T& a) const;
44};
45
47template <typename T>
48struct RMinus
49{
50 constexpr T operator()(const T& a, const T& b) const;
51};
52
54template <typename T>
56{
57 constexpr T operator()(const T& a, const T& b) const;
58};
59
61template <typename T>
62struct DoMin
63{
64 constexpr T operator()(const T& a, const T& b) const;
65};
66
68template <typename T>
69struct DoMax
70{
71 constexpr T operator()(const T& a, const T& b) const;
72};
73
75template <typename T>
77{
78 constexpr T operator()(const T& a, const T& b) const;
79};
80
82template <typename T>
84{
85 constexpr T operator()(const T& a, const T& b) const;
86};
87
89template <typename T>
91{
92 constexpr SimilarTo(
93 double _tolerance = std::numeric_limits<double>::epsilon())
95 {
96 // Do nothing
97 }
98
99 constexpr bool operator()(const T& a, const T& b) const;
100
101 double tolerance;
102};
103
105template <typename T>
107{
108 constexpr T operator()(const T& a, const T& low, const T& high) const;
109};
110} // namespace CubbyFlow
111
113
114#endif
Definition Matrix.hpp:30
Definition pybind11Utils.hpp:21
Takes absolute maximum value.
Definition Functors.hpp:84
constexpr T operator()(const T &a, const T &b) const
Definition Functors-Impl.hpp:75
Takes absolute minimum value.
Definition Functors.hpp:77
constexpr T operator()(const T &a, const T &b) const
Definition Functors-Impl.hpp:69
Performs std::ceil.
Definition Functors.hpp:35
constexpr T operator()(const T &a) const
Definition Functors-Impl.hpp:33
Clamps the input value with low/high.
Definition Functors.hpp:107
constexpr T operator()(const T &a, const T &low, const T &high) const
Definition Functors-Impl.hpp:87
Performs std::floor.
Definition Functors.hpp:42
constexpr T operator()(const T &a) const
Definition Functors-Impl.hpp:39
Takes maximum value.
Definition Functors.hpp:70
constexpr T operator()(const T &a, const T &b) const
Definition Functors-Impl.hpp:63
Takes minimum value.
Definition Functors.hpp:63
constexpr T operator()(const T &a, const T &b) const
Definition Functors-Impl.hpp:57
No-op operator.
Definition Functors.hpp:21
constexpr T operator()(const T &a) const
Definition Functors-Impl.hpp:21
Reverse divides operator.
Definition Functors.hpp:56
constexpr T operator()(const T &a, const T &b) const
Definition Functors-Impl.hpp:51
Reverse minus operator.
Definition Functors.hpp:49
constexpr T operator()(const T &a, const T &b) const
Definition Functors-Impl.hpp:45
True if similar.
Definition Functors.hpp:91
double tolerance
Definition Functors.hpp:101
constexpr bool operator()(const T &a, const T &b) const
Definition Functors-Impl.hpp:81
constexpr SimilarTo(double _tolerance=std::numeric_limits< double >::epsilon())
Definition Functors.hpp:92
Type casting operator.
Definition Functors.hpp:28
constexpr U operator()(const T &a) const
Definition Functors-Impl.hpp:27