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

Method DOF_Group

DEVELOPER/core/DOF_Group.cpp:60–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58// construictor that take the corresponding model node.
59
60DOF_Group::DOF_Group(int tag, Node *node)
61:TaggedObject(tag),
62 unbalance(0), tangent(0), myNode(node),
63 myID(node->getNumberDOF()),
64 numDOF(node->getNumberDOF())
65{
66 // get number of DOF & verify valid
67 int numDOF = node->getNumberDOF();
68 if (numDOF <= 0) {
69 opserr << "DOF_Group::DOF_Group(Node *) ";
70 opserr << " node must have at least 1 dof " << *node;
71 exit(-1);
72 }
73
74 // check the ID created is of appropriate size
75 if (myID.Size() != numDOF) {
76 opserr << "DOF_Group::DOF_Group(Node *) ";
77 opserr << " ran out of memory creating ID for node " << *node;
78 exit(-1);
79 }
80
81 // initially set all the IDs to be -2
82 for (int i=0; i<numDOF; i++)
83 myID(i) = -2;
84
85 // if this is the first DOF_Group we now
86 // create the arrays used to store pointers to class wide
87 // matrix and vector objects used to return tangent and residual
88 if (numDOFs == 0) {
89 theMatrices = new Matrix *[MAX_NUM_DOF+1];
90 theVectors = new Vector *[MAX_NUM_DOF+1];
91
92 if (theMatrices == 0 || theVectors == 0) {
93 opserr << "DOF_Group::DOF_Group(Node *) ";
94 opserr << " ran out of memory";
95 }
96 for (int i=0; i<MAX_NUM_DOF; i++) {
97 theMatrices[i] = 0;
98 theVectors[i] = 0;
99 }
100 }
101
102 // set the pointers for the tangent and residual
103 if (numDOF <= MAX_NUM_DOF) {
104 // use class wide objects
105 if (theVectors[numDOF] == 0) {
106 // have to create matrix and vector of size as none yet created
107 theVectors[numDOF] = new Vector(numDOF);
108 theMatrices[numDOF] = new Matrix(numDOF,numDOF);
109 unbalance = theVectors[numDOF];
110 tangent = theMatrices[numDOF];
111 if (unbalance == 0 || unbalance->Size() != numDOF ||
112 tangent == 0 || tangent->noCols() != numDOF) {
113 opserr << "DOF_Group::DOF_Group(Node *) ";
114 opserr << " ran out of memory for vector/Matrix of size :";
115 opserr << numDOF << endln;
116 exit(-1);
117 }

Callers

nothing calls this directly

Calls 5

exitFunction · 0.85
getNumberDOFMethod · 0.45
SizeMethod · 0.45
noColsMethod · 0.45
noRowsMethod · 0.45

Tested by

no test coverage detected