| 139 | // Method to add an element to the model. |
| 140 | |
| 141 | bool |
| 142 | AnalysisModel::addFE_Element(FE_Element *theElement) |
| 143 | { |
| 144 | // check we don't add a null pointer or this is a subclass |
| 145 | // trying to use this method when it shouldn't |
| 146 | if (theElement == 0 || theFEs == 0) |
| 147 | return false; |
| 148 | |
| 149 | // check if an Element with a similar tag already exists in the Domain |
| 150 | int tag = theElement->getTag(); |
| 151 | TaggedObject *other = theFEs->getComponentPtr(tag); |
| 152 | if (other != 0) { |
| 153 | opserr << "AnalysisModel::addFE_Element - element with tag " << tag << "already exists in model\n"; |
| 154 | return false; |
| 155 | } |
| 156 | |
| 157 | // add the element to the container object for the elements |
| 158 | bool result = theFEs->addComponent(theElement); |
| 159 | if (result == true) { |
| 160 | theElement->setAnalysisModel(*this); |
| 161 | numFE_Ele++; |
| 162 | return true; // o.k. |
| 163 | } else |
| 164 | return false; |
| 165 | |
| 166 | |
| 167 | return result; |
| 168 | } |
| 169 | |
| 170 | |
| 171 |
no test coverage detected