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

Function OPS_setParameter

SRC/interpreter/OpenSeesParameterCommands.cpp:574–683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

572}
573
574int OPS_setParameter() {
575 double newValue = 0.0;
576 ID eleIDs(0, 32);
577 int numEle = 0;
578 int flag = 0;
579
580 const char *opt = OPS_GetString();
581
582 int numdata = 1;
583 if (strcmp(opt, "-val") == 0) {
584 if (OPS_GetDoubleInput(&numdata, &newValue) < 0) {
585 opserr << "WARNING: failed to get paramber value\n";
586 return -1;
587 }
588 } else {
589 opserr << "WARNING setParameter: -val not found \n";
590 return -1;
591 }
592
593 if (OPS_GetNumRemainingInputArgs() == 0) return 0;
594
595 opt = OPS_GetString();
596
597 if ((strcmp(opt, "-ele") == 0) || (strcmp(opt, "-eles") == 0) ||
598 (strcmp(opt, "-element") == 0)) {
599 //
600 // read in a list of ele until end of command or other flag
601 //
602
603 int eleTag;
604 while (OPS_GetNumRemainingInputArgs() > 0) {
605 if (OPS_GetIntInput(&numdata, &eleTag) < 0) {
606 // back on arg
607 OPS_ResetCurrentInputArg(-1);
608 break;
609 } else {
610 eleIDs[numEle] = eleTag;
611 numEle++;
612 }
613 }
614
615 if (numEle > 0) flag = 1;
616
617 } else if (strcmp(opt, "-eleRange") == 0) {
618 flag = 2;
619
620 // ensure no segmentation fault if user messes up
621 if (OPS_GetNumRemainingInputArgs() < 2) {
622 opserr << "WARNING recorder Element .. -eleRange start? end? .. - "
623 "no ele tags specified\n";
624 return -1;
625 }
626
627 //
628 // read in start and end tags of two elements & add set [start,end]
629 //
630
631 int start, end;

Callers 2

Tcl_ops_setParameterFunction · 0.85
Py_ops_setParameterFunction · 0.85

Calls 13

push_backMethod · 0.80
emptyMethod · 0.80
getParametersMethod · 0.80
OPS_GetStringFunction · 0.70
OPS_GetDoubleInputFunction · 0.70
OPS_GetIntInputFunction · 0.70
OPS_ResetCurrentInputArgFunction · 0.70
OPS_GetDomainFunction · 0.70
getTagMethod · 0.45
sizeMethod · 0.45
addParameterMethod · 0.45

Tested by

no test coverage detected