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

Method storePreviousK

DEVELOPER/core/Element.cpp:705–744  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

703
704
705int
706Element::storePreviousK(int numK) {
707
708 //
709 // set up pointer to matrices and create matrices
710 // copy old
711 //
712
713 if (numPreviousK < numK) {
714 Matrix **theKMatrices = new Matrix *[numK];
715
716 if (theKMatrices == 0)
717 return -1;
718
719 int numEleDOF = this->getNumDOF();
720 for (int i=0; i<numPreviousK; i++)
721 theKMatrices[i] = previousK[i];
722
723 for (int i=numPreviousK; i<numK; i++) {
724 theKMatrices[i] = new Matrix(numEleDOF, numEleDOF);
725
726 if (theKMatrices[i] == 0)
727 return -1;
728 }
729
730 if (previousK != 0)
731 delete [] previousK;
732 previousK = theKMatrices;
733
734 numPreviousK = numK;
735 }
736
737 // now copy the matrices
738 for (int i=numPreviousK-1; i>0; i--)
739 *(previousK[i]) = *(previousK[i-1]);
740
741 *(previousK[0]) = this->getTangentStiff();
742
743 return 0;
744}
745
746const Matrix *
747Element::getPreviousK(int num) {

Callers

nothing calls this directly

Calls 2

getTangentStiffMethod · 0.80
getNumDOFMethod · 0.45

Tested by

no test coverage detected