| 233 | } |
| 234 | |
| 235 | int |
| 236 | MeshRegion::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 | |
| 270 | const ID & |
| 271 | MeshRegion::getNodes(void) |
no test coverage detected