method: setDomain() to set a link to the enclosing Domain and to set the node pointers. also determines the number of dof associated with the ZeroLength element, we set matrix and vector pointers, allocate space for t matrix and define it as the basic deformation- displacement transformation matrix.
| 575 | // allocate space for t matrix and define it as the basic deformation- |
| 576 | // displacement transformation matrix. |
| 577 | void |
| 578 | ZeroLength::setDomain(Domain *theDomain) |
| 579 | { |
| 580 | // check Domain is not null - invoked when object removed from a domain |
| 581 | if (theDomain == 0) { |
| 582 | theNodes[0] = 0; |
| 583 | theNodes[1] = 0; |
| 584 | return; |
| 585 | } |
| 586 | |
| 587 | // set default values for error conditions |
| 588 | numDOF = 2; |
| 589 | theMatrix = &ZeroLengthM2; |
| 590 | theVector = &ZeroLengthV2; |
| 591 | |
| 592 | // first set the node pointers |
| 593 | int Nd1 = connectedExternalNodes(0); |
| 594 | int Nd2 = connectedExternalNodes(1); |
| 595 | theNodes[0] = theDomain->getNode(Nd1); |
| 596 | theNodes[1] = theDomain->getNode(Nd2); |
| 597 | |
| 598 | // if can't find both - send a warning message |
| 599 | if ( theNodes[0] == 0 || theNodes[1] == 0 ) { |
| 600 | if (theNodes[0] == 0) |
| 601 | opserr << "WARNING ZeroLength::setDomain() - Nd1: " << Nd1 << " does not exist in "; |
| 602 | else |
| 603 | opserr << "WARNING ZeroLength::setDomain() - Nd2: " << Nd2 << " does not exist in "; |
| 604 | |
| 605 | opserr << "model for ZeroLength ele: " << this->getTag() << endln; |
| 606 | |
| 607 | return; |
| 608 | } |
| 609 | |
| 610 | // now determine the number of dof and the dimension |
| 611 | int dofNd1 = theNodes[0]->getNumberDOF(); |
| 612 | int dofNd2 = theNodes[1]->getNumberDOF(); |
| 613 | |
| 614 | // if differing dof at the ends - print a warning message |
| 615 | if ( dofNd1 != dofNd2 ) { |
| 616 | opserr << "WARNING ZeroLength::setDomain(): nodes " << Nd1 << " and " << Nd2 << |
| 617 | "have differing dof at ends for ZeroLength " << this->getTag() << endln; |
| 618 | return; |
| 619 | } |
| 620 | |
| 621 | // Check that length is zero within tolerance |
| 622 | const Vector &end1Crd = theNodes[0]->getCrds(); |
| 623 | const Vector &end2Crd = theNodes[1]->getCrds(); |
| 624 | Vector diff = end1Crd - end2Crd; |
| 625 | double L = diff.Norm(); |
| 626 | double v1 = end1Crd.Norm(); |
| 627 | double v2 = end2Crd.Norm(); |
| 628 | double vm; |
| 629 | |
| 630 | vm = (v1<v2) ? v2 : v1; |
| 631 | |
| 632 | |
| 633 | if (L > LENTOL*vm) |
| 634 | opserr << "WARNING ZeroLength::setDomain(): Element " << this->getTag() << " has L= " << L << |