| 3454 | } |
| 3455 | |
| 3456 | int BackgroundMesh::moveParticles() { |
| 3457 | Domain* domain = OPS_GetDomain(); |
| 3458 | if (domain == 0) return 0; |
| 3459 | int ndm = OPS_GetNDM(); |
| 3460 | double dt = domain->getCurrentTime() - currentTime; |
| 3461 | |
| 3462 | // get current disp and velocity |
| 3463 | for (std::map<VInt, BNode>::iterator it = bnodes.begin(); |
| 3464 | it != bnodes.end(); ++it) { |
| 3465 | BNode& bnode = it->second; |
| 3466 | VInt& tags = bnode.getTags(); |
| 3467 | |
| 3468 | for (int i = 0; i < (int)bnode.size(); ++i) { |
| 3469 | Node* nd = domain->getNode(tags[i]); |
| 3470 | Pressure_Constraint* pc = |
| 3471 | domain->getPressure_Constraint(tags[i]); |
| 3472 | |
| 3473 | if (pc != 0) { |
| 3474 | auto& pn = bnode.getPressure(); |
| 3475 | auto& dpn = bnode.getPdot(); |
| 3476 | pn[i] = pc->getPressure(); |
| 3477 | dpn[i] = pc->getPdot(); |
| 3478 | } |
| 3479 | if (nd != 0) { |
| 3480 | const Vector& vel = nd->getTrialVel(); |
| 3481 | const Vector& accel = nd->getTrialAccel(); |
| 3482 | auto& vn = bnode.getVel(); |
| 3483 | auto& dvn = bnode.getAccel(); |
| 3484 | for (int j = 0; j < ndm; ++j) { |
| 3485 | vn[i][j] = vel(j); |
| 3486 | dvn[i][j] = accel(j); |
| 3487 | } |
| 3488 | } |
| 3489 | } |
| 3490 | } |
| 3491 | |
| 3492 | // store cells in a vector |
| 3493 | std::vector<BCell*> cells; |
| 3494 | VVInt indices; |
| 3495 | cells.reserve(bcells.size()); |
| 3496 | indices.reserve(bcells.size()); |
| 3497 | for (std::map<VInt, BCell>::iterator it = bcells.begin(); |
| 3498 | it != bcells.end(); ++it) { |
| 3499 | indices.push_back(it->first); |
| 3500 | cells.push_back(&(it->second)); |
| 3501 | } |
| 3502 | |
| 3503 | // move particles in each cell |
| 3504 | int res = 0; |
| 3505 | #pragma omp parallel for |
| 3506 | for (int j = 0; j < (int)cells.size(); ++j) { |
| 3507 | // get particles in cell |
| 3508 | const VParticle& pts = cells[j]->getPts(); |
| 3509 | |
| 3510 | // move the particle |
| 3511 | for (int i = 0; i < (int)pts.size(); ++i) { |
| 3512 | // set update state |
| 3513 | if (pts[i] == 0) continue; |
nothing calls this directly
no test coverage detected