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

Function OPS_EqualDOF

DEVELOPER/core/MP_Constraint.cpp:48–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46static int nextTag = 0;
47
48int OPS_EqualDOF()
49{
50 Domain* theDomain = OPS_GetDomain();
51 if(theDomain == 0) {
52 opserr<<"WARNING: domain is not defined\n";
53 return -1;
54 }
55
56 if(OPS_GetNumRemainingInputArgs() < 3) {
57 opserr<<"WARNING: invalid # of args: equalDOF rNodeTag cNodeTag dof1 ...\n";
58 return -1;
59 }
60
61 // get all data
62 int num = OPS_GetNumRemainingInputArgs();
63 ID data(num);
64 if(OPS_GetIntInput(&num, &data(0)) < 0) {
65 opserr<<"WARNING invalid int inputs\n";
66 return -1;
67 }
68
69 // get ndf
70 int ndf = num-2;
71
72 // constraint matrix
73 Matrix Ccr(ndf,ndf);
74
75 // retained and constrained dofs
76 ID rcDOF(ndf);
77
78 // create mp constraint
79 for(int i=0; i<ndf; i++) {
80 rcDOF(i) = data(2+i)-1;
81 Ccr(i,i) = 1.0;
82 }
83 MP_Constraint* theMP = new MP_Constraint(data(0),data(1),Ccr,rcDOF,rcDOF);
84 if(theMP == 0) {
85 opserr<<"WARNING: failed to create MP_Constraint\n";
86 return -1;
87 }
88 if(theDomain->addMP_Constraint(theMP) == false) {
89 opserr<<"WARNING: failed to add MP_Constraint to domain\n";
90 delete theMP;
91 return -1;
92 }
93 return 0;
94}
95
96int OPS_EqualDOF_Mixed()
97{

Callers

nothing calls this directly

Calls 4

OPS_GetDomainFunction · 0.70
OPS_GetIntInputFunction · 0.70
addMP_ConstraintMethod · 0.45

Tested by

no test coverage detected