PhasicFlow
v0.1
www.cemf.ir
selectRange.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 "
selectRange.hpp
"
23
#include "
dictionary.hpp
"
24
25
void
pFlow::selectRange::selectAllPointsInRange
()
26
{
27
// to reduct allocations
28
int32
maxNum = (
end_
-
begin_
)/
stride_
+2;
29
30
selectedPoints_
.
reserve
(maxNum);
31
32
selectedPoints_
.
clear
();
33
34
for
(
int32
i =
begin_
; i<
end_
; i+=
stride_
)
35
{
36
selectedPoints_
.push_back(i);
37
}
38
}
39
40
pFlow::selectRange::selectRange
41
(
42
const
pointStructure
&
pStruct
,
43
const
dictionary
& dict
44
)
45
:
46
pStructSelector
47
(
48
pStruct
, dict
49
),
50
begin_
51
(
52
dict.
subDict
(
"selectRangeInfo"
).
getVal
<
int32
>(
"begin"
)
53
),
54
end_
55
(
56
dict.
subDict
(
"selectRangeInfo"
).
getValOrSet
(
"end"
,
pStruct
.size())
57
),
58
stride_
59
(
60
dict.
subDict
(
"selectRangeInfo"
).
getValOrSet
(
"stride"
, 1)
61
)
62
{
63
begin_ =
max
(begin_,1);
64
end_ =
min
(end_,
static_cast<
int32
>
(
pStruct
.size()));
65
stride_ =
max
(stride_,1);
66
67
selectAllPointsInRange();
68
}
pFlow::selectRange::selectAllPointsInRange
void selectAllPointsInRange()
Definition:
selectRange.cpp:25
pFlow::dictionary::getValOrSet
T getValOrSet(const word &keyword, const T &setVal) const
Definition:
dictionary.hpp:325
pFlow::selectRange::selectRange
selectRange(const pointStructure &pStruct, const dictionary &dict)
Definition:
selectRange.cpp:41
pFlow::pointStructure
Definition:
pointStructure.hpp:44
pFlow::int32
int int32
Definition:
builtinTypes.hpp:53
pFlow::selectRange::begin_
int32 begin_
Definition:
selectRange.hpp:43
pFlow::selectRange::end_
int32 end_
Definition:
selectRange.hpp:46
dictionary.hpp
pFlow::Vector::reserve
auto reserve(label len)
Definition:
Vector.hpp:309
pFlow::dictionary::subDict
dictionary & subDict(const word &keyword)
Definition:
dictionary.cpp:547
pFlow::max
T max(const Vector< T, Allocator > &v)
Definition:
VectorMath.hpp:164
pStruct
auto & pStruct
Definition:
setPointStructure.hpp:24
pFlow::dictionary::getVal
T getVal(const word &keyword) const
Definition:
dictionary.hpp:309
pFlow::Vector::clear
auto clear()
Definition:
Vector.hpp:248
pFlow::pStructSelector
Definition:
pStructSelector.hpp:36
pFlow::selectRange::selectedPoints_
int32Vector selectedPoints_
Definition:
selectRange.hpp:40
selectRange.hpp
pFlow::selectRange::stride_
int32 stride_
Definition:
selectRange.hpp:49
pFlow::min
T min(const Vector< T, Allocator > &v)
Definition:
VectorMath.hpp:138
pFlow::dictionary
Definition:
dictionary.hpp:38
src
phasicFlow
structuredData
pointStructure
selectors
selectRange
selectRange.cpp
Generated by
1.8.17