www.cemf.ir
selectBox.cpp
Go to the documentation of this file.
1 /*------------------------------- phasicFlow ---------------------------------
2  O C enter of
3  O O E ngineering and
4  O O M ultiscale modeling of
5  OOOOOOO F luid flow
6 ------------------------------------------------------------------------------
7  Copyright (C): www.cemf.ir
8  email: hamid.r.norouzi AT gmail.com
9 ------------------------------------------------------------------------------
10 Licence:
11  This file is part of phasicFlow code. It is a free software for simulating
12  granular and multiphase flows. You can redistribute it and/or modify it under
13  the terms of GNU General Public License v3 or any other later versions.
14 
15  phasicFlow is distributed to help others in their research in the field of
16  granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
17  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 -----------------------------------------------------------------------------*/
20 
21 
22 #include "selectBox.hpp"
23 
24 
26 {
27  // to reduct allocations
29  (
30  static_cast<size_t>(0.2*pStruct().size())
31  );
32 
33  selectedPoints_.clear();
34  auto pPos = pStruct().pointPosition().hostView();
35 
36  ForAll(i , pPos)
37  {
38  if( box_.isInside( pPos[i] )) selectedPoints_.push_back(i);
39  }
40 }
41 
43 (
44  const pointStructure& pStruct,
45  const dictionary& dict
46 )
47 :
49  (
50  pStruct, dict
51  ),
52  box_
53  (
54  dict.subDict("selectBoxInfo")
55  )
56 {
57  selectAllPointsInBox();
58 }
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