gather particles from minind to maxind (not included) if checkfsi = true, skip fluid cells
| 491 | // gather particles from minind to maxind (not included) |
| 492 | // if checkfsi = true, skip fluid cells |
| 493 | void BackgroundMesh::gatherParticles(const VInt& minind, |
| 494 | const VInt& maxind, |
| 495 | VParticle& pts, bool checkfsi) { |
| 496 | int ndm = OPS_GetNDM(); |
| 497 | pts.clear(); |
| 498 | VInt index(ndm); |
| 499 | if (ndm == 2) { |
| 500 | for (int i = minind[0]; i < maxind[0]; ++i) { |
| 501 | index[0] = i; |
| 502 | for (int j = minind[1]; j < maxind[1]; ++j) { |
| 503 | index[1] = j; |
| 504 | std::map<VInt, BCell>::iterator it = |
| 505 | bcells.find(index); |
| 506 | if (it != bcells.end()) { |
| 507 | BCell& cell = it->second; |
| 508 | if (checkfsi && |
| 509 | cell.getType() == BACKGROUND_FLUID) { |
| 510 | continue; |
| 511 | } |
| 512 | pts.insert(pts.end(), cell.getPts().begin(), |
| 513 | cell.getPts().end()); |
| 514 | } |
| 515 | } |
| 516 | } |
| 517 | } else if (ndm == 3) { |
| 518 | for (int i = minind[0]; i < maxind[0]; ++i) { |
| 519 | index[0] = i; |
| 520 | for (int j = minind[1]; j < maxind[1]; ++j) { |
| 521 | index[1] = j; |
| 522 | for (int k = minind[2]; k < maxind[2]; ++k) { |
| 523 | index[2] = k; |
| 524 | std::map<VInt, BCell>::iterator it = |
| 525 | bcells.find(index); |
| 526 | if (it != bcells.end()) { |
| 527 | BCell& cell = it->second; |
| 528 | if (checkfsi && |
| 529 | cell.getType() == BACKGROUND_FLUID) { |
| 530 | continue; |
| 531 | } |
| 532 | pts.insert(pts.end(), cell.getPts().begin(), |
| 533 | cell.getPts().end()); |
| 534 | } |
| 535 | } |
| 536 | } |
| 537 | } |
| 538 | } |
| 539 | } |
| 540 | |
| 541 | double BackgroundMesh::QuinticKernel(double q, double h, int ndm) { |
| 542 | static double pi = 3.141592653589793; |