# PhasicFlow: src/phasicFlow/structuredData/box/box.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.

box.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 __box_hpp__
#define __box_hpp__
#include "types.hpp"
#include "dictionary.hpp"
#include "iIstream.hpp"
#include "iOstream.hpp"
namespace pFlow
{
class box
{
protected:
// - min point
realx3 min_{0,0,0};
// - max point
realx3 max_{1,1,1};
public:
// - type info
TypeInfoNV("box");
INLINE_FUNCTION_HD
box() = default;
INLINE_FUNCTION_HD
box(const realx3& minP, const realx3& maxP)
:
min_(minP),
max_(maxP)
{}
FUNCTION_H
explicit box(const dictionary& dict);
FUNCTION_H
explicit box(iIstream& is);
INLINE_FUNCTION_HD
box(const box&) = default;
INLINE_FUNCTION_HD
box(box&&) = default;
INLINE_FUNCTION_HD
box& operator=(const box&) = default;
INLINE_FUNCTION_HD
box& operator=(box&&) = default;
INLINE_FUNCTION_HD
~box()=default;
INLINE_FUNCTION_HD
bool isInside(const realx3& point)const
{
// box planes are also included as the inside of the box
return point >= min_ && point <=max_;
}
INLINE_FUNCTION_HD
const realx3& minPoint()const
{
return min_;
}
INLINE_FUNCTION_HD
const realx3& maxPoint()const
{
return max_;
}
INLINE_FUNCTION_HD
realx3& minPoint()
{
return min_;
}
INLINE_FUNCTION_HD
realx3& maxPoint()
{
return max_;
}
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;
};
FUNCTION_H
iIstream& operator >>(iIstream& is, box& b);
FUNCTION_H
iOstream& operator << (iOstream& os, const box& b);
INLINE_FUNCTION_HD
bool equal(const box& b1, const box& b2, real tol = smallValue)
{
return equal(b1.minPoint(), b2.minPoint(), tol) &&
equal(b1.maxPoint(), b2.maxPoint(), tol);
}
INLINE_FUNCTION_HD
bool operator ==(const box& b1, const box& b2)
{
return equal(b1, b2);
}
INLINE_FUNCTION_HD
box extendBox(const box& b, const realx3& dl)
{
return box(b.minPoint()-dl , b.maxPoint()+dl);
}
}
#endif
pFlow::box::box
INLINE_FUNCTION_HD box()=default
pFlow::real
float real
Definition: builtinTypes.hpp:45
pFlow::smallValue
const real smallValue
Definition: numericConstants.hpp:31
iIstream.hpp
types.hpp
pFlow::equal
INLINE_FUNCTION_HD bool equal(const box &b1, const box &b2, real tol=smallValue)
Definition: box.hpp:135
pFlow::operator==
INLINE_FUNCTION_HD bool operator==(const box &b1, const box &b2)
Definition: box.hpp:142
pFlow::box::max_
realx3 max_
Definition: box.hpp:40
pFlow::extendBox
INLINE_FUNCTION_HD box extendBox(const box &b, const realx3 &dl)
Definition: box.hpp:148
pFlow::box::operator=
INLINE_FUNCTION_HD box & operator=(const box &)=default
pFlow::box::box
INLINE_FUNCTION_HD box(const realx3 &minP, const realx3 &maxP)
Definition: box.hpp:52
pFlow::box::maxPoint
const INLINE_FUNCTION_HD realx3 & maxPoint() const
Definition: box.hpp:97
pFlow
Definition: demGeometry.hpp:27
FUNCTION_H
#define FUNCTION_H
Definition: pFlowMacros.hpp:62
pFlow::iIstream
Interface class for any input stream
Definition: iIstream.hpp:37
dictionary.hpp
pFlow::operator>>
INLINE_FUNCTION iIstream & operator>>(iIstream &str, AB3History &ab3)
Definition: AdamsBashforth3.hpp:41
pFlow::box::write
FUNCTION_H bool write(iOstream &os) const
Definition: box.cpp:65
pFlow::operator<<
INLINE_FUNCTION iOstream & operator<<(iOstream &str, const AB3History &ab3)
Definition: AdamsBashforth3.hpp:57
pFlow::box::minPoint
const INLINE_FUNCTION_HD realx3 & minPoint() const
Definition: box.hpp:91
pFlow::box
Definition: box.hpp:32
pFlow::box::minPoint
INLINE_FUNCTION_HD realx3 & minPoint()
Definition: box.hpp:103
pFlow::box::maxPoint
INLINE_FUNCTION_HD realx3 & maxPoint()
Definition: box.hpp:109
pFlow::box::~box
INLINE_FUNCTION_HD ~box()=default
pFlow::box::TypeInfoNV
TypeInfoNV("box")
iOstream.hpp
INLINE_FUNCTION_HD
#define INLINE_FUNCTION_HD
Definition: pFlowMacros.hpp:55
pFlow::triple< real >
pFlow::box::isInside
INLINE_FUNCTION_HD bool isInside(const realx3 &point) const
Definition: box.hpp:84
pFlow::iOstream
Interface class for any output stream.
Definition: iOstream.hpp:59
pFlow::box::read
FUNCTION_H bool read(iIstream &is)
Definition: box.cpp:57
pFlow::box::min_
realx3 min_
Definition: box.hpp:37
pFlow::dictionary
Dictionary holds a set of data entries or sub-dictionaries that are enclosed in a curely braces or ar...
Definition: dictionary.hpp:67