| 181 | } |
| 182 | |
| 183 | int OPS_sectionWeight() |
| 184 | { |
| 185 | // make sure at least one other argument to contain type of system |
| 186 | if (OPS_GetNumRemainingInputArgs() < 1) { |
| 187 | opserr << "WARNING want - sectionWeight eleTag? <secNum?> \n"; |
| 188 | return -1; |
| 189 | } |
| 190 | |
| 191 | //opserr << "sectionWeight: "; |
| 192 | //for (int i = 0; i < argc; i++) |
| 193 | // opserr << argv[i] << ' ' ; |
| 194 | //opserr << endln; |
| 195 | |
| 196 | int numdata = 1; |
| 197 | int tag; |
| 198 | if (OPS_GetIntInput(&numdata, &tag) < 0) { |
| 199 | opserr << "WARNING sectionWeight eleTag? <secNum?> - could not read int input? \n"; |
| 200 | return -1; |
| 201 | } |
| 202 | |
| 203 | int secNum = 0; |
| 204 | if (OPS_GetNumRemainingInputArgs() > 0) { |
| 205 | if (OPS_GetIntInput(&numdata, &secNum) < 0) { |
| 206 | opserr << "WARNING sectionWeight eleTag? <secNum?> - could not read int input? \n"; |
| 207 | return -1; |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | Domain* theDomain = OPS_GetDomain(); |
| 212 | if (theDomain == 0) return -1; |
| 213 | |
| 214 | Element *theElement = theDomain->getElement(tag); |
| 215 | if (theElement == 0) { |
| 216 | opserr << "WARNING sectionWeight element with tag " << tag << " not found in domain \n"; |
| 217 | return -1; |
| 218 | } |
| 219 | |
| 220 | int argcc = 1; |
| 221 | char a[80] = "integrationWeights"; |
| 222 | const char *argvv[1]; |
| 223 | argvv[0] = a; |
| 224 | |
| 225 | DummyStream dummy; |
| 226 | |
| 227 | Response *theResponse = theElement->setResponse(argvv, argcc, dummy); |
| 228 | if (theResponse == 0) { |
| 229 | return 0; |
| 230 | } |
| 231 | |
| 232 | theResponse->getResponse(); |
| 233 | Information &info = theResponse->getInformation(); |
| 234 | |
| 235 | const Vector &theVec = *(info.theVector); |
| 236 | int Np = theVec.Size(); |
| 237 | |
| 238 | if (secNum > 0 && secNum <= Np) { // One IP |
| 239 | double value = theVec(secNum-1); |
| 240 | numdata = 1; |
no test coverage detected