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

Method addSP_Constraint

DEVELOPER/core/Domain.cpp:513–577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

511//
512
513bool
514Domain::addSP_Constraint(SP_Constraint *spConstraint)
515{
516 //#ifdef _G3DEBUG
517 // check the Node exists in the Domain
518 int nodeTag = spConstraint->getNodeTag();
519 int dof = spConstraint->getDOF_Number();
520
521 Node *nodePtr = this->getNode(nodeTag);
522 if (nodePtr == 0) {
523 opserr << "Domain::addSP_Constraint - cannot add as node node with tag" <<
524 nodeTag << "does not exist in model\n";
525 return false;
526 }
527
528 // check that the DOF specified exists at the Node
529 int numDOF = nodePtr->getNumberDOF();
530 if (numDOF < dof) {
531 opserr << "Domain::addSP_Constraint - cannot add as node with tag" <<
532 nodeTag << "does not have associated constrained DOF\n";
533 return false;
534 }
535 // #endif
536
537 // check if an existing SP_COnstraint exists for that dof at the node
538 bool found = false;
539 SP_ConstraintIter &theExistingSPs = this->getSPs();
540 SP_Constraint *theExistingSP = 0;
541 while ((found == false) && ((theExistingSP = theExistingSPs()) != 0)) {
542 int spNodeTag = theExistingSP->getNodeTag();
543 int spDof = theExistingSP->getDOF_Number();
544 if (nodeTag == spNodeTag && spDof == dof) {
545 found = true;
546 }
547 }
548
549 if (found == true) {
550 opserr << "Domain::addSP_Constraint - cannot add as node already constrained in that dof by existing SP_Constraint\n";
551 spConstraint->Print(opserr);
552 return false;
553 }
554
555 // check that no other object with similar tag exists in model
556 int tag = spConstraint->getTag();
557 TaggedObject *other = theSPs->getComponentPtr(tag);
558 if (other != 0) {
559 opserr << "Domain::addSP_Constraint - cannot add as constraint with tag " <<
560 tag << "already exists in model\n";
561 spConstraint->Print(opserr);
562
563 return false;
564 }
565
566 bool result = theSPs->addComponent(spConstraint);
567 if (result == false) {
568 opserr << "Domain::addSP_Constraint - cannot add constraint with tag" <<
569 tag << "to the container\n";
570 return false;

Callers 8

recvSelfMethod · 0.95
OPS_HomogeneousBCFunction · 0.45
OPS_HomogeneousBC_XFunction · 0.45
OPS_HomogeneousBC_YFunction · 0.45
OPS_HomogeneousBC_ZFunction · 0.45
mainFunction · 0.45
TclPlaneTruss_addSPFunction · 0.45
mainFunction · 0.45

Calls 13

getNodeMethod · 0.95
domainChangeMethod · 0.95
getNodesMethod · 0.80
getCrdsMethod · 0.80
getNodeTagMethod · 0.45
getDOF_NumberMethod · 0.45
getNumberDOFMethod · 0.45
PrintMethod · 0.45
getTagMethod · 0.45
getComponentPtrMethod · 0.45
addComponentMethod · 0.45
setDomainMethod · 0.45

Tested by

no test coverage detected