Compute densities of the fluid particles. */
| 1324 | /** Compute densities of the fluid particles. |
| 1325 | */ |
| 1326 | void 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 | */ |
no test coverage detected