tripleMath.hpp
Go to the documentation of this file.
1 /*------------------------------- phasicFlow ---------------------------------
2  O C enter of
3  O O E ngineering and
4  O O M ultiscale modeling of
5  OOOOOOO F luid flow
6 ------------------------------------------------------------------------------
7  Copyright (C): www.cemf.ir
8  email: hamid.r.norouzi AT gmail.com
9 ------------------------------------------------------------------------------
10 Licence:
11  This file is part of phasicFlow code. It is a free software for simulating
12  granular and multiphase flows. You can redistribute it and/or modify it under
13  the terms of GNU General Public License v3 or any other later versions.
14 
15  phasicFlow is distributed to help others in their research in the field of
16  granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
17  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 -----------------------------------------------------------------------------*/
20 
21 #define T3Func(fnName) \
22 template<typename T> \
23 INLINE_FUNCTION_HD pFlow::triple<T> pFlow::fnName(const pFlow::triple<T>& v) \
24 { \
25  return pFlow::triple<T>(fnName(v.x_), fnName(v.y_), fnName(v.z_)); \
26 }
27 
28 #define T3Func2(fnName) \
29 template<typename T> \
30 INLINE_FUNCTION_HD pFlow::triple<T> pFlow::fnName(const pFlow::triple<T>& arg1, const pFlow::triple<T>& arg2) \
31 { \
32  return pFlow::triple<T>(fnName(arg1.x_, arg2.x_), fnName(arg1.y_,arg2.y_), fnName(arg1.z_, arg2.z_)); \
33 }
34 
35 //* * * * * * * * * * * List of functinos * * * * * * * * //
36 // abs, mod, exp, log, log10, pow, sqrt, cbrt
37 // sin, cos, tan, asin, acos, atan, atan2
38 // sinh, cosh, tanh, asinh, acosh, atanh
39 // min, max
40 //* * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 
43 T3Func(abs);
44 T3Func2(mod);
45 T3Func(exp);
46 T3Func(log);
47 T3Func(log10);
48 T3Func2(pow);
49 T3Func(sqrt);
50 T3Func(cbrt);
51 T3Func(sin);
52 T3Func(cos);
53 T3Func(tan);
54 T3Func(asin);
55 T3Func(acos);
56 T3Func(atan);
57 T3Func2(atan2);
58 T3Func(sinh);
59 T3Func(cosh);
60 T3Func(tanh);
61 T3Func(asinh);
62 T3Func(acosh);
63 T3Func(atanh);
64 T3Func2(min);
65 T3Func2(max);
66 
68 
69 // elements of t3 raised by e
70 template<typename T>
72 {
73  return pFlow::triple<T>( pow(t3.x_, e), pow(t3.y_,e), pow(t3.z_,e));
74 }
75 
76 // return the min of 3 elements x, y, z
77 template<typename T>
79 {
80  return min( min(t3.x_, t3.y_), t3.z_);
81 }
82 
83 // return the max of 3 elements x, y, z
84 template<typename T>
86 {
87  return max( max(t3.x_, t3.y_), t3.z_);
88 }
89 
90 
91 
92 #undef T3Func
93 #undef T3Func2
pFlow::atan
INLINE_FUNCTION_HD real atan(real x)
Definition: math.hpp:218
pFlow::atan2
INLINE_FUNCTION_HD real atan2(real y, real x)
Definition: math.hpp:229
T3Func2
#define T3Func2(fnName)
Definition: tripleMath.hpp:28
T3Func
#define T3Func(fnName)
Definition: tripleMath.hpp:21
pFlow::atanh
INLINE_FUNCTION_HD real atanh(real x)
Definition: math.hpp:286
pFlow::cos
INLINE_FUNCTION_HD real cos(real x)
Definition: math.hpp:178
pFlow::algorithms::KOKKOS::min
INLINE_FUNCTION_H Type min(const Type *first, int32 numElems)
Definition: kokkosAlgorithms.hpp:124
pFlow::sin
INLINE_FUNCTION_HD real sin(real x)
Definition: math.hpp:168
pFlow::cosh
INLINE_FUNCTION_HD real cosh(real x)
Definition: math.hpp:249
pFlow::asin
INLINE_FUNCTION_HD real asin(real x)
Definition: math.hpp:197
pFlow::log10
INLINE_FUNCTION_HD real log10(real x)
Definition: math.hpp:128
pFlow::log
INLINE_FUNCTION_HD real log(real x)
Definition: math.hpp:119
pFlow::tan
INLINE_FUNCTION_HD real tan(real x)
Definition: math.hpp:188
pFlow::sinh
INLINE_FUNCTION_HD real sinh(real x)
Definition: math.hpp:239
pFlow::algorithms::KOKKOS::max
INLINE_FUNCTION_H Type max(const Type *first, int32 numElems)
Definition: kokkosAlgorithms.hpp:104
pFlow::pow
Vector< T, Allocator > pow(const Vector< T, Allocator > &v, T e)
Definition: VectorMath.hpp:109
pFlow::abs
INLINE_FUNCTION_HD real abs(real x)
Definition: math.hpp:43
pFlow::triple::x_
T x_
Definition: triple.hpp:49
pFlow::acos
INLINE_FUNCTION_HD real acos(real x)
Definition: math.hpp:208
pFlow::mod
INLINE_FUNCTION_HD real mod(real x, real y)
Definition: math.hpp:72
pFlow::tanh
INLINE_FUNCTION_HD real tanh(real x)
Definition: math.hpp:259
pFlow::exp
INLINE_FUNCTION_HD real exp(real x)
Definition: math.hpp:110
pFlow::max
T max(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:164
pFlow::triple::y_
T y_
Definition: triple.hpp:50
pFlow::asinh
INLINE_FUNCTION_HD real asinh(real x)
Definition: math.hpp:268
pFlow::triple::z_
T z_
Definition: triple.hpp:51
pFlow::acosh
INLINE_FUNCTION_HD real acosh(real x)
Definition: math.hpp:277
pFlow::sqrt
INLINE_FUNCTION_HD real sqrt(real x)
Definition: math.hpp:148
pFlow::cbrt
INLINE_FUNCTION_HD real cbrt(real x)
Definition: math.hpp:158
INLINE_FUNCTION_HD
#define INLINE_FUNCTION_HD
Definition: pFlowMacros.hpp:51
pFlow::triple
Definition: triple.hpp:37
pFlow::min
T min(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:138