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

Method addStructure

SRC/element/PFEMElement/BackgroundMesh.cpp:1020–1178  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1018// set grids close to the structures as EMPTY unless it's
1019// STRUCTURE set FSI area bnodes and cells
1020int 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) {

Callers

nothing calls this directly

Calls 15

getCornersFunction · 0.85
getCrdsMethod · 0.80
emptyMethod · 0.80
getNodesMethod · 0.80
OPS_GetNDMFunction · 0.70
OPS_GetDomainFunction · 0.50
sizeMethod · 0.45
insertMethod · 0.45
getNodeMethod · 0.45
SizeMethod · 0.45
getTagMethod · 0.45

Tested by

no test coverage detected