www.cemf.ir
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( \
31  const quadruple<T>& arg1, const quadruple<T>& arg2 \
32  ) \
33  { \
34  return quadruple<T>( \
35  fnName(arg1.s_, arg2.s_), fnName(arg1.v_, arg2.v_) \
36  ); \
37  }
38 
39 //* * * * * * * * * * * List of functinos * * * * * * * * //
40 // abs, mod, exp, log, log10, pow, sqrt, cbrt
41 // sin, cos, tan, asin, acos, atan, atan2
42 // sinh, cosh, tanh, asinh, acosh, atanh
43 // min, max
44 //* * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 Q4Func(abs);
47 Q4Func2(mod);
48 Q4Func(exp);
49 Q4Func(log);
50 Q4Func(log10);
51 Q4Func2(pow);
52 Q4Func(sqrt);
53 Q4Func(cbrt);
54 Q4Func(sin);
55 Q4Func(cos);
56 Q4Func(tan);
57 Q4Func(asin);
58 Q4Func(acos);
59 Q4Func(atan);
60 Q4Func2(atan2);
61 Q4Func(sinh);
62 Q4Func(cosh);
63 Q4Func(tanh);
64 Q4Func(asinh);
65 Q4Func(acosh);
66 Q4Func(atanh);
67 Q4Func2(min);
68 Q4Func2(max);
69 
70 template<typename T>
72 pFlow::pow(const quadruple<T>& q4, T e)
73 {
74  return quadruple<T>(pow(q4.s_, e), pow(q4.v_, e));
75 }
76 
77 // return the min of 3 elements x, y, z
78 template<typename T>
79 inline T
80 pFlow::min(const quadruple<T>& q4)
81 {
82  return min(min(q4.v_), q4.s_);
83 }
84 
85 // return the max of 3 elements x, y, z
86 template<typename T>
87 inline T
88 pFlow::max(const quadruple<T>& q4)
89 {
90  return max(max(q4.v_), q4.s_);
91 }
92 
93 #undef Q4Func
94 #undef Q4Func2
pFlow::exp
Vector< T, Allocator > exp(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:86
pFlow::atan
Vector< T, Allocator > atan(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:97
pFlow::asin
Vector< T, Allocator > asin(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:95
pFlow::cbrt
Vector< T, Allocator > cbrt(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:91
pFlow::sinh
Vector< T, Allocator > sinh(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:99
pFlow::pow
Vector< T, Allocator > pow(const Vector< T, Allocator > &v1, const Vector< T, Allocator > &v2)
Definition: VectorMath.hpp:89
pFlow::sqrt
Vector< T, Allocator > sqrt(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:90
pFlow::cosh
Vector< T, Allocator > cosh(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:100
pFlow::algorithms::KOKKOS::max
INLINE_FUNCTION_H Type max(const Type *first, uint32 numElems)
Definition: kokkosAlgorithms.hpp:104
pFlow::cos
Vector< T, Allocator > cos(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:93
pFlow::algorithms::KOKKOS::min
INLINE_FUNCTION_H Type min(const Type *first, int32 numElems)
Definition: kokkosAlgorithms.hpp:124
pFlow::max
T max(const internalField< T, MemorySpace > &iField)
Definition: internalFieldAlgorithms.hpp:79
Q4Func
#define Q4Func(fnName)
Definition: quadrupleMath.hpp:21
pFlow::asinh
Vector< T, Allocator > asinh(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:102
pFlow::log10
Vector< T, Allocator > log10(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:88
pFlow::log
Vector< T, Allocator > log(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:87
pFlow::mod
Vector< T, Allocator > mod(const Vector< T, Allocator > &v1, const Vector< T, Allocator > &v2)
Definition: VectorMath.hpp:85
pFlow::abs
Vector< T, Allocator > abs(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:84
pFlow::min
T min(const internalField< T, MemorySpace > &iField)
Definition: internalFieldAlgorithms.hpp:28
Q4Func2
#define Q4Func2(fnName)
Definition: quadrupleMath.hpp:28
pFlow::sin
Vector< T, Allocator > sin(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:92
pFlow::atanh
Vector< T, Allocator > atanh(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:104
pFlow::quadruple
Definition: quadruple.hpp:36
pFlow::tanh
Vector< T, Allocator > tanh(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:101
pFlow::atan2
Vector< T, Allocator > atan2(const Vector< T, Allocator > &v1, const Vector< T, Allocator > &v2)
Definition: VectorMath.hpp:98
pFlow::tan
Vector< T, Allocator > tan(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:94
pFlow::acosh
Vector< T, Allocator > acosh(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:103
pFlow::acos
Vector< T, Allocator > acos(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:96