| 144 | } |
| 145 | |
| 146 | int |
| 147 | MeshRegion::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 | |
| 181 | int |
| 182 | MeshRegion::setElements(const ID &theEles) |
no test coverage detected