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

Function OPS_SP

SRC/interpreter/OpenSeesPatternCommands.cpp:1011–1104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1009
1010
1011int OPS_SP()
1012{
1013 Domain* theDomain = OPS_GetDomain();
1014 if(theDomain == 0) {
1015 opserr<<"WARNING: domain is not defined\n";
1016 return -1;
1017 }
1018
1019 if(OPS_GetNumRemainingInputArgs() < 3) {
1020 opserr<<"insufficient number of args\n";
1021 return -1;
1022 }
1023
1024 SP_Constraint *theSP = 0;
1025
1026 // get tags
1027 int tags[2];
1028 int numData = 2;
1029 if(OPS_GetIntInput(&numData, &tags[0]) < 0) {
1030 opserr << "WARNING invalid int tags\n";
1031 return -1;
1032 }
1033
1034 // get node
1035 Node* theNode = theDomain->getNode(tags[0]);
1036 if(theNode == 0) {
1037 opserr<<"ERROR node "<<tags[0]<<"does not exist\n";
1038 return -1;
1039 }
1040 int ndf = theNode->getNumberDOF();
1041 if(tags[1] > ndf || tags[1] < 0) {
1042 opserr<<"WARNING invalid dof\n";
1043 return -1;
1044 }
1045
1046 // get value
1047 double value;
1048 numData = 1;
1049 if(OPS_GetDoubleInput(&numData,&value) < 0) {
1050 opserr << "WARNING invalid double value\n";
1051 return -1;
1052 }
1053
1054 // get sp const
1055 bool isSpConst = false;
1056 bool retZeroInitValue = true;
1057
1058 bool userPattern = false;
1059 int loadPatternTag = 0;
1060 while(OPS_GetNumRemainingInputArgs() > 0) {
1061 const char* type = OPS_GetString();
1062 if(strcmp(type, "-const") == 0) {
1063 isSpConst = true;
1064
1065 } else if (strcmp(type,"-subtractInit") == 0) {
1066 // allow user to ignore init disp values at the node
1067 retZeroInitValue = true;
1068

Callers 3

Tcl_ops_SPFunction · 0.85
ops_addSPFunction · 0.85
Py_ops_SPFunction · 0.85

Calls 9

OPS_GetDomainFunction · 0.70
OPS_GetIntInputFunction · 0.70
OPS_GetDoubleInputFunction · 0.70
OPS_GetStringFunction · 0.70
getNodeMethod · 0.45
getNumberDOFMethod · 0.45
getTagMethod · 0.45
addSP_ConstraintMethod · 0.45

Tested by

no test coverage detected