OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
olb::PLattice< T, PARTICLETYPE > Class Template Reference

#include <pLattice.h>

+ Inheritance diagram for olb::PLattice< T, PARTICLETYPE >:
+ Collaboration diagram for olb::PLattice< T, PARTICLETYPE >:

Public Member Functions

 PLattice (ParticleSystem3D< T, PARTICLETYPE > &pSys, T overlap, T spacing)
 
void sort ()
 
int getMatches (int pInt, std::vector< std::pair< size_t, T > > &matches)
 
- Public Member Functions inherited from olb::ContactDetection< T, PARTICLETYPE >
 ContactDetection (ParticleSystem3D< T, PARTICLETYPE > &pSys)
 
 ContactDetection (ParticleSystem3D< T, PARTICLETYPE > &pSys, std::string name)
 
virtual ~ContactDetection ()
 
std::string getName ()
 

Additional Inherited Members

- Protected Attributes inherited from olb::ContactDetection< T, PARTICLETYPE >
ParticleSystem3D< T, PARTICLETYPE > & _pSys
 
std::string _name
 

Detailed Description

template<typename T, template< typename U > class PARTICLETYPE>
class olb::PLattice< T, PARTICLETYPE >

Definition at line 32 of file pLattice.h.

Constructor & Destructor Documentation

◆ PLattice()

template<typename T , template< typename U > class PARTICLETYPE>
olb::PLattice< T, PARTICLETYPE >::PLattice ( ParticleSystem3D< T, PARTICLETYPE > & pSys,
T overlap,
T spacing )

Definition at line 61 of file pLattice.h.

63 : ContactDetection<T, PARTICLETYPE>(pSys, "PLattice"),
64 _physPos(3, T()),
65 _physExtend(3, T()),
66 _intExtend(3, 0),
67 _overlap(overlap),
68 _spacing(spacing)
69{
70
71 _physPos = this->_pSys.getPhysPos();
72 _physExtend = this->_pSys.getPhysExtend();
73
74 int intOverlap = util::ceil(overlap / _spacing);
75 std::cout << "intOverlap: " << intOverlap << std::endl;
76 for (int i = 0; i < 3; i++) {
77 _physPos[i] -= overlap;
78 _intExtend[i] = util::ceil(_physExtend[i] / _spacing + 2 * intOverlap + 1);
79 std::cout << "intExtend[" << i << "]: " << _physExtend[i] << std::endl;
80 }
81
82 std::cout << "intOverlap: " << intOverlap << std::endl;
83
84 _pLattice.resize(_intExtend[0]);
85 for (int iX = 0; iX < _intExtend[0]; ++iX) {
86 _pLattice[iX].resize(_intExtend[1]);
87 for (int iY = 0; iY < _intExtend[1]; ++iY) {
88 _pLattice[iX][iY].resize(_intExtend[2]);
89 for (int iZ = 0; iZ < _intExtend[2]; ++iZ) {
90 }
91 }
92 }
93// cout << "intExtend " << _intExtend[0] << " "<< _intExtend[1] << " "<< _intExtend[2] << " " << std::endl;
94}
ParticleSystem3D< T, PARTICLETYPE > & _pSys
ADf< T, DIM > ceil(const ADf< T, DIM > &a)
Definition aDiff.h:900

References olb::ContactDetection< T, PARTICLETYPE >::_pSys, and olb::util::ceil().

+ Here is the call graph for this function:

Member Function Documentation

◆ getMatches()

template<typename T , template< typename U > class PARTICLETYPE>
int olb::PLattice< T, PARTICLETYPE >::getMatches ( int pInt,
std::vector< std::pair< size_t, T > > & matches )
virtual

Reimplemented from olb::ContactDetection< T, PARTICLETYPE >.

Definition at line 189 of file pLattice.h.

191{
192 matches.clear();
193 PARTICLETYPE<T>& p = this->_pSys[pInt];
194 int iX = util::floor((p.getPos()[0] - _physPos[0]) / _spacing);
195 int iY = util::floor((p.getPos()[1] - _physPos[1]) / _spacing);
196 int iZ = util::floor((p.getPos()[2] - _physPos[2]) / _spacing);
197
198 typename std::list<int>::iterator it = _pLattice[iX][iY][iZ].begin();
199 std::vector<T>& pos = p.getPos();
200 for (; it != _pLattice[iX][iY][iZ].end(); ++it) {
201 if (*it != -1) {
202 std::vector<T>& pos2 = this->_pSys[*it].getPos();
203 matches.push_back(
204 std::make_pair<size_t, T>(
205 *it,
206 util::pow(pos[0] - pos2[0], 2) + util::pow(pos[1] - pos2[1], 2)
207 + util::pow(pos[2] - pos2[2], 2)));
208 }
209 }
210 return matches.size();
211}
ADf< T, DIM > floor(const ADf< T, DIM > &a)
Definition aDiff.h:869
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112

References olb::util::floor(), and olb::util::pow().

+ Here is the call graph for this function:

◆ sort()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::PLattice< T, PARTICLETYPE >::sort ( )
virtual

Reimplemented from olb::ContactDetection< T, PARTICLETYPE >.

Definition at line 97 of file pLattice.h.

98{
99// _pLattice.clear();
100 for (int i = 0; i < _intExtend[0]; i++) {
101 for (int j = 0; j < _intExtend[1]; j++) {
102 for (int k = 0; k < _intExtend[2]; k++) {
103 _pLattice[i][j][k].clear();
104 }
105 }
106 }
107
108 std::vector<T> pos(3, T());
109 for (unsigned int i = 0; i < this->_pSys.sizeInclShadow(); i++) {
110 pos = this->_pSys[i].getPos();
111#if OLB_DEBUG
112 int aa = (pos[0] - _physPos[0]) / _spacing;
113 int bb = (pos[1] - _physPos[1]) / _spacing;
114 int cc = (pos[2] - _physPos[2]) / _spacing;
115
116 OLB_PRECONDITION( aa >= 0);
117 OLB_PRECONDITION( bb >= 0);
118 OLB_PRECONDITION( cc >= 0);
119 OLB_PRECONDITION( aa < _intExtend[0]);
120 OLB_PRECONDITION( bb < _intExtend[1]);
121 OLB_PRECONDITION( cc < _intExtend[2]);
122#endif
123
124 _pLattice[(int) util::floor((pos[0] - _physPos[0]) / _spacing)][(int) util::floor(
125 (pos[1] - _physPos[1]) / _spacing)][(int) util::floor(
126 (pos[2] - _physPos[2]) / _spacing)].push_back(i);
127 }
128
129 int iX = 0, iY = 0, iZ = 0;
130 int x = 0, y = 0, z = 0;
131 for (unsigned int s = 0; s < this->_pSys.size(); s++) {
132 pos = this->_pSys[s].getPos();
133 iX = util::floor((pos[0] - _physPos[0]) / _spacing);
134 iY = util::floor((pos[1] - _physPos[1]) / _spacing);
135 iZ = util::floor((pos[2] - _physPos[2]) / _spacing);
136 //
137 if (_pLattice[iX][iY][iZ].back() != -1) {
138
139 int a = 1, b = 1, c = 1;
140 int d = -1, e = -1, f = -1;
141 if (iX <= 0) {
142 d = 0;
143 }
144 if (iY <= 0) {
145 e = 0;
146 }
147 if (iZ <= 0) {
148 f = 0;
149 }
150 if (iX >= _intExtend[0]) {
151 a = 0;
152 }
153 if (iY >= _intExtend[1]) {
154 b = 0;
155 }
156 if (iZ >= _intExtend[2]) {
157 c = 0;
158 }
159
160 typename std::list<int>::iterator it;
161 for (int i = d; i <= a; i++) {
162 for (int j = e; j <= b; j++) {
163 for (int k = f; k <= c; k++) {
164 if (i != 0 || j != 0 || k != 0) {
165 it = _pLattice[iX + i][iY + j][iZ + k].begin();
166 int size = _pLattice[iX + i][iY + j][iZ + k].size();
167 for (int lauf = 0; lauf < size; lauf++, it++) {
168 if (*it != -1) {
169 pos = this->_pSys[*it].getPos();
170 T rad = this->_pSys[*it].getRad();
171 x = util::floor((pos[0] - _physPos[0] - i * rad) / _spacing);
172 y = util::floor((pos[1] - _physPos[1] - j * rad) / _spacing);
173 z = util::floor((pos[2] - _physPos[2] - k * rad) / _spacing);
174 if (x != iX || y != iY || z != iZ) {
175 _pLattice[iX][iY][iZ].push_back(*it);
176 }
177 }
178 }
179 }
180 }
181 }
182 }
183 _pLattice[iX][iY][iZ].push_back(-1);
184 }
185 }
186}
platform_constant int c[Q][D]
platform_constant Fraction s[Q]
constexpr int d() any_platform
#define OLB_PRECONDITION(COND)
Definition olbDebug.h:46

References olb::util::floor(), and OLB_PRECONDITION.

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: