NBSCrossLoop.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 
22 int32 m = this->head_(i,j,k);
23 CellType currentCell(i,j,k);
24 int32 n = -1;
25 
26 while( m > -1 )
27 {
28 
29  auto p_m = this->pointPosition_[m];
30  auto d_m = this->sizeRatio_* this->diameter_[m];
31 
32  int32x3 crossIndex = mapIndexLevels(
33  int32x3(i,j,k),
34  level_,
35  upperLevel.level());
36 
37 
38  for(int32 ii = -1; ii<2; ii++)
39  {
40  for(int32 jj=-1; jj<2; jj++)
41  {
42  int32 kk=-1;
43  while( kk < 2)
44  {
45  int32x3 nghbrCI = crossIndex + int32x3(ii,jj,kk);
46 
47  if( upperLevel.isInRange(nghbrCI) )
48  {
49  n = upperLevel.head_(
50  nghbrCI.x(),
51  nghbrCI.y(),
52  nghbrCI.z());
53 
54  while( n >-1)
55  {
56  auto p_n = this->pointPosition_[n];
57  auto d_n = this->sizeRatio_*this->diameter_[n];
58 
59  if( sphereSphereCheck(p_m, p_n, d_m, d_n) )
60  {
61  auto ln = n;
62  auto lm = m;
63  if(lm>ln) this->Swap(lm,ln);
64  if( auto res = pairs.insert(lm,ln); res <0)
65  {
66  getFullUpdate++;
67  }
68  }
69 
70  n = this->next_[n];
71  }
72 
73  }
74 
75  kk++;
76  }
77  }
78  }
79 
80  m = this->next_[m];
81 }
82 
pFlow::int32x3
triple< int32 > int32x3
Definition: types.hpp:41
n
int32 n
Definition: NBSCrossLoop.hpp:24
currentCell
CellType currentCell(i, j, k)
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::mapIndexLevels
INLINE_FUNCTION_HD int32x3 mapIndexLevels(const int32x3 &ind, int32 lowerLevel, int32 upperLevel)
Definition: NBSLevel.hpp:118
pFlow::sphereSphereCheck
INLINE_FUNCTION_HD bool sphereSphereCheck(const realx3 &p1, const realx3 p2, real d1, real d2)
Definition: contactSearchFunctions.hpp:105
m
int32 m
Definition: NBSCrossLoop.hpp:22