# PhasicFlow: src/Interaction/contactSearch/ContactSearch/ContactSearch.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.

ContactSearch.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 __ContactSearch_hpp__
#define __ContactSearch_hpp__
#include "contactSearchGlobals.hpp"
#include "contactSearch.hpp"
#include "box.hpp"
#include "particles.hpp"
#include "geometry.hpp"
#include "boundaryContactSearchList.hpp"
namespace pFlow
{
template<
class searchMethod
>
class ContactSearch
:
public contactSearch
{
public:
using IdType = uint32;
using ExecutionSpace = DefaultExecutionSpace;
using SearchMethodType = searchMethod;
private:
uniquePtr<SearchMethodType> ppwContactSearch_ = nullptr;
boundaryContactSearchList csBoundaries_;
bool BroadSearch(
const timeInfo& ti,
csPairContainerType& ppPairs,
csPairContainerType& pwPairs,
bool force = false) override
{
const auto& position = Particles().pointPosition().deviceViewAll();
const auto& flags = Particles().dynPointStruct().activePointsMaskDevice();
const auto& diam = Particles().boundingSphere().deviceViewAll();
return ppwContactSearch_().broadSearch(
ti.iter(),
ti.t(),
ti.dt(),
ppPairs,
pwPairs,
position,
flags,
diam,
force
);
}
bool BoundaryBroadSearch(
uint32 bndryIndex,
const timeInfo& ti,
csPairContainerType& ppPairs,
csPairContainerType& pwPairs,
bool force = false)override
{
return csBoundaries_[bndryIndex].broadSearch(
ti.iter(),
ti.t(),
ti.dt(),
ppPairs,
pwPairs,
force
);
}
public:
TypeInfoTemplate11("ContactSearch", SearchMethodType);
ContactSearch(
const dictionary& csDict,
const box& extDomain,
const particles& prtcl,
const geometry& geom,
Timers& timers)
:
contactSearch(
csDict,
extDomain,
prtcl,
geom,
timers),
csBoundaries_(
csDict,
Particles().pStruct().boundaries(),
*this)
{
real minD;
real maxD;
this->Particles().boundingSphereMinMax(minD, maxD);
const auto& position = this->Particles().pointPosition().deviceViewAll();
const auto& flags = this->Particles().dynPointStruct().activePointsMaskDevice();
const auto& diam = this->Particles().boundingSphere().deviceViewAll();
uint32 wnPoints = this->Geometry().numPoints();
uint32 wnTri = this->Geometry().size();
const auto& wPoints = this->Geometry().points().deviceViewAll();
const auto& wVertices = this->Geometry().vertices().deviceViewAll();
const auto& wNormals = this->Geometry().normals().deviceViewAll();
ppwContactSearch_ =
makeUnique<SearchMethodType>
(
dict(),
this->extendedDomainBox(),
minD,
maxD,
position,
flags,
diam,
wnPoints,
wnTri,
wPoints,
wVertices,
wNormals
);
}
add_vCtor(
contactSearch,
ContactSearch,
dictionary);
bool enterBroadSearchBoundary(const timeInfo& ti, bool force=false)const override
{
return enterBroadSearch(ti, force) || csBoundaries_.boundariesUpdated();
}
real sizeRatio()const override
{
return ppwContactSearch_().sizeRatio();
}
real cellExtent()const override
{
return ppwContactSearch_().cellExtent();
}
};
}
#endif //__ContactSearch_hpp__
pFlow::boundaryContactSearchList::boundariesUpdated
bool boundariesUpdated() const
Definition: boundaryContactSearchList.cpp:29
pFlow::contactSearch::Geometry
const geometry & Geometry() const
Definition: contactSearch.hpp:174
pFlow::ContactSearch::add_vCtor
add_vCtor(contactSearch, ContactSearch, dictionary)
pFlow::triSurface::vertices
const uint32x3Field_D & vertices() const
Definition: triSurface.hpp:192
pFlow::real
float real
Definition: builtinTypes.hpp:45
pFlow::ContactSearch::ppwContactSearch_
uniquePtr< SearchMethodType > ppwContactSearch_
Definition: ContactSearch.hpp:52
pFlow::contactSearch::enterBroadSearch
bool enterBroadSearch(const timeInfo &ti, bool force=false) const
Definition: contactSearch.hpp:139
pFlow::ContactSearch::cellExtent
real cellExtent() const override
Definition: ContactSearch.hpp:167
pFlow::ContactSearch::ExecutionSpace
DefaultExecutionSpace ExecutionSpace
Definition: ContactSearch.hpp:46
pFlow::internalField::deviceViewAll
const auto & deviceViewAll() const
Definition: internalField.hpp:92
pFlow::ContactSearch::enterBroadSearchBoundary
bool enterBroadSearchBoundary(const timeInfo &ti, bool force=false) const override
Definition: ContactSearch.hpp:157
pFlow::ContactSearch::csBoundaries_
boundaryContactSearchList csBoundaries_
Definition: ContactSearch.hpp:54
pFlow::ContactSearch::sizeRatio
real sizeRatio() const override
Definition: ContactSearch.hpp:162
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
box.hpp
boundaryContactSearchList.hpp
particles.hpp
pFlow::DefaultExecutionSpace
Kokkos::DefaultExecutionSpace DefaultExecutionSpace
Default execution space, it can be device exe.
Definition: KokkosTypes.hpp:61
pFlow::contactSearch::dict
const dictionary & dict() const
Definition: contactSearch.hpp:154
pFlow::contactSearch::pStruct
const pointStructure & pStruct() const
Definition: contactSearch.cpp:43
pFlow::Timers
Definition: Timers.hpp:32
pFlow::ContactSearch::IdType
uint32 IdType
Definition: ContactSearch.hpp:44
pFlow::timeInfo
Definition: timeInfo.hpp:28
pFlow::triSurface::numPoints
uint32 numPoints() const
Definition: triSurface.hpp:157
pFlow::unsortedPairs
Definition: unsortedPairs.hpp:32
pFlow
Definition: demGeometry.hpp:27
pFlow::boundaryContactSearchList
Definition: boundaryContactSearchList.hpp:10
pFlow::particles::boundingSphere
virtual const realPointField_D & boundingSphere() const =0
pFlow::particles
Definition: particles.hpp:33
pFlow::particles::pointPosition
auto & pointPosition()
Definition: particles.hpp:79
pFlow::triSurface::size
uint32 size() const
Definition: triSurface.hpp:162
pFlow::triSurface::points
const realx3Field_D & points() const
Definition: triSurface.hpp:172
contactSearchGlobals.hpp
geometry.hpp
pFlow::timeInfo::dt
const real & dt() const
Definition: timeInfo.hpp:51
pFlow::ContactSearch::ContactSearch
ContactSearch(const dictionary &csDict, const box &extDomain, const particles &prtcl, const geometry &geom, Timers &timers)
Definition: ContactSearch.hpp:101
pFlow::VectorSingle::deviceViewAll
INLINE_FUNCTION_H auto & deviceViewAll()
Device view range [0,capcity)
Definition: VectorSingle.cpp:249
pFlow::triSurface::normals
auto & normals()
Definition: triSurface.hpp:202
pFlow::contactSearch
Definition: contactSearch.hpp:42
pFlow::ContactSearch::TypeInfoTemplate11
TypeInfoTemplate11("ContactSearch", SearchMethodType)
pFlow::ContactSearch::SearchMethodType
searchMethod SearchMethodType
Definition: ContactSearch.hpp:48
pFlow::contactSearch::extendedDomainBox
const box & extendedDomainBox() const
Definition: contactSearch.hpp:160
pFlow::contactSearch::Particles
const particles & Particles() const
Definition: contactSearch.hpp:166
pFlow::timeInfo::t
const real & t() const
Definition: timeInfo.hpp:47
pFlow::box
Definition: box.hpp:32
pFlow::timeInfo::iter
const uint32 & iter() const
Definition: timeInfo.hpp:55
pFlow::uniquePtr< SearchMethodType >
pFlow::geometry
Base class for geometry for managing tri-surfaces, geometry motion, and surface physical properties.
Definition: geometry.hpp:44
pFlow::ContactSearch::BroadSearch
bool BroadSearch(const timeInfo &ti, csPairContainerType &ppPairs, csPairContainerType &pwPairs, bool force=false) override
Definition: ContactSearch.hpp:56
pFlow::particles::dynPointStruct
auto & dynPointStruct()
Definition: particles.hpp:74
pFlow::ContactSearch
Definition: ContactSearch.hpp:38
contactSearch.hpp
pFlow::particles::boundingSphereMinMax
virtual void boundingSphereMinMax(real &minDiam, real &maxDiam) const =0
Definition: particles.cpp:116
pFlow::ContactSearch::BoundaryBroadSearch
bool BoundaryBroadSearch(uint32 bndryIndex, const timeInfo &ti, csPairContainerType &ppPairs, csPairContainerType &pwPairs, bool force=false) override
Definition: ContactSearch.hpp:80
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