quadrupleMath.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 Q4Func(fnName) \
22 template<typename T> \
23 inline pFlow::quadruple<T> pFlow::fnName(const quadruple<T>& q) \
24 { \
25  return quadruple<T>(fnName(q.s_), fnName(q.v_)); \
26 }
27 
28 #define Q4Func2(fnName) \
29 template<typename T> \
30 inline pFlow::quadruple<T> pFlow::fnName(const quadruple<T>& arg1, const quadruple<T>& arg2) \
31 { \
32  return quadruple<T>(fnName(arg1.s_, arg2.s_), fnName(arg1.v_,arg2.v_)); \
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 Q4Func(abs);
44 Q4Func2(mod);
45 Q4Func(exp);
46 Q4Func(log);
47 Q4Func(log10);
48 Q4Func2(pow);
49 Q4Func(sqrt);
50 Q4Func(cbrt);
51 Q4Func(sin);
52 Q4Func(cos);
53 Q4Func(tan);
54 Q4Func(asin);
55 Q4Func(acos);
56 Q4Func(atan);
57 Q4Func2(atan2);
58 Q4Func(sinh);
59 Q4Func(cosh);
60 Q4Func(tanh);
61 Q4Func(asinh);
62 Q4Func(acosh);
63 Q4Func(atanh);
64 Q4Func2(min);
65 Q4Func2(max);
66 
67 
68 template<typename T>
69 inline pFlow::quadruple<T> pFlow::pow(const quadruple<T>& q4, T e)
70 {
71  return quadruple<T>( pow(q4.s_, e), pow(q4.v_,e));
72 }
73 
74 // return the min of 3 elements x, y, z
75 template<typename T>
76 inline T pFlow::min(const quadruple<T>& q4)
77 {
78  return min( min(q4.v_), q4.s_);
79 }
80 
81 // return the max of 3 elements x, y, z
82 template<typename T>
83 inline T pFlow::max(const quadruple<T>& q4)
84 {
85  return max( max(q4.v_), q4.s_);
86 }
87 
88 
89 
90 #undef Q4Func
91 #undef Q4Func2
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
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
Q4Func
#define Q4Func(fnName)
Definition: quadrupleMath.hpp:21
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::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
Q4Func2
#define Q4Func2(fnName)
Definition: quadrupleMath.hpp:28
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::asinh
INLINE_FUNCTION_HD real asinh(real x)
Definition: math.hpp:268
pFlow::acosh
INLINE_FUNCTION_HD real acosh(real x)
Definition: math.hpp:277
pFlow::quadruple
Definition: quadruple.hpp:37
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
pFlow::min
T min(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:138