MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / addWall

Function addWall

Demos/FluidDemo/main.cpp:315–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313
314
315void addWall(const Vector3r &minX, const Vector3r &maxX, std::vector<Vector3r> &boundaryParticles)
316{
317 const Real particleDistance = static_cast<Real>(2.0)*model.getParticleRadius();
318
319 const Vector3r diff = maxX - minX;
320 const unsigned int stepsX = (unsigned int)(diff[0] / particleDistance) + 1u;
321 const unsigned int stepsY = (unsigned int)(diff[1] / particleDistance) + 1u;
322 const unsigned int stepsZ = (unsigned int)(diff[2] / particleDistance) + 1u;
323
324 const unsigned int startIndex = (unsigned int) boundaryParticles.size();
325 boundaryParticles.resize(startIndex + stepsX*stepsY*stepsZ);
326
327 #pragma omp parallel default(shared)
328 {
329 #pragma omp for schedule(static)
330 for (int j = 0; j < (int)stepsX; j++)
331 {
332 for (unsigned int k = 0; k < stepsY; k++)
333 {
334 for (unsigned int l = 0; l < stepsZ; l++)
335 {
336 const Vector3r currPos = minX + Vector3r(j*particleDistance, k*particleDistance, l*particleDistance);
337 boundaryParticles[startIndex + j*stepsY*stepsZ + k*stepsZ + l] = currPos;
338 }
339 }
340 }
341 }
342}
343
344void initBoundaryData(std::vector<Vector3r> &boundaryParticles)
345{

Callers 1

initBoundaryDataFunction · 0.85

Calls 3

getParticleRadiusMethod · 0.80
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected