MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / moveFixedParticles

Method moveFixedParticles

SRC/element/PFEMElement/BackgroundMesh.cpp:1514–1784  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1512}
1513
1514int 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;

Callers

nothing calls this directly

Calls 15

getCornersFunction · 0.85
normVDoubleFunction · 0.85
emptyMethod · 0.80
getNodesMethod · 0.80
getCrdsMethod · 0.80
moveToMethod · 0.80
setVelOnlyMethod · 0.80
clearParticlesMethod · 0.80
OPS_GetNDMFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected