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

Method setElementsOnly

SRC/domain/region/MeshRegion.cpp:235–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233}
234
235int
236MeshRegion::setElementsOnly(const ID &theEles)
237{
238 // destroy the old element list
239 if (theElements != 0)
240 delete theElements;
241
242 // create new element list
243 Domain *theDomain = this->getDomain();
244 if (theDomain == 0) {
245 opserr << "MeshRegion::setElementsOnly() - no domain yet set\n";
246 return -1;
247 }
248
249 int numEles = theEles.Size();
250 theElements = new ID(0, numEles);
251 if (theElements == 0) {
252 opserr << "MeshRegion::setElementsOnly() - ran out of memory\n";
253 return -1;
254 }
255
256 // add elements to the ele list if in the domain
257 int loc = 0;
258 for (int i = 0; i<numEles; i++) {
259 int eleTag = theEles(i);
260 Element *theEle = theDomain->getElement(eleTag);
261 if (theEle != 0) {
262 if (theElements->getLocation(eleTag) < 0)
263 (*theElements)[loc++] = eleTag;
264 }
265 }
266
267 return 0;
268}
269
270const ID &
271MeshRegion::getNodes(void)

Callers 3

OPS_MeshRegionFunction · 0.80
TclAddMeshRegionFunction · 0.80
TclCommand_addMeshRegionFunction · 0.80

Calls 4

getDomainMethod · 0.45
SizeMethod · 0.45
getElementMethod · 0.45
getLocationMethod · 0.45

Tested by

no test coverage detected