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

Method setDomain

SRC/element/twoNodeLink/TwoNodeLinkSection.cpp:380–491  ·  view source on GitHub ↗

to set a link to the enclosing Domain and to set the node pointers.

Source from the content-addressed store, hash-verified

378
379// to set a link to the enclosing Domain and to set the node pointers.
380void TwoNodeLinkSection::setDomain(Domain *theDomain)
381{
382 // check Domain is not null - invoked when object removed from a domain
383 if (theDomain == 0) {
384 theNodes[0] = 0;
385 theNodes[1] = 0;
386
387 return;
388 }
389
390 // set default values for error conditions
391 numDOF = 2;
392 theMatrix = &TwoNodeLinkSectionM2;
393 theVector = &TwoNodeLinkSectionV2;
394
395 // first set the node pointers
396 int Nd1 = connectedExternalNodes(0);
397 int Nd2 = connectedExternalNodes(1);
398 theNodes[0] = theDomain->getNode(Nd1);
399 theNodes[1] = theDomain->getNode(Nd2);
400
401 // if can't find both - send a warning message
402 if (!theNodes[0] || !theNodes[1]) {
403 if (!theNodes[0]) {
404 opserr << "TwoNodeLinkSection::setDomain() - Nd1: "
405 << Nd1 << " does not exist in the model for ";
406 } else {
407 opserr << "TwoNodeLinkSection::setDomain() - Nd2: "
408 << Nd2 << " does not exist in the model for ";
409 }
410 opserr << "TwoNodeLinkSection ele: " << this->getTag() << endln;
411
412 return;
413 }
414
415 // now determine the number of dof and the dimension
416 int dofNd1 = theNodes[0]->getNumberDOF();
417 int dofNd2 = theNodes[1]->getNumberDOF();
418
419 // if differing dof at the ends - print a warning message
420 if (dofNd1 != dofNd2) {
421 opserr << "TwoNodeLinkSection::setDomain(): nodes " << Nd1 << " and " << Nd2
422 << "have differing dof at ends for element: " << this->getTag() << endln;
423 return;
424 }
425
426 // call the base class method
427 this->DomainComponent::setDomain(theDomain);
428
429 // now set the number of dof for element and set matrix and vector pointer
430 if (numDIM == 1 && dofNd1 == 1) {
431 numDOF = 2;
432 theMatrix = &TwoNodeLinkSectionM2;
433 theVector = &TwoNodeLinkSectionV2;
434 elemType = D1N2;
435 }
436 else if (numDIM == 2 && dofNd1 == 2) {
437 numDOF = 4;

Callers

nothing calls this directly

Calls 9

setUpMethod · 0.95
setTranGlobalLocalMethod · 0.95
setTranLocalBasicMethod · 0.95
getNodeMethod · 0.45
getTagMethod · 0.45
getNumberDOFMethod · 0.45
resizeMethod · 0.45
ZeroMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected