# PhasicFlow: src/phasicFlow/structuredData/pointStructure/selectors/selectBox/selectBox.cpp Source File

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().hostVector();
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::VectorSingle::hostVector
const INLINE_FUNCTION_H auto hostVector() const
Definition: VectorSingle.hpp:336
pFlow::selectBox::box_
box box_
Definition: selectBox.hpp:43
pFlow::selectBox::selectedPoints_
int32Vector selectedPoints_
Definition: selectBox.hpp:41
pFlow::pointStructure::pointPosition
FUNCTION_H realx3Field_D & pointPosition()
Definition: pointStructure.cpp:64
pFlow::pointStructure
Definition: pointStructure.hpp:44
pFlow::selectBox::selectBox
selectBox(const pointStructure &pStruct, const dictionary &dict)
Definition: selectBox.cpp:43
pFlow::Vector::reserve
auto reserve(label len)
Definition: Vector.hpp:309
pFlow::pStructSelector::pStruct
const pointStructure & pStruct() const
Definition: pStructSelector.cpp:35
ForAll
#define ForAll(i, container)
Definition: pFlowMacros.hpp:71
pFlow::dictionary::subDict
dictionary & subDict(const word &keyword)
Definition: dictionary.cpp:547
pStruct
auto & pStruct
Definition: setPointStructure.hpp:24
pFlow::Vector::clear
auto clear()
Definition: Vector.hpp:248
pFlow::pStructSelector
Definition: pStructSelector.hpp:36
pFlow::box::isInside
INLINE_FUNCTION_HD bool isInside(const realx3 &point) const
Definition: box.hpp:82
pFlow::selectBox::selectAllPointsInBox
void selectAllPointsInBox()
Definition: selectBox.cpp:25
pFlow::dictionary
Definition: dictionary.hpp:38
selectBox.hpp