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

Function removeObject

SRC/runtime/commands/domain/domain.cpp:60–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58
59
60int
61removeObject(ClientData clientData, Tcl_Interp *interp, int argc,
62 Tcl_Obj *const *objv)
63{
64 assert(clientData != nullptr);
65 Domain * the_domain = (Domain*)clientData;
66
67 // make sure at least one other argument to contain type of object
68 if (argc < 2) {
69 opserr << "WARNING want - remove objectType?\n";
70 return TCL_ERROR;
71 }
72 const char* remove_type = Tcl_GetString(objv[1]);
73
74 int tag;
75 if ((strcmp(remove_type, "element") == 0) ||
76 (strcmp(remove_type, "ele") == 0)) {
77 if (argc < 3) {
78 opserr << "WARNING want - remove element eleTag?\n";
79 return TCL_ERROR;
80 }
81
82 if (Tcl_GetIntFromObj(interp, objv[2], &tag) != TCL_OK) {
83 opserr << "WARNING remove element tag? failed to read tag: "
84 << Tcl_GetString(objv[2]) << "\n";
85 return TCL_ERROR;
86 }
87 Element *theEle = the_domain->removeElement(tag);
88 if (theEle != nullptr) {
89
90 // finally invoke the destructor on the element
91 delete theEle;
92 }
93 }
94
95 else if ((strcmp(remove_type, "loadPattern") == 0) ||
96 (strcmp(remove_type, "pattern") == 0)) {
97 if (argc < 3) {
98 opserr << "WARNING want - remove loadPattern patternTag?\n";
99 return TCL_ERROR;
100 }
101 if (Tcl_GetIntFromObj(interp, objv[2], &tag) != TCL_OK) {
102 opserr << "WARNING remove loadPattern tag? failed to read tag: "
103 << Tcl_GetString(objv[2]) << "\n";
104 return TCL_ERROR;
105 }
106 LoadPattern *thePattern = the_domain->removeLoadPattern(tag);
107 if (thePattern != nullptr) {
108 thePattern->clearAll();
109 delete thePattern;
110 }
111 }
112
113 else if (strcmp(remove_type, "parameter") == 0) {
114 if (argc < 3) {
115 opserr << "WARNING want - remove parameter paramTag?\n";
116 return TCL_ERROR;
117 }

Callers

nothing calls this directly

Calls 11

removeElementMethod · 0.45
removeLoadPatternMethod · 0.45
clearAllMethod · 0.45
removeParameterMethod · 0.45
removeNodeMethod · 0.45
removeRecordersMethod · 0.45
removeRecorderMethod · 0.45
removeSP_ConstraintMethod · 0.45
removeMP_ConstraintsMethod · 0.45
removeMP_ConstraintMethod · 0.45

Tested by

no test coverage detected