MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / computeDensities

Function computeDensities

Tools/FoamGenerator/main.cpp:1326–1352  ·  view source on GitHub ↗

Compute densities of the fluid particles. */

Source from the content-addressed store, hash-verified

1324/** Compute densities of the fluid particles.
1325*/
1326void computeDensities()
1327{
1328 densities.resize(x0.size());
1329
1330 #pragma omp parallel default(shared)
1331 {
1332 #pragma omp for schedule(static)
1333 for (int i = 0; i < (int)x0.size(); i++)
1334 {
1335 Real &density = densities[i];
1336
1337 // Compute current density for particle i
1338 density = mass * CubicKernel::W_zero();
1339 const Vector3r &xi = x0[i];
1340
1341 //////////////////////////////////////////////////////////////////////////
1342 // Fluid
1343 //////////////////////////////////////////////////////////////////////////
1344 for (unsigned int j = 0; j < numberOfNeighbors(0, i); j++)
1345 {
1346 const unsigned int neighborIndex = getNeighbor(0, i, j);
1347 const Vector3r &xj = x0[neighborIndex];
1348 density += mass * CubicKernel::W(xi - xj);
1349 }
1350 }
1351 }
1352}
1353
1354/** Returns two orthogonal vectors to vec which are also orthogonal to each other.
1355*/

Callers 12

stepMethod · 0.85
stepMethod · 0.85
stepMethod · 0.85
stepMethod · 0.85
stepMethod · 0.85
stepMethod · 0.85
stepMethod · 0.85
stepMethod · 0.85
stepMethod · 0.85
determineValuesFunction · 0.85
generateFoamFunction · 0.85
stepMethod · 0.85

Calls 4

numberOfNeighborsFunction · 0.70
getNeighborFunction · 0.70
resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected