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

Function OPS_HomogeneousBC

DEVELOPER/core/SP_Constraint.cpp:45–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43static int nextTag = 0;
44
45int OPS_HomogeneousBC()
46{
47 Domain* theDomain = OPS_GetDomain();
48 if(theDomain == 0) {
49 opserr<<"WARNING: domain is not defined\n";
50 return -1;
51 }
52 if(OPS_GetNumRemainingInputArgs() < 1) {
53 opserr<<"insufficient number of args\n";
54 return -1;
55 }
56
57 // get tag and constr values
58 int num = OPS_GetNumRemainingInputArgs();
59 ID vals(num);
60 if(OPS_GetIntInput(&num, &vals(0)) < 0) {
61 opserr << "WARNING invalid int values\n";
62 return -1;
63 }
64
65 // get node
66 Node* theNode = theDomain->getNode(vals(0));
67 if(theNode == 0) {
68 opserr<<"ERROR node "<<vals(0)<<" is not defined\n";
69 return -1;
70 }
71 int ndf = theNode->getNumberDOF();
72
73 // create homogeneous constraints
74 if(vals.Size()-1 < ndf) {
75 opserr<<"WARNING: invalid # of constraint values\n";
76 return -1;
77 }
78 for(int i=0; i<ndf; i++) {
79 if(vals(i+1) == 0) continue;
80 SP_Constraint* theSP = new SP_Constraint(vals(0), i, 0.0, true);
81 if(theSP == 0) {
82 opserr<<"WARNING: failed to create SP\n";
83 return -1;
84 }
85 if(theDomain->addSP_Constraint(theSP) == false) {
86 opserr<<"WARNING: failed to add SP to domain\n";
87 delete theSP;
88 return -1;
89 }
90 }
91
92 return 0;
93}
94
95int OPS_HomogeneousBC_X()
96{

Callers

nothing calls this directly

Calls 7

OPS_GetDomainFunction · 0.70
OPS_GetIntInputFunction · 0.70
getNodeMethod · 0.45
getNumberDOFMethod · 0.45
SizeMethod · 0.45
addSP_ConstraintMethod · 0.45

Tested by

no test coverage detected