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

Function OPS_nodeUnbalance

SRC/interpreter/OpenSeesOutputCommands.cpp:1281–1349  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1279}
1280
1281int OPS_nodeUnbalance()
1282{
1283 // make sure at least one other argument to contain type of system
1284 if (OPS_GetNumRemainingInputArgs() < 1) {
1285 opserr << "WARNING want - nodeUnbalance nodeTag? <dof?>\n";
1286 return -1;
1287 }
1288
1289 int tag;
1290 int dof = -1;
1291 int numdata = 1;
1292
1293 if (OPS_GetIntInput(&numdata, &tag) < 0) {
1294 opserr << "WARNING eleForce eleTag? dof? - could not read nodeTag? \n";
1295 return -1;
1296 }
1297
1298 if (OPS_GetNumRemainingInputArgs() > 0) {
1299 if (OPS_GetIntInput(&numdata, &dof) < 0) {
1300 opserr << "WARNING eleForce eleTag? dof? - could not read dof? \n";
1301 return -1;
1302 }
1303 }
1304
1305 dof--;
1306
1307 Domain* theDomain = OPS_GetDomain();
1308 if (theDomain == 0) return -1;
1309 const Vector *nodalResponse = theDomain->getNodeResponse(tag, Unbalance);
1310 if (nodalResponse == 0) {
1311 opserr << "WARNING failed to get nodal response\n";
1312 return -1;
1313 }
1314
1315 int size = nodalResponse->Size();
1316
1317 if (dof >= 0) {
1318
1319 if (size < dof) {
1320 opserr << "WARNING nodeUnbalance size < dof\n";
1321 return -1;
1322 }
1323
1324 double value = (*nodalResponse)(dof);
1325
1326 // now we copy the value to the tcl string that is returned
1327 if (OPS_SetDoubleOutput(&numdata, &value, true) < 0) {
1328 opserr << "WARNING nodeUnbalance failed to set output\n";
1329 return -1;
1330 }
1331
1332 } else {
1333
1334 double* data = new double[size];
1335 for (int i=0; i<size; i++) {
1336 data[i] = (*nodalResponse)(i);
1337 }
1338 if (OPS_SetDoubleOutput(&size, data, false) < 0) {

Callers 2

Tcl_ops_nodeUnbalanceFunction · 0.85
Py_ops_nodeUnbalanceFunction · 0.85

Calls 6

OPS_GetIntInputFunction · 0.70
OPS_GetDomainFunction · 0.70
OPS_SetDoubleOutputFunction · 0.70
getNodeResponseMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected