PhasicFlow
v0.1
www.cemf.ir
particleIdHandler.hpp
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
#ifndef __particleIdHandler_hpp__
22
#define __particleIdHandler_hpp__
23
24
25
#include "
pointFields.hpp
"
26
27
namespace
pFlow
28
{
29
30
class
particleIdHandler
31
{
32
protected
:
33
int32
nextId_
=0;
34
public
:
35
particleIdHandler
(
int32PointField_HD
&
id
)
36
{
37
int32
maxID = maxActive<DeviceSide>(
id
);
38
39
if
( maxID != -1 &&
id
.size() == 0 )
40
{
41
nextId_
= 0;
42
}
43
else
if
( maxID == -1 &&
id
.size()>0 )
44
{
45
nextId_
= 0;
46
id
.modifyOnHost();
47
48
ForAll
(i,
id
)
49
{
50
if
(
id
.isActive(i))
51
{
52
id
[i] =
getNextId
();
53
}
54
}
55
56
id
.syncViews();
57
}
58
else
if
( maxID >=
static_cast<
int32
>
(
id
.size()) )
59
{
60
nextId_
= maxID + 1;
61
}
62
else
63
{
64
nextId_
=
id
.size();
65
}
66
}
67
68
int32
getNextId
()
69
{
70
return
nextId_
++;
71
}
72
73
int32
nextId
()
const
74
{
75
return
nextId_
;
76
}
77
};
78
79
}
80
81
#endif
pFlow::particleIdHandler::particleIdHandler
particleIdHandler(int32PointField_HD &id)
Definition:
particleIdHandler.hpp:35
pFlow::particleIdHandler::getNextId
int32 getNextId()
Definition:
particleIdHandler.hpp:68
pFlow::particleIdHandler
Definition:
particleIdHandler.hpp:30
pointFields.hpp
pFlow
Definition:
demComponent.hpp:28
pFlow::pointField
Definition:
pointField.hpp:35
pFlow::int32
int int32
Definition:
builtinTypes.hpp:53
ForAll
#define ForAll(i, container)
Definition:
pFlowMacros.hpp:71
pFlow::particleIdHandler::nextId_
int32 nextId_
Definition:
particleIdHandler.hpp:33
pFlow::particleIdHandler::nextId
int32 nextId() const
Definition:
particleIdHandler.hpp:73
src
Particles
particles
particleIdHandler.hpp
Generated by
1.8.17