# PhasicFlow: src/phasicFlow/structuredData/zAxis/zAxis.hpp Source File

zAxis.hpp
Go to the documentation of this file.
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
/*
class name: zAxis
a class for transfering points to a cylinderical coordinates defined by points
p1 and p2
*/
#ifndef __zAxis_hpp__
#define __zAxis_hpp__
#include "types.hpp"
namespace pFlow
{
template <typename T, int32 nRow, int32 nInner, int32 nCol >
void MatMul(T(&A)[nRow][nInner], T(&B)[nInner][nCol], T(&C)[nRow][nCol]);
template <typename T, int32 nRow, int32 nCol >
void assignMat(T(&A)[nRow][nCol], T(&B)[nRow][nCol]);
class zAxis
{
public:
// constructors
zAxis(const realx3 &lp1, const realx3 &lp2);
real length()const
{
return pFlow::length(p2_-p1_);
}
realx3 transferToZ(const realx3 & p);
realx3 transferBackZ(const realx3 & p);
private:
void makeTransMatrix();
protected:
realx3 p1_;
realx3 p2_;
realx3 n_;
real Trans_z_xz_P1_[4][4];
real ITrans_P1_xz_z_[4][4];
};
template <typename T, int32 nRow, int32 nInner, int32 nCol >
void MatMul(T(&A)[nRow][nInner], T(&B)[nInner][nCol], T(&C)[nRow][nCol])
{
for (int32 row = 0; row < nRow; row++)
{
for (int32 col = 0; col < nCol; col++)
{
T sum = 0;
for (int inner = 0; inner < nInner; inner++)
{
sum += A[row][inner] * B[inner][col];
}
C[row][col] = sum;
}
}
}
template <typename T, int32 nRow, int32 nCol >
void assignMat(T(&A)[nRow][nCol], T(&B)[nRow][nCol])
{
for (int32 row = 0; row < nRow; row++)
{
for (int32 col = 0; col < nCol; col++)
{
B[row][col] = A[row][col];
}
}
}
}
#endif
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