int StandardEigenAlgo::solveCurrentStep(int numModes) { AnalysisModel *theModel = this->getAnalysisModelPtr(); EigenSOE *theSOE = this->getEigenSOEptr(); EigenIntegrator *theIntegrator = this->getEigenIntegratorPtr(); if ((theModel == 0) || (theIntegrator == 0) || (theSOE == 0)) { opserr << "StandardEigenAlgo::solverCurrentStep() -- setLinks() has not been called\n"; return -1; } if (theIntegrator->formK() < 0) { opserr << "StandardEigenAlgo::solverCurrentStep() -- the Integrator failed in formK()\n"; return -2; } if (theSOE->solve(numModes, false) < 0) { opserr << "StandardEigenAlgo::solverCurrentStep() -- the EigenSOE failed in solve()\n"; return -4; } // now set the eigenvalues and eigenvectors in the model theModel->setNumEigenvectors(numModes); Vector theEigenvalues(numModes); for (int i = 1; i <= numModes; i++) { theEigenvalues[i-1] = theSOE->getEigenvalue(i); theModel->setEigenvector(i, theSOE->getEigenvector(i)); } theModel->setEigenvalues(theEigenvalues); return 0; }
int DirectIntegrationAnalysis::eigen(int numMode, bool generalized) { if (theAnalysisModel == 0 || theEigenSOE == 0) { opserr << "WARNING DirectIntegrationAnalysis::eigen() - no EigenSOE has been set\n"; return -1; } int result = 0; Domain *the_Domain = this->getDomainPtr(); result = theAnalysisModel->eigenAnalysis(numMode, generalized); int stamp = the_Domain->hasDomainChanged(); if (stamp != domainStamp) { domainStamp = stamp; result = this->domainChanged(); if (result < 0) { opserr << "DirectIntegrationAnalysis::eigen() - domainChanged failed"; return -1; } } // // zero A and M // theEigenSOE->zeroA(); theEigenSOE->zeroM(); // // form K // FE_EleIter &theEles = theAnalysisModel->getFEs(); FE_Element *elePtr; while((elePtr = theEles()) != 0) { elePtr->zeroTangent(); elePtr->addKtToTang(1.0); if (theEigenSOE->addA(elePtr->getTangent(0), elePtr->getID()) < 0) { opserr << "WARNING DirectIntegrationAnalysis::eigen() -"; opserr << " failed in addA for ID " << elePtr->getID(); result = -2; } } // // if generalized is true, form M // if (generalized == true) { int result = 0; FE_EleIter &theEles2 = theAnalysisModel->getFEs(); while((elePtr = theEles2()) != 0) { elePtr->zeroTangent(); elePtr->addMtoTang(1.0); if (theEigenSOE->addM(elePtr->getTangent(0), elePtr->getID()) < 0) { opserr << "WARNING DirectIntegrationAnalysis::eigen() -"; opserr << " failed in addA for ID " << elePtr->getID(); result = -2; } } DOF_Group *dofPtr; DOF_GrpIter &theDofs = theAnalysisModel->getDOFs(); while((dofPtr = theDofs()) != 0) { dofPtr->zeroTangent(); dofPtr->addMtoTang(1.0); if (theEigenSOE->addM(dofPtr->getTangent(0),dofPtr->getID()) < 0) { opserr << "WARNING DirectIntegrationAnalysis::eigen() -"; opserr << " failed in addM for ID " << dofPtr->getID(); result = -3; } } } // // solve for the eigen values & vectors // if (theEigenSOE->solve(numMode, generalized) < 0) { opserr << "WARNING DirectIntegrationAnalysis::eigen() - EigenSOE failed in solve()\n"; return -4; } // // now set the eigenvalues and eigenvectors in the model // theAnalysisModel->setNumEigenvectors(numMode); Vector theEigenvalues(numMode); for (int i = 1; i <= numMode; i++) { theEigenvalues[i-1] = theEigenSOE->getEigenvalue(i); theAnalysisModel->setEigenvector(i, theEigenSOE->getEigenvector(i)); } theAnalysisModel->setEigenvalues(theEigenvalues); return 0; }