| 1512 | } |
| 1513 | |
| 1514 | int BackgroundMesh::moveFixedParticles() { |
| 1515 | int ndm = OPS_GetNDM(); |
| 1516 | |
| 1517 | // check each cell |
| 1518 | for (auto it = bcells.begin(); it != bcells.end(); ++it) { |
| 1519 | // get cell |
| 1520 | const VInt& index = it->first; |
| 1521 | BCell& cell = it->second; |
| 1522 | |
| 1523 | // empty cell |
| 1524 | if (cell.getPts().empty()) { |
| 1525 | continue; |
| 1526 | } |
| 1527 | |
| 1528 | // check if BACKGROUND_STRUCTURE cell |
| 1529 | if (cell.getType() != BACKGROUND_STRUCTURE) { |
| 1530 | continue; |
| 1531 | } |
| 1532 | |
| 1533 | // check neighbor cells |
| 1534 | VInt ind = index; |
| 1535 | VVInt indices; |
| 1536 | ind -= 1; |
| 1537 | getCorners(ind, 2, indices); |
| 1538 | |
| 1539 | // give each cell a score |
| 1540 | VInt scores(indices.size()); |
| 1541 | for (int i = 0; i < (int)indices.size(); ++i) { |
| 1542 | auto cellit = bcells.find(indices[i]); |
| 1543 | if (cellit == bcells.end()) { |
| 1544 | // empty cell |
| 1545 | scores[i] = -1; |
| 1546 | } else if (cellit->second.getType() == |
| 1547 | BACKGROUND_STRUCTURE) { |
| 1548 | scores[i] = -1; |
| 1549 | } else if (cellit->second.getPts().empty()) { |
| 1550 | scores[i] = -1; |
| 1551 | } else { |
| 1552 | // easier to get into cell already having particles |
| 1553 | scores[i] = 1; |
| 1554 | } |
| 1555 | } |
| 1556 | VVInt cellmap; |
| 1557 | if (ndm == 2) { |
| 1558 | cellmap.resize(9); |
| 1559 | for (int i = 0; i < (int)cellmap.size(); ++i) { |
| 1560 | cellmap[i].resize(3); |
| 1561 | cellmap[i][0] = i; |
| 1562 | } |
| 1563 | cellmap[0][1] = 1; |
| 1564 | cellmap[0][2] = 3; |
| 1565 | cellmap[1][1] = 0; |
| 1566 | cellmap[1][2] = 2; |
| 1567 | cellmap[2][1] = 1; |
| 1568 | cellmap[2][2] = 5; |
| 1569 | cellmap[3][1] = 0; |
| 1570 | cellmap[3][2] = 6; |
| 1571 | cellmap[4][1] = 4; |
nothing calls this directly
no test coverage detected