int HHTHSFixedNumIter::domainChanged() { AnalysisModel *myModel = this->getAnalysisModel(); LinearSOE *theLinSOE = this->getLinearSOE(); const Vector &x = theLinSOE->getX(); int size = x.Size(); // if damping factors exist set them in the ele & node of the domain if (alphaM != 0.0 || betaK != 0.0 || betaKi != 0.0 || betaKc != 0.0) myModel->setRayleighDampingFactors(alphaM, betaK, betaKi, betaKc); // create the new Vector objects if (Ut == 0 || Ut->Size() != size) { // delete the old if (Ut != 0) delete Ut; if (Utdot != 0) delete Utdot; if (Utdotdot != 0) delete Utdotdot; if (U != 0) delete U; if (Udot != 0) delete Udot; if (Udotdot != 0) delete Udotdot; if (Ualpha != 0) delete Ualpha; if (Ualphadot != 0) delete Ualphadot; if (Ualphadotdot != 0) delete Ualphadotdot; if (Utm1 != 0) delete Utm1; if (Utm2 != 0) delete Utm2; if (scaledDeltaU != 0) delete scaledDeltaU; // create the new Ut = new Vector(size); Utdot = new Vector(size); Utdotdot = new Vector(size); U = new Vector(size); Udot = new Vector(size); Udotdot = new Vector(size); Ualpha = new Vector(size); Ualphadot = new Vector(size); Ualphadotdot = new Vector(size); Utm1 = new Vector(size); Utm2 = new Vector(size); scaledDeltaU = new Vector(size); // check we obtained the new if (Ut == 0 || Ut->Size() != size || Utdot == 0 || Utdot->Size() != size || Utdotdot == 0 || Utdotdot->Size() != size || U == 0 || U->Size() != size || Udot == 0 || Udot->Size() != size || Udotdot == 0 || Udotdot->Size() != size || Ualpha == 0 || Ualpha->Size() != size || Ualphadot == 0 || Ualphadot->Size() != size || Ualphadotdot == 0 || Ualphadotdot->Size() != size || Utm1 == 0 || Utm1->Size() != size || Utm2 == 0 || Utm2->Size() != size || scaledDeltaU == 0 || scaledDeltaU->Size() != size) { opserr << "HHTHSFixedNumIter::domainChanged - ran out of memory\n"; // delete the old if (Ut != 0) delete Ut; if (Utdot != 0) delete Utdot; if (Utdotdot != 0) delete Utdotdot; if (U != 0) delete U; if (Udot != 0) delete Udot; if (Udotdot != 0) delete Udotdot; if (Ualpha != 0) delete Ualpha; if (Ualphadot != 0) delete Ualphadot; if (Ualphadotdot != 0) delete Ualphadotdot; if (Utm1 != 0) delete Utm1; if (Utm2 != 0) delete Utm2; if (scaledDeltaU != 0) delete scaledDeltaU; Ut = 0; Utdot = 0; Utdotdot = 0; U = 0; Udot = 0; Udotdot = 0; Ualpha = 0; Ualphadot = 0; Ualphadotdot = 0; Utm1 = 0; Utm2 = 0; scaledDeltaU = 0; return -1; } } // now go through and populate U, Udot and Udotdot by iterating through // the DOF_Groups and getting the last committed velocity and accel DOF_GrpIter &theDOFs = myModel->getDOFs(); DOF_Group *dofPtr; while ((dofPtr = theDOFs()) != 0) { const ID &id = dofPtr->getID(); int idSize = id.Size(); int i; const Vector &disp = dofPtr->getCommittedDisp(); for (i=0; i < idSize; i++) { int loc = id(i); if (loc >= 0) { (*Utm1)(loc) = disp(i); (*Ut)(loc) = disp(i); (*U)(loc) = disp(i); } } const Vector &vel = dofPtr->getCommittedVel(); for (i=0; i < idSize; i++) { int loc = id(i); if (loc >= 0) { (*Udot)(loc) = vel(i); } } const Vector &accel = dofPtr->getCommittedAccel(); for (i=0; i < idSize; i++) { int loc = id(i); if (loc >= 0) { (*Udotdot)(loc) = accel(i); } } } if (polyOrder == 2) opserr << "\nWARNING: HHTHSFixedNumIter::domainChanged() - assuming Ut-1 = Ut\n"; else if (polyOrder == 3) opserr << "\nWARNING: HHTHSFixedNumIter::domainChanged() - assuming Ut-2 = Ut-1 = Ut\n"; return 0; }
int HHT1::domainChanged() { AnalysisModel *myModel = this->getAnalysisModel(); LinearSOE *theLinSOE = this->getLinearSOE(); const Vector &x = theLinSOE->getX(); int size = x.Size(); // if damping factors exist set them in the ele & node of the domain if (alphaM != 0.0 || betaK != 0.0 || betaKi != 0.0 || betaKc != 0.0) myModel->setRayleighDampingFactors(alphaM, betaK, betaKi, betaKc); // create the new Vector objects if (Ut == 0 || Ut->Size() != size) { // delete the old if (Ut != 0) delete Ut; if (Utdot != 0) delete Utdot; if (Utdotdot != 0) delete Utdotdot; if (U != 0) delete U; if (Udot != 0) delete Udot; if (Udotdot != 0) delete Udotdot; if (Ualpha != 0) delete Ualpha; if (Udotalpha != 0) delete Udotalpha; // create the new Ut = new Vector(size); Utdot = new Vector(size); Utdotdot = new Vector(size); U = new Vector(size); Udot = new Vector(size); Udotdot = new Vector(size); Ualpha = new Vector(size); Udotalpha = new Vector(size); // check we obtained the new if (Ut == 0 || Ut->Size() != size || Utdot == 0 || Utdot->Size() != size || Utdotdot == 0 || Utdotdot->Size() != size || U == 0 || U->Size() != size || Udot == 0 || Udot->Size() != size || Udotdot == 0 || Udotdot->Size() != size || Ualpha == 0 || Ualpha->Size() != size || Udotalpha == 0 || Udotalpha->Size() != size) { opserr << "HHT1::domainChanged - ran out of memory\n"; // delete the old if (Ut != 0) delete Ut; if (Utdot != 0) delete Utdot; if (Utdotdot != 0) delete Utdotdot; if (U != 0) delete U; if (Udot != 0) delete Udot; if (Udotdot != 0) delete Udotdot; if (Ualpha != 0) delete Ualpha; if (Udotalpha != 0) delete Udotalpha; Ut = 0; Utdot = 0; Utdotdot = 0; U = 0; Udot = 0; Udotdot = 0; Udotalpha=0; Ualpha =0; return -1; } } // now go through and populate U, Udot and Udotdot by iterating through // the DOF_Groups and getting the last committed velocity and accel DOF_GrpIter &theDOFs = myModel->getDOFs(); DOF_Group *dofPtr; while ((dofPtr = theDOFs()) != 0) { const ID &id = dofPtr->getID(); int idSize = id.Size(); int i; const Vector &disp = dofPtr->getCommittedDisp(); for (i=0; i < idSize; i++) { int loc = id(i); if (loc >= 0) { (*U)(loc) = disp(i); } } const Vector &vel = dofPtr->getCommittedVel(); for (i=0; i < idSize; i++) { int loc = id(i); if (loc >= 0) { (*Udot)(loc) = vel(i); } } const Vector &accel = dofPtr->getCommittedAccel(); for (i=0; i < idSize; i++) { int loc = id(i); if (loc >= 0) { (*Udotdot)(loc) = accel(i); } } /** NOTE WE CAN't DO TOGETHER BECAUSE DOF_GROUPS USING SINGLE VECTOR ****** for (int i=0; i < id.Size(); i++) { int loc = id(i); if (loc >= 0) { (*U)(loc) = disp(i); (*Udot)(loc) = vel(i); (*Udotdot)(loc) = accel(i); } } *******************************************************************************/ } return 0; }
int CentralDifference::domainChanged() { AnalysisModel *myModel = this->getAnalysisModel(); LinearSOE *theLinSOE = this->getLinearSOE(); const Vector &x = theLinSOE->getX(); int size = x.Size(); // if damping factors exist set them in the element & node of the domain if (alphaM != 0.0 || betaK != 0.0 || betaKi != 0.0 || betaKc != 0.0) myModel->setRayleighDampingFactors(alphaM, betaK, betaKi, betaKc); // create the new Vector objects if (Ut == 0 || Ut->Size() != size) { if (Utm1 != 0) delete Utm1; if (Ut != 0) delete Ut; if (Utdot != 0) delete Utdot; if (Utdotdot != 0) delete Utdotdot; if (Udot != 0) delete Udot; if (Udotdot != 0) delete Udotdot; // create the new Utm1 = new Vector(size); Ut = new Vector(size); Utdot = new Vector(size); Utdotdot = new Vector(size); Udot = new Vector(size); Udotdot = new Vector(size); // check we obtained the new if (Utm1 == 0 || Utm1->Size() != size || Ut == 0 || Ut->Size() != size || Utdot == 0 || Utdot->Size() != size || Utdotdot == 0 || Utdotdot->Size() != size || Udot == 0 || Udot->Size() != size || Udotdot == 0 || Udotdot->Size() != size) { opserr << "CentralDifference::domainChanged - ran out of memory\n"; // delete the old if (Utm1 != 0) delete Utm1; if (Ut != 0) delete Ut; if (Utdot != 0) delete Utdot; if (Utdotdot != 0) delete Utdotdot; if (Udot != 0) delete Udot; if (Udotdot != 0) delete Udotdot; Utm1 = 0; Ut = 0; Utdot = 0; Utdotdot = 0; Udot = 0; Udotdot = 0; return -1; } } // now go through and populate U, Udot and Udotdot by iterating through // the DOF_Groups and getting the last committed velocity and accel DOF_GrpIter &theDOFs = myModel->getDOFs(); DOF_Group *dofPtr; while ((dofPtr = theDOFs()) != 0) { const ID &id = dofPtr->getID(); int idSize = id.Size(); int i; const Vector &disp = dofPtr->getCommittedDisp(); for (i=0; i < idSize; i++) { int loc = id(i); if (loc >= 0) { (*Utm1)(loc) = disp(i); (*Ut)(loc) = disp(i); } } const Vector &vel = dofPtr->getCommittedVel(); for (i=0; i < idSize; i++) { int loc = id(i); if (loc >= 0) { (*Udot)(loc) = vel(i); } } const Vector &accel = dofPtr->getCommittedAccel(); for (i=0; i < idSize; i++) { int loc = id(i); if (loc >= 0) { (*Udotdot)(loc) = accel(i); } } } opserr << "WARNING: CentralDifference::domainChanged() - assuming Ut-1 = Ut\n"; return 0; }