zAxis.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 
22 /*
23 class name: zAxis
24 a class for transfering points to a cylinderical coordinates defined by points
25 p1 and p2
26 */
27 
28 #ifndef __zAxis_hpp__
29 #define __zAxis_hpp__
30 
31 #include "types.hpp"
32 
33 namespace pFlow
34 {
35 
36 template <typename T, int32 nRow, int32 nInner, int32 nCol >
37 void MatMul(T(&A)[nRow][nInner], T(&B)[nInner][nCol], T(&C)[nRow][nCol]);
38 
39 template <typename T, int32 nRow, int32 nCol >
40 void assignMat(T(&A)[nRow][nCol], T(&B)[nRow][nCol]);
41 
42 class zAxis
43 {
44 public:
45  // constructors
46  zAxis(const realx3 &lp1, const realx3 &lp2);
47 
48  real length()const
49  {
50  return pFlow::length(p2_-p1_);
51  }
52 
53  realx3 transferToZ(const realx3 & p);
54 
55  realx3 transferBackZ(const realx3 & p);
56 
57 private:
58  void makeTransMatrix();
59 protected:
60 
64 
66 
68 };
69 
70 
71 
72 template <typename T, int32 nRow, int32 nInner, int32 nCol >
73 void MatMul(T(&A)[nRow][nInner], T(&B)[nInner][nCol], T(&C)[nRow][nCol])
74 {
75 
76  for (int32 row = 0; row < nRow; row++)
77  {
78  for (int32 col = 0; col < nCol; col++)
79  {
80  T sum = 0;
81  for (int inner = 0; inner < nInner; inner++)
82  {
83  sum += A[row][inner] * B[inner][col];
84  }
85  C[row][col] = sum;
86  }
87  }
88 }
89 
90 template <typename T, int32 nRow, int32 nCol >
91 void assignMat(T(&A)[nRow][nCol], T(&B)[nRow][nCol])
92 {
93 
94  for (int32 row = 0; row < nRow; row++)
95  {
96  for (int32 col = 0; col < nCol; col++)
97  {
98  B[row][col] = A[row][col];
99  }
100  }
101 }
102 
103 
104 }
105 
106 #endif
107 
pFlow::MatMul
void MatMul(T(&A)[nRow][nInner], T(&B)[nInner][nCol], T(&C)[nRow][nCol])
Definition: zAxis.hpp:73
pFlow::zAxis::makeTransMatrix
void makeTransMatrix()
Definition: zAxis.cpp:71
pFlow::zAxis::Trans_z_xz_P1_
real Trans_z_xz_P1_[4][4]
Definition: zAxis.hpp:65
pFlow::real
float real
Definition: builtinTypes.hpp:46
pFlow::zAxis
Definition: zAxis.hpp:42
pFlow::zAxis::transferBackZ
realx3 transferBackZ(const realx3 &p)
Definition: zAxis.cpp:56
types.hpp
pFlow::zAxis::ITrans_P1_xz_z_
real ITrans_P1_xz_z_[4][4]
Definition: zAxis.hpp:67
pFlow::zAxis::zAxis
zAxis(const realx3 &lp1, const realx3 &lp2)
Definition: zAxis.cpp:25
pFlow
Definition: demComponent.hpp:28
length
INLINE_FUNCTION_HD T length(const triple< T > &v1)
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::zAxis::transferToZ
realx3 transferToZ(const realx3 &p)
Definition: zAxis.cpp:41
pFlow::sum
T sum(const Vector< T, Allocator > &v)
Definition: VectorMath.hpp:190
pFlow::zAxis::p1_
realx3 p1_
Definition: zAxis.hpp:61
pFlow::zAxis::n_
realx3 n_
Definition: zAxis.hpp:63
pFlow::zAxis::length
real length() const
Definition: zAxis.hpp:48
pFlow::zAxis::p2_
realx3 p2_
Definition: zAxis.hpp:62
pFlow::triple< real >
pFlow::assignMat
void assignMat(T(&A)[nRow][nCol], T(&B)[nRow][nCol])
Definition: zAxis.hpp:91