| 5942 | extern bool OPS_removeTimeSeries(int tag); |
| 5943 | |
| 5944 | int |
| 5945 | removeObject(ClientData clientData, Tcl_Interp *interp, int argc, |
| 5946 | TCL_Char **argv) |
| 5947 | { |
| 5948 | // make sure at least one other argument to contain type of system |
| 5949 | if (argc < 2) { |
| 5950 | opserr << "WARNING want - remove objectType?\n"; |
| 5951 | return TCL_ERROR; |
| 5952 | } |
| 5953 | |
| 5954 | int tag; |
| 5955 | if ((strcmp(argv[1],"element") == 0) || (strcmp(argv[1],"ele") == 0)) { |
| 5956 | if (argc < 3) { |
| 5957 | opserr << "WARNING want - remove element eleTag?\n"; |
| 5958 | return TCL_ERROR; |
| 5959 | } |
| 5960 | |
| 5961 | if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK) { |
| 5962 | opserr << "WARNING remove element tag? failed to read tag: " << argv[2] << endln; |
| 5963 | return TCL_ERROR; |
| 5964 | } |
| 5965 | Element *theEle = theDomain.removeElement(tag); |
| 5966 | if (theEle != 0) { |
| 5967 | // we also have to remove any elemental loads from the domain |
| 5968 | LoadPatternIter &theLoadPatterns = theDomain.getLoadPatterns(); |
| 5969 | LoadPattern *thePattern; |
| 5970 | |
| 5971 | // go through all load patterns |
| 5972 | while ((thePattern = theLoadPatterns()) != 0) { |
| 5973 | ElementalLoadIter theEleLoads = thePattern->getElementalLoads(); |
| 5974 | ElementalLoad *theLoad; |
| 5975 | |
| 5976 | // go through all elemental loads in the pattern |
| 5977 | while ((theLoad = theEleLoads()) != 0) { |
| 5978 | |
| 5979 | // remove & destroy elemental from elemental load if there |
| 5980 | // note - if last element in load, remove the load and delete it |
| 5981 | |
| 5982 | /* ***************** |
| 5983 | int numLoadsLeft = theLoad->removeElement(tag); |
| 5984 | if (numLoadsLeft == 0) { |
| 5985 | thePattern->removeElementalLoad(theLoad->getTag()); |
| 5986 | delete theLoad; |
| 5987 | } |
| 5988 | *********************/ |
| 5989 | } |
| 5990 | } |
| 5991 | |
| 5992 | // finally invoke the destructor on the element |
| 5993 | delete theEle; |
| 5994 | } |
| 5995 | } |
| 5996 | |
| 5997 | else if (strcmp(argv[1],"loadPattern") == 0 || strcmp(argv[1],"pattern") == 0) { |
| 5998 | if (argc < 3) { |
| 5999 | opserr << "WARNING want - remove loadPattern patternTag?\n"; |
| 6000 | return TCL_ERROR; |
| 6001 | } |
nothing calls this directly
no test coverage detected