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

selectBox.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 "selectBox.hpp"
void pFlow::selectBox::selectAllPointsInBox()
{
// to reduct allocations
selectedPoints_.reserve
(
static_cast<size_t>(0.2*pStruct().size())
);
selectedPoints_.clear();
auto pPos = pStruct().pointPosition().hostView();
ForAll(i , pPos)
{
if( box_.isInside( pPos[i] )) selectedPoints_.push_back(i);
}
}
pFlow::selectBox::selectBox
(
const pointStructure& pStruct,
const dictionary& dict
)
:
pStructSelector
(
pStruct, dict
),
box_
(
dict.subDict("selectBoxInfo")
)
{
selectAllPointsInBox();
}
pFlow::selectBox::box_
box box_
Definition: selectBox.hpp:43
pFlow::Vector::reserve
void reserve(size_t cap)
Reserve capacity for vector Preserve the content.
Definition: Vector.hpp:284
pFlow::internalPoints::pointPosition
const PointsType & pointPosition() const
Definition: internalPoints.cpp:209
pFlow::pointStructure
Definition: pointStructure.hpp:34
pFlow::VectorSingle::hostView
INLINE_FUNCTION_H auto hostView() const
Return a view accessible on Host in range [0,size)
Definition: VectorSingle.cpp:281
pFlow::selectBox::selectBox
selectBox(const pointStructure &pStruct, const dictionary &dict)
Definition: selectBox.cpp:43
pFlow::pStructSelector::pStruct
const pointStructure & pStruct() const
Definition: pStructSelector.cpp:45
ForAll
#define ForAll(i, container)
Definition: pFlowMacros.hpp:75
pFlow::dictionary::subDict
dictionary & subDict(const word &keyword)
ref to a subdictioanry fatalExit if not found
Definition: dictionary.cpp:560
pStruct
auto & pStruct
Definition: setPointStructure.hpp:24
pFlow::pStructSelector
Definition: pStructSelector.hpp:36
pFlow::selectBox::selectedPoints_
uint32Vector selectedPoints_
Definition: selectBox.hpp:41
pFlow::box::isInside
INLINE_FUNCTION_HD bool isInside(const realx3 &point) const
Definition: box.hpp:84
pFlow::selectBox::selectAllPointsInBox
void selectAllPointsInBox()
Definition: selectBox.cpp:25
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
selectBox.hpp