www.cemf.ir
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 namespace pFlow
22 
23 {
24 
25 #define T3Func(fnName) \
26  template<typename T> \
27  INLINE_FUNCTION_HD triple<T> fnName(const triple<T>& v) \
28  { \
29  return triple<T>(fnName(v.x_), fnName(v.y_), fnName(v.z_)); \
30  }
31 
32 #define T3Func2(fnName) \
33  template<typename T> \
34  INLINE_FUNCTION_HD triple<T> fnName( \
35  const triple<T>& arg1, const triple<T>& arg2 \
36  ) \
37  { \
38  return triple<T>( \
39  fnName(arg1.x_, arg2.x_), \
40  fnName(arg1.y_, arg2.y_), \
41  fnName(arg1.z_, arg2.z_) \
42  ); \
43  }
44 
45 //* * * * * * * * * * * List of functinos * * * * * * * * //
46 // abs, mod, exp, log, log10, pow, sqrt, cbrt
47 // sin, cos, tan, asin, acos, atan, atan2
48 // sinh, cosh, tanh, asinh, acosh, atanh
49 // min, max
50 //* * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
75 
77 
78 // elements of t3 raised by e
79 template<typename T>
81  pow(const triple<T>& t3, T e)
82 {
83  return triple<T>(pow(t3.x_, e), pow(t3.y_, e), pow(t3.z_, e));
84 }
85 
86 // return the min of 3 elements x, y, z
87 template<typename T>
89 min(const triple<T>& t3)
90 {
91  return min(min(t3.x_, t3.y_), t3.z_);
92 }
93 
94 // return the max of 3 elements x, y, z
95 template<typename T>
97 max(const triple<T>& t3)
98 {
99  return max(max(t3.x_, t3.y_), t3.z_);
100 }
101 
102 #undef T3Func
103 #undef T3Func2
104 
105 }
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
T3Func2
#define T3Func2(fnName)
Definition: tripleMath.hpp:32
T3Func
#define T3Func(fnName)
Definition: tripleMath.hpp:25
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::cos
Vector< T, Allocator > cos(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:93
pFlow::max
T max(const internalField< T, MemorySpace > &iField)
Definition: internalFieldAlgorithms.hpp:79
pFlow
Definition: demGeometry.hpp:27
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::triple::x_
T x_
data members
Definition: triple.hpp:49
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
pFlow::triple::y_
T y_
Definition: triple.hpp:50
pFlow::triple::z_
T z_
Definition: triple.hpp:51
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::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
INLINE_FUNCTION_HD
#define INLINE_FUNCTION_HD
Definition: pFlowMacros.hpp:55
pFlow::triple
A set of 3 variables that can be used for vector variables.
Definition: triple.hpp:36
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