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

Function OPS_removeObject

SRC/interpreter/OpenSeesMiscCommands.cpp:228–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228int OPS_removeObject()
229{
230 Domain* theDomain = OPS_GetDomain();
231 if (theDomain == 0) return -1;
232
233 // make sure at least one other argument to contain type of system
234 if (OPS_GetNumRemainingInputArgs() < 1) {
235 opserr << "WARNING want - remove objectType?\n";
236 return -1;
237 }
238 const char* type = OPS_GetString();
239
240 int tag;
241 if ((strcmp(type,"element") == 0) || (strcmp(type,"ele") == 0)) {
242 if (OPS_GetNumRemainingInputArgs() < 1) {
243 opserr << "WARNING want - remove element eleTag?\n";
244 return -1;
245 }
246
247 int numdata = 1;
248 if (OPS_GetIntInput(&numdata, &tag) < 0) {
249 opserr << "WARNING remove element tag? failed to read tag\n ";
250 return -1;
251 }
252 Element *theEle = theDomain->removeElement(tag);
253 if (theEle != 0) {
254 // we also have to remove any elemental loads from the domain
255 LoadPatternIter &theLoadPatterns = theDomain->getLoadPatterns();
256 LoadPattern *thePattern;
257
258 // go through all load patterns
259 while ((thePattern = theLoadPatterns()) != 0) {
260 ElementalLoadIter theEleLoads = thePattern->getElementalLoads();
261 ElementalLoad *theLoad;
262
263 // go through all elemental loads in the pattern
264 while ((theLoad = theEleLoads()) != 0) {
265
266 // remove & destroy elemental from elemental load if there
267 // note - if last element in load, remove the load and delete it
268
269 /* *****************
270 int numLoadsLeft = theLoad->removeElement(tag);
271 if (numLoadsLeft == 0) {
272 thePattern->removeElementalLoad(theLoad->getTag());
273 delete theLoad;
274 }
275 *********************/
276 }
277 }
278
279 // finally invoke the destructor on the element
280 delete theEle;
281 }
282 }
283
284 else if (strcmp(type,"loadPattern") == 0 || strcmp(type,"pattern") == 0) {
285 if (OPS_GetNumRemainingInputArgs() < 1) {

Callers 2

Tcl_ops_removeFunction · 0.85
Py_ops_removeFunction · 0.85

Calls 15

OPS_removeTimeSeriesFunction · 0.85
OPS_GetDomainFunction · 0.70
OPS_GetStringFunction · 0.70
OPS_GetIntInputFunction · 0.70
removeElementMethod · 0.45
removeLoadPatternMethod · 0.45
clearAllMethod · 0.45
removeParameterMethod · 0.45
removeNodeMethod · 0.45
removeRecordersMethod · 0.45

Tested by

no test coverage detected