# PhasicFlow: src/phasicFlow/structuredData/infinitePlane/infinitePlane.cpp Source File
PhasicFlow is an open-source parallel DEM (discrete element method) package for simulating granular flow. It is developed in C++ and can be exectued on both GPU (like CUDA) and CPU.

infinitePlane.cpp
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.
-----------------------------------------------------------------------------*/
#include "infinitePlane.hpp"
pFlow::infinitePlane::infinitePlane
(
const realx3& p1,
const realx3& p2,
const realx3& p3
)
{
auto ln = cross(p2-p1, p3-p1);
if( equal(ln.length(),0.0) )
{
fatalErrorInFunction<<
"invalid input to form a infinte wall "<< realx3x3(p1,p2,p3)<<endl;
fatalExit;
}
normal_ = normalize(ln);
d_ = -dot(normal_, p1);
}
bool pFlow::infinitePlane::write(iOstream& os)const
{
os.writeWordEntry("normal", normal_);
os.writeWordEntry("d", d_);
return os.check(FUNCTION_NAME);
}
bool pFlow::infinitePlane::read(iIstream & is)
{
if(!is.nextData<realx3>("normal", normal_)) return false;
if(!is.nextData<real>("d", d_)) return false;
return true;
}
bool pFlow::infinitePlane::validPlane3
(
const realx3& p1,
const realx3& p2,
const realx3& p3
)
{
return !equal(cross(p2-p1, p3-p1).length(), 0.0);
}
normalize
INLINE_FUNCTION_HD triple< T > normalize(const triple< T > &v1)
pFlow::infinitePlane::normal_
realx3 normal_
normal vector
Definition: infinitePlane.hpp:37
pFlow::real
float real
Definition: builtinTypes.hpp:45
fatalExit
#define fatalExit
Fatal exit.
Definition: error.hpp:98
pFlow::equal
INLINE_FUNCTION_HD bool equal(const box &b1, const box &b2, real tol=smallValue)
Definition: box.hpp:135
FUNCTION_NAME
#define FUNCTION_NAME
Definition: pFlowMacros.hpp:29
pFlow::infinitePlane::read
bool read(iIstream &is)
Definition: infinitePlane.cpp:49
pFlow::infinitePlane::write
FUNCTION_H bool write(iOstream &os) const
Definition: infinitePlane.cpp:42
pFlow::endl
iOstream & endl(iOstream &os)
Add newline and flush stream.
Definition: iOstream.hpp:341
pFlow::infinitePlane::infinitePlane
INLINE_FUNCTION_HD infinitePlane()
Default.
Definition: infinitePlane.hpp:51
pFlow::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.cpp:42
dot
INLINE_FUNCTION_HD T dot(const quadruple< T > &oprnd1, const quadruple< T > &oprnd2)
cross
INLINE_FUNCTION_HD triple< T > cross(const triple< T > &v1, const triple< T > &v2)
pFlow::iIstream
Interface class for any input stream
Definition: iIstream.hpp:37
fatalErrorInFunction
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
Definition: error.hpp:77
length
INLINE_FUNCTION_HD T length(const triple< T > &v1)
pFlow::iIstream::nextData
bool nextData(const word &keyword, T &data)
read the data next to keword keyword data; check the keyword is correct or not
Definition: iIstreamI.hpp:81
infinitePlane.hpp
pFlow::realx3x3
triple< realx3 > realx3x3
Definition: types.hpp:47
pFlow::infinitePlane::validPlane3
static bool validPlane3(const realx3 &p1, const realx3 &p2, const realx3 &p3)
Definition: infinitePlane.cpp:57
pFlow::infinitePlane::d_
real d_
distance value
Definition: infinitePlane.hpp:40
pFlow::triple< real >
pFlow::iOstream
Interface class for any output stream.
Definition: iOstream.hpp:59
pFlow::iOstream::writeWordEntry
iOstream & writeWordEntry(const word &key, const T &value)
Write a keyword/value entry.
Definition: iOstream.hpp:239