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

Method setNodesOnly

SRC/domain/region/MeshRegion.cpp:146–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146int
147MeshRegion::setNodesOnly(const ID &theNods)
148{
149 // destroy the old node list
150 if (theNodes != 0)
151 delete theNodes;
152
153 // create new node list
154 Domain *theDomain = this->getDomain();
155 if (theDomain == 0) {
156 opserr << "MeshRegion::setNodesOnly() - no domain yet set\n";
157 return -1;
158 }
159
160 int numNodes = theNods.Size();
161 theNodes = new ID(0, numNodes);
162 if (theNodes == 0) {
163 opserr << "MeshRegion::setNodesOnly() - ran out of memory\n";
164 return -1;
165 }
166
167 // add nodes to the node list if in the domain
168 int loc = 0;
169 for (int i = 0; i<numNodes; i++) {
170 int nodeTag = theNods(i);
171 Node *theNode = theDomain->getNode(nodeTag);
172 if (theNode != 0) {
173 if (theNodes->getLocation(nodeTag) < 0)
174 (*theNodes)[loc++] = nodeTag;
175 }
176 }
177
178 return 0;
179}
180
181int
182MeshRegion::setElements(const ID &theEles)

Callers 3

OPS_MeshRegionFunction · 0.80
TclAddMeshRegionFunction · 0.80
TclCommand_addMeshRegionFunction · 0.80

Calls 4

getDomainMethod · 0.45
SizeMethod · 0.45
getNodeMethod · 0.45
getLocationMethod · 0.45

Tested by

no test coverage detected