# PhasicFlow: src/phasicFlow/structuredData/infinitePlane/infinitePlane.hpp 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.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.
-----------------------------------------------------------------------------*/
#ifndef __infinitePlane_hpp__
#define __infinitePlane_hpp__
#include "types.hpp"
//#include "dictionary.hpp"
#include "iIstream.hpp"
#include "iOstream.hpp"
namespace pFlow
{
class infinitePlane
{
protected:
realx3 normal_{1,0,0};
real d_ = 0;
public:
// - type info
TypeInfoNV("infinitePlane");
INLINE_FUNCTION_HD
infinitePlane(){}
INLINE_FUNCTION_HD
infinitePlane(const realx3& normal, const real& d)
:
normal_(normal),
d_(d)
{}
INLINE_FUNCTION_HD
infinitePlane(const realx3& normal, const realx3& p)
:
normal_(normal),
d_(-dot(normal,p))
{}
infinitePlane(const realx3& p1, const realx3& p2, const realx3& p3);
FUNCTION_HD
infinitePlane(const infinitePlane&) = default;
FUNCTION_HD
infinitePlane(infinitePlane&&) = default;
FUNCTION_HD
infinitePlane& operator=(const infinitePlane&) = default;
FUNCTION_HD
infinitePlane& operator=(infinitePlane&&) = default;
~infinitePlane()=default;
/*FUNCTION_H
infinitePlane(const dictionary& dict);
FUNCTION_H
infinitePlane(iIstream& is);*/
INLINE_FUNCTION_HD
real pointFromPlane(const realx3& p)const
{
return dot(normal_, p) + d_;
}
INLINE_FUNCTION_HD
bool pointInPositiveSide(const realx3& p)const
{
return pointFromPlane(p)>=0;
}
INLINE_FUNCTION_HD
bool pointInNegativeSide(const realx3& p)const
{
return pointFromPlane(p)<0;
}
INLINE_FUNCTION_HD
bool inPositiveDistance(const realx3& p, real dist)const
{
real d = pointFromPlane(p);
return d >= 0.0 && d <= dist;
}
INLINE_FUNCTION_HD
bool inNegativeDistance(const realx3& p, real dist)const
{
real d = pointFromPlane(p);
return d < 0.0 && d >= -dist;
}
INLINE_FUNCTION_HD
bool pointOnPlane(const realx3& p)const
{
return equal(pointFromPlane(p),0.0);
}
INLINE_FUNCTION_HD
realx3 projectPoint(const realx3& p)const
{
real t = -(dot(normal_, p) + d_);
return t*normal_ + p;
}
INLINE_FUNCTION_HD
bool parallel(const infinitePlane& pln)const
{
return equal(normal_, pln.normal_) ||
equal(normal_,-pln.normal_);
}
INLINE_FUNCTION_HD
bool parallelTouch(const infinitePlane& pln)const
{
if(equal(normal_, pln.normal_) && equal(d_, pln.d_))return true;
if(equal(normal_,-pln.normal_) && equal(d_,-pln.d_))return true;
return false;
}
INLINE_FUNCTION_HD
const auto& normal()const
{
return normal_;
}
INLINE_FUNCTION_HD
const auto& d()const
{
return d_;
}
FUNCTION_H
bool write(iOstream& os)const;
bool read(iIstream & is);
/*FUNCTION_H
bool read(iIstream & is);
FUNCTION_H
bool write(iOstream& os)const;
FUNCTION_H
bool read(const dictionary& dict);
FUNCTION_H
bool write(dictionary& dict)const;*/
static bool validPlane3(
const realx3& p1,
const realx3& p2,
const realx3& p3);
};
/*FUNCTION_H
iIstream& operator >>(iIstream& is, box& b);
FUNCTION_H
iOstream& operator << (iOstream& os, const box& b);
INLINE_FUNCTION_HD
box extendBox(const box& b, const realx3& dl)
{
return box(b.minPoint()-dl , b.maxPoint()+dl);
}*/
}
#endif // __infinitePlane_hpp__
pFlow::infinitePlane::~infinitePlane
~infinitePlane()=default
pFlow::infinitePlane::normal_
realx3 normal_
normal vector
Definition: infinitePlane.hpp:37
pFlow::infinitePlane::pointFromPlane
INLINE_FUNCTION_HD real pointFromPlane(const realx3 &p) const
Definition: infinitePlane.hpp:95
pFlow::infinitePlane::infinitePlane
INLINE_FUNCTION_HD infinitePlane(const realx3 &normal, const realx3 &p)
Definition: infinitePlane.hpp:62
pFlow::infinitePlane::normal
const INLINE_FUNCTION_HD auto & normal() const
Definition: infinitePlane.hpp:155
pFlow::real
float real
Definition: builtinTypes.hpp:45
pFlow::infinitePlane::pointInNegativeSide
INLINE_FUNCTION_HD bool pointInNegativeSide(const realx3 &p) const
Definition: infinitePlane.hpp:107
pFlow::infinitePlane::pointOnPlane
INLINE_FUNCTION_HD bool pointOnPlane(const realx3 &p) const
Definition: infinitePlane.hpp:127
iIstream.hpp
types.hpp
pFlow::infinitePlane
Definition: infinitePlane.hpp:32
pFlow::equal
INLINE_FUNCTION_HD bool equal(const box &b1, const box &b2, real tol=smallValue)
Definition: box.hpp:135
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::infinitePlane::operator=
FUNCTION_HD infinitePlane & operator=(const infinitePlane &)=default
pFlow::infinitePlane::parallelTouch
INLINE_FUNCTION_HD bool parallelTouch(const infinitePlane &pln) const
Definition: infinitePlane.hpp:147
pFlow::infinitePlane::infinitePlane
INLINE_FUNCTION_HD infinitePlane()
Default.
Definition: infinitePlane.hpp:51
pFlow
Definition: demGeometry.hpp:27
FUNCTION_H
#define FUNCTION_H
Definition: pFlowMacros.hpp:62
dot
INLINE_FUNCTION_HD T dot(const quadruple< T > &oprnd1, const quadruple< T > &oprnd2)
pFlow::iIstream
Interface class for any input stream
Definition: iIstream.hpp:37
pFlow::infinitePlane::projectPoint
INLINE_FUNCTION_HD realx3 projectPoint(const realx3 &p) const
Definition: infinitePlane.hpp:133
FUNCTION_HD
#define FUNCTION_HD
Definition: pFlowMacros.hpp:61
pFlow::infinitePlane::parallel
INLINE_FUNCTION_HD bool parallel(const infinitePlane &pln) const
Definition: infinitePlane.hpp:140
pFlow::infinitePlane::d
const INLINE_FUNCTION_HD auto & d() const
Definition: infinitePlane.hpp:161
pFlow::infinitePlane::validPlane3
static bool validPlane3(const realx3 &p1, const realx3 &p2, const realx3 &p3)
Definition: infinitePlane.cpp:57
pFlow::infinitePlane::inPositiveDistance
INLINE_FUNCTION_HD bool inPositiveDistance(const realx3 &p, real dist) const
Definition: infinitePlane.hpp:113
pFlow::infinitePlane::infinitePlane
INLINE_FUNCTION_HD infinitePlane(const realx3 &normal, const real &d)
From components.
Definition: infinitePlane.hpp:55
pFlow::infinitePlane::inNegativeDistance
INLINE_FUNCTION_HD bool inNegativeDistance(const realx3 &p, real dist) const
Definition: infinitePlane.hpp:120
pFlow::infinitePlane::d_
real d_
distance value
Definition: infinitePlane.hpp:40
pFlow::infinitePlane::pointInPositiveSide
INLINE_FUNCTION_HD bool pointInPositiveSide(const realx3 &p) const
Definition: infinitePlane.hpp:101
iOstream.hpp
pFlow::infinitePlane::TypeInfoNV
TypeInfoNV("infinitePlane")
INLINE_FUNCTION_HD
#define INLINE_FUNCTION_HD
Definition: pFlowMacros.hpp:55
pFlow::triple< real >
pFlow::iOstream
Interface class for any output stream.
Definition: iOstream.hpp:59