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

Function OPS_setNodeDisp

SRC/interpreter/OpenSeesMiscCommands.cpp:491–549  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

489}
490
491int OPS_setNodeDisp()
492{
493 // make sure at least one other argument to contain type of system
494 if (OPS_GetNumRemainingInputArgs() < 3) {
495 opserr << "WARNING want - setNodeDisp nodeTag? dof? value? <-commit>\n";
496 return -1;
497 }
498
499 int tag;
500 int dof = -1;
501 double value = 0.0;
502 bool commit = false;
503 int numdata = 1;
504
505 if (OPS_GetIntInput(&numdata, &tag) < 0) {
506 opserr << "WARNING setNodeDisp nodeTag? dof? - could not read nodeTag? \n";
507 return -1;
508 }
509
510 Domain* theDomain = OPS_GetDomain();
511 if (theDomain == 0) return -1;
512
513 Node *theNode = theDomain->getNode(tag);
514 if (theNode == 0) {
515 opserr << "WARNING setNodeDisp -- node with tag " << tag << " not found" << endln;
516 return -1;
517 }
518
519 if (OPS_GetIntInput(&numdata, &dof) < 0) {
520 opserr << "WARNING setNodeDisp nodeTag? dof? value?- could not read dof? \n";
521 return -1;
522 }
523
524 if (OPS_GetDoubleInput(&numdata, &value) < 0) {
525 opserr << "WARNING setNodeDisp nodeTag? dof? value?- could not read dof? \n";
526 return -1;
527 }
528
529 if (OPS_GetNumRemainingInputArgs() > 0) {
530 const char* optArg = OPS_GetString();
531 if (strcmp(optArg, "-commit") == 0)
532 commit = true;
533 }
534
535 dof--;
536
537 int numDOF = theNode->getNumberDOF();
538
539 if (dof >= 0 && dof < numDOF) {
540 Vector disp(numDOF);
541 disp = theNode->getDisp();
542 disp(dof) = value;
543 theNode->setTrialDisp(disp);
544 }
545 if (commit)
546 theNode->commitState();
547
548 return 0;

Callers 2

Tcl_ops_setNodeDispFunction · 0.85
Py_ops_setNodeDispFunction · 0.85

Calls 10

OPS_GetIntInputFunction · 0.70
OPS_GetDomainFunction · 0.70
OPS_GetDoubleInputFunction · 0.70
OPS_GetStringFunction · 0.70
getNodeMethod · 0.45
getNumberDOFMethod · 0.45
getDispMethod · 0.45
setTrialDispMethod · 0.45
commitStateMethod · 0.45

Tested by

no test coverage detected