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

Function OPS_randomVariable

SRC/interpreter/OpenSeesReliabilityCommands.cpp:681–1094  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

679}
680
681int OPS_randomVariable() {
682 RandomVariable *theRandomVariable = 0;
683 int tag;
684 double mean = 0.0;
685 double stdv = 1.0;
686 double startPt = 0.0;
687 int use_start_pt = 0;
688
689 double param = 0;
690 Vector parameters;
691
692 // CHECK THAT AT LEAST ENOUGH ARGUMENTS ARE GIVEN
693 if (OPS_GetNumRemainingInputArgs() < 2) {
694 opserr
695 << "ERROR: invalid number of arguments to randomVariable "
696 "command : randomVariable tag dist -mean mean -stdv stdv "
697 "-startPoint startPoint -parameters pram1 pram2 ...\n";
698 return -1;
699 }
700
701 // GET TAG NUMBER
702 int numdata = 1;
703 if (OPS_GetIntInput(&numdata, &tag) < 0) {
704 opserr << "ERROR: invalid input: tag \n";
705 return -1;
706 }
707
708 // GET DISTRIBUTION
709 const char *dist = OPS_GetString();
710
711 char *filename = 0;
712 char *functionname = 0;
713
714 // read options
715 while (OPS_GetNumRemainingInputArgs() > 0) {
716 const char *arg = OPS_GetString();
717
718 if (strcmp(arg, "-file") == 0) {
719 if (OPS_GetNumRemainingInputArgs() < 1) {
720 opserr
721 << "WARNING not enough args, need -file filename??\n";
722 opserr << "for random variable: " << tag << "\n";
723 return -1;
724 }
725 filename = (char *)OPS_GetString();
726 }
727 if (strcmp(arg, "-function") == 0) {
728 if (OPS_GetNumRemainingInputArgs() < 1) {
729 opserr << "WARNING not enough args, need -function "
730 "functionname??\n";
731 opserr << "for random variable: " << tag << "\n";
732 return -1;
733 }
734 functionname = (char *)OPS_GetString();
735 }
736
737 // user specified mean directly
738 if (strcmp(arg, "-mean") == 0) {

Callers 2

Tcl_ops_randomVariableFunction · 0.85
Py_ops_randomVariableFunction · 0.85

Calls 11

setStartValueMethod · 0.80
setCurrentValueMethod · 0.80
addRandomVariableMethod · 0.80
OPS_GetIntInputFunction · 0.70
OPS_GetStringFunction · 0.70
OPS_GetDoubleInputFunction · 0.70
OPS_ResetCurrentInputArgFunction · 0.70
SizeMethod · 0.45
getMeanMethod · 0.45
getDomainMethod · 0.45

Tested by

no test coverage detected