for each structural node get current states find nearest bnode if bnode is empty, clear it add structure node to bnodes get min and max of FSI area set cells close to the structures as STRUCTURE set grids close to the structures as EMPTY unless it's STRUCTURE set FSI area bnodes and cells
| 1018 | // set grids close to the structures as EMPTY unless it's |
| 1019 | // STRUCTURE set FSI area bnodes and cells |
| 1020 | int BackgroundMesh::addStructure() { |
| 1021 | // get domain |
| 1022 | int ndm = OPS_GetNDM(); |
| 1023 | Domain* domain = OPS_GetDomain(); |
| 1024 | if (domain == 0) return 0; |
| 1025 | |
| 1026 | // add all structural nodes to the background |
| 1027 | int ndtag = Mesh::nextNodeTag(); |
| 1028 | std::set<int> allnodes; |
| 1029 | |
| 1030 | // sid from large to small |
| 1031 | for (auto it = structuralNodes.rbegin(); |
| 1032 | it != structuralNodes.rend(); ++it) { |
| 1033 | int sid = it->first; |
| 1034 | const VInt& snodes = it->second; |
| 1035 | |
| 1036 | // sid = 0 is reserved for internal use for fluid |
| 1037 | if (sid == 0) { |
| 1038 | continue; |
| 1039 | } |
| 1040 | |
| 1041 | for (int k = 0; k < (int)snodes.size(); ++k) { |
| 1042 | // check if already there |
| 1043 | std::pair<std::set<int>::iterator, bool> res = |
| 1044 | allnodes.insert(snodes[k]); |
| 1045 | if (res.second == false) { |
| 1046 | continue; |
| 1047 | } |
| 1048 | |
| 1049 | // get node |
| 1050 | Node* nd = domain->getNode(snodes[k]); |
| 1051 | if (nd == 0) continue; |
| 1052 | |
| 1053 | // nodal data |
| 1054 | const Vector& crds = nd->getCrds(); |
| 1055 | const Vector& disp = nd->getTrialDisp(); |
| 1056 | const Vector& vel = nd->getTrialVel(); |
| 1057 | const Vector& accel = nd->getTrialAccel(); |
| 1058 | |
| 1059 | if (crds.Size() != ndm || disp.Size() < ndm) { |
| 1060 | continue; |
| 1061 | } |
| 1062 | |
| 1063 | // create pressure constraint |
| 1064 | Pressure_Constraint* pc = |
| 1065 | domain->getPressure_Constraint(nd->getTag()); |
| 1066 | if (pc != 0) { |
| 1067 | pc->setDomain(domain); |
| 1068 | } else { |
| 1069 | // create pressure node |
| 1070 | Node* pnode = 0; |
| 1071 | if (ndm == 2) { |
| 1072 | pnode = new Node(ndtag++, 1, crds[0], crds[1]); |
| 1073 | } else if (ndm == 3) { |
| 1074 | pnode = new Node(ndtag++, 1, crds[0], crds[1], |
| 1075 | crds[2]); |
| 1076 | } |
| 1077 | if (pnode == 0) { |
nothing calls this directly
no test coverage detected