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

Function OPS_nodeVel

SRC/interpreter/OpenSeesOutputCommands.cpp:1351–1420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1349}
1350
1351int OPS_nodeVel()
1352{
1353 // make sure at least one other argument to contain type of system
1354 if (OPS_GetNumRemainingInputArgs() < 1) {
1355 opserr << "WARNING want - nodeVel nodeTag? <dof?>\n";
1356 return -1;
1357 }
1358
1359 int tag;
1360 int dof = -1;
1361 int numdata = 1;
1362
1363 if (OPS_GetIntInput(&numdata, &tag) < 0) {
1364 opserr << "WARNING nodeVel nodeTag? dof? - could not read nodeTag? \n";
1365 return -1;
1366 }
1367
1368 if (OPS_GetNumRemainingInputArgs() > 0) {
1369 if (OPS_GetIntInput(&numdata, &dof) < 0) {
1370 opserr << "WARNING nodeVel nodeTag? dof? - could not read dof? \n";
1371 return -1;
1372 }
1373 }
1374
1375 dof--;
1376
1377 Domain* theDomain = OPS_GetDomain();
1378 if (theDomain == 0) return -1;
1379
1380 const Vector *nodalResponse = theDomain->getNodeResponse(tag, Vel);
1381 if (nodalResponse == 0) {
1382 opserr << "WARNING failed to get nodal response\n";
1383 return -1;
1384 }
1385
1386 int size = nodalResponse->Size();
1387
1388 if (dof >= 0) {
1389
1390 if (size < dof) {
1391 opserr << "WARNING nodeVel size < dof\n";
1392 return -1;
1393 }
1394
1395 double value = (*nodalResponse)(dof);
1396
1397 // now we copy the value to the tcl string that is returned
1398 if (OPS_SetDoubleOutput(&numdata, &value, true) < 0) {
1399 opserr << "WARNING nodeVel failed to set output\n";
1400 return -1;
1401 }
1402
1403 } else {
1404
1405 double* data = new double[size];
1406 for (int i=0; i<size; i++) {
1407 data[i] = (*nodalResponse)(i);
1408 }

Callers 2

Tcl_ops_nodeVelFunction · 0.85
Py_ops_nodeVelFunction · 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