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 
34  auto pPos = pStruct().pointPosition().hostVector();
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::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