| 1420 | } |
| 1421 | |
| 1422 | int OPS_nodeAccel() |
| 1423 | { |
| 1424 | // make sure at least one other argument to contain type of system |
| 1425 | if (OPS_GetNumRemainingInputArgs() < 1) { |
| 1426 | opserr << "WARNING want - nodeAccel nodeTag? <dof?>\n"; |
| 1427 | return -1; |
| 1428 | } |
| 1429 | |
| 1430 | int tag; |
| 1431 | int dof = -1; |
| 1432 | int numdata = 1; |
| 1433 | |
| 1434 | if (OPS_GetIntInput(&numdata, &tag) < 0) { |
| 1435 | opserr << "WARNING nodeAccel nodeTag? dof? - could not read nodeTag? \n"; |
| 1436 | return -1; |
| 1437 | } |
| 1438 | |
| 1439 | if (OPS_GetNumRemainingInputArgs() > 0) { |
| 1440 | if (OPS_GetIntInput(&numdata, &dof) < 0) { |
| 1441 | opserr << "WARNING nodeAccel nodeTag? dof? - could not read dof? \n"; |
| 1442 | return -1; |
| 1443 | } |
| 1444 | } |
| 1445 | |
| 1446 | dof--; |
| 1447 | |
| 1448 | Domain* theDomain = OPS_GetDomain(); |
| 1449 | if (theDomain == 0) return -1; |
| 1450 | |
| 1451 | const Vector *nodalResponse = theDomain->getNodeResponse(tag, Accel); |
| 1452 | if (nodalResponse == 0) { |
| 1453 | opserr << "WARNING failed to get nodal response\n"; |
| 1454 | return -1; |
| 1455 | } |
| 1456 | |
| 1457 | int size = nodalResponse->Size(); |
| 1458 | |
| 1459 | if (dof >= 0) { |
| 1460 | |
| 1461 | if (size < dof) { |
| 1462 | opserr << "WARNING nodeAccel size < dof\n"; |
| 1463 | return -1; |
| 1464 | } |
| 1465 | |
| 1466 | double value = (*nodalResponse)(dof); |
| 1467 | |
| 1468 | // now we copy the value to the tcl string that is returned |
| 1469 | if (OPS_SetDoubleOutput(&numdata, &value, true) < 0) { |
| 1470 | opserr << "WARNING nodeAccel failed to set output\n"; |
| 1471 | return -1; |
| 1472 | } |
| 1473 | |
| 1474 | } else { |
| 1475 | |
| 1476 | double* data = new double[size]; |
| 1477 | for (int i=0; i<size; i++) { |
| 1478 | data[i] = (*nodalResponse)(i); |
| 1479 | } |
no test coverage detected