| 968 | |
| 969 | |
| 970 | int |
| 971 | RemoveRecorder::elimElem(int theEleTag, double timeStamp) |
| 972 | { |
| 973 | |
| 974 | #ifdef MMTDEBUG |
| 975 | opserr << "RemoveRecorder::elimElem() remving ele: " << theEleTag << " at timeStamp: " << timeStamp << endln;; |
| 976 | #endif |
| 977 | |
| 978 | Element *theEle = theDomain->removeElement(theEleTag); |
| 979 | if (theEle != 0) { |
| 980 | // we also have to remove any elemental loads from the domain |
| 981 | LoadPatternIter &theLoadPatterns = theDomain->getLoadPatterns(); |
| 982 | LoadPattern *thePattern; |
| 983 | |
| 984 | // go through all load patterns |
| 985 | while ((thePattern = theLoadPatterns()) != 0) { |
| 986 | |
| 987 | ElementalLoadIter theEleLoads = thePattern->getElementalLoads(); |
| 988 | ElementalLoad *theLoad; |
| 989 | |
| 990 | // go through all elemental loads in the pattern |
| 991 | while ((theLoad = theEleLoads()) != 0) { |
| 992 | |
| 993 | // remove & destroy elemental from elemental load if there |
| 994 | // Note - if last element in load, remove the load and delete it |
| 995 | |
| 996 | int loadEleTag = theLoad->getElementTag(); |
| 997 | if (loadEleTag == theEleTag) { |
| 998 | opserr << "RemoveRecorder::elimElem() -3 removing eleLoad\n"; |
| 999 | |
| 1000 | ElementalLoad *theElementalLoad = thePattern->removeElementalLoad(theLoad->getTag()); |
| 1001 | if (theElementalLoad != 0) { |
| 1002 | delete theElementalLoad; |
| 1003 | } |
| 1004 | } |
| 1005 | } |
| 1006 | } |
| 1007 | |
| 1008 | // finally invoke the destructor on the element |
| 1009 | // delete theEle; |
| 1010 | /////////////// M.Talaat : Avoid recorder trouble at element removal and just set it to zero after removing it from the domain! |
| 1011 | theEle->revertToStart(); |
| 1012 | |
| 1013 | RemoveRecorder::remEleList[RemoveRecorder::numRemEles] = theEle->getTag(); |
| 1014 | |
| 1015 | Element **newRemEles = new Element *[numRemEles+1]; |
| 1016 | for (int ii=0; ii<numRemEles; ii++) |
| 1017 | newRemEles[ii] = remEles[ii]; |
| 1018 | |
| 1019 | newRemEles[numRemEles] = theEle; |
| 1020 | if (remEles != 0) |
| 1021 | delete [] remEles; |
| 1022 | |
| 1023 | remEles = newRemEles; |
| 1024 | |
| 1025 | numRemEles ++; |
| 1026 | |
| 1027 | // now give us some notice of what happened |
no test coverage detected