00001 /* ****************************************************************** ** 00002 ** OpenSees - Open System for Earthquake Engineering Simulation ** 00003 ** Pacific Earthquake Engineering Research Center ** 00004 ** ** 00005 ** ** 00006 ** (C) Copyright 1999, The Regents of the University of California ** 00007 ** All Rights Reserved. ** 00008 ** ** 00009 ** Commercial use of this program without express permission of the ** 00010 ** University of California, Berkeley, is strictly prohibited. See ** 00011 ** file 'COPYRIGHT' in main directory for information on usage and ** 00012 ** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. ** 00013 ** ** 00014 ** Developed by: ** 00015 ** Frank McKenna (fmckenna@ce.berkeley.edu) ** 00016 ** Gregory L. Fenves (fenves@ce.berkeley.edu) ** 00017 ** Filip C. Filippou (filippou@ce.berkeley.edu) ** 00018 ** ** 00019 ** ****************************************************************** */ 00020 00021 // $Revision: 1.1.1.1 $ 00022 // $Date: 2000/09/15 08:23:16 $ 00023 // $Source: /usr/local/cvs/OpenSees/SRC/analysis/algorithm/eigenAlgo/FrequencyAlgo.cpp,v $ 00024 00025 00026 // File: ~/analysis/algorithm/eigenAlgo/FrequencyAlgo.C 00027 // 00028 // Written: Jun Peng 00029 // Created: Mon Feb. 8, 1999 00030 // Revision: A 00031 // 00032 // Description: This file contains the class definition of FrequencyAlgo. 00033 // FrequencyAlgo is a class which performs a eigen solution algorithm 00034 // to solve the Generalized eigen equations. It is not expected that 00035 // this class will have subclasses. 00036 // 00037 // This class is inheritanted from the base class of SolutionAlgorithm 00038 // which was created by fmk (Frank). 00039 00040 00041 #include <FrequencyAlgo.h> 00042 #include <AnalysisModel.h> 00043 #include <EigenAnalysis.h> 00044 #include <EigenIntegrator.h> 00045 #include <EigenSOE.h> 00046 #include <iostream.h> 00047 #include <Vector.h> 00048 #include <Channel.h> 00049 #include <FEM_ObjectBroker.h> 00050 #include <Timer.h> 00051 00052 FrequencyAlgo::FrequencyAlgo() 00053 :EigenAlgorithm(EigenALGORITHM_TAGS_Frequency) 00054 { 00055 // do nothing here. 00056 } 00057 00058 FrequencyAlgo::~FrequencyAlgo() 00059 { 00060 // do nothing here. 00061 } 00062 00063 int 00064 FrequencyAlgo::solveCurrentStep(int numModes) 00065 { 00066 AnalysisModel *theModel = this->getAnalysisModelPtr(); 00067 EigenSOE *theSOE = this->getEigenSOEptr(); 00068 EigenIntegrator *theIntegrator = this->getEigenIntegratorPtr(); 00069 00070 if ((theModel == 0) || (theIntegrator == 0) || (theSOE == 0)) { 00071 cerr << "WARNING FrequencyAlgo::solverCurrentStep() - "; 00072 cerr << "setLinks() has not been called. \n"; 00073 return -1; 00074 } 00075 00076 if (theIntegrator->formK() < 0) { 00077 cerr << "WARNING FrequencyAlgo::solverCurrentStep() - "; 00078 cerr << "the Integrator failed in formK().\n"; 00079 return -2; 00080 } 00081 00082 if (theIntegrator->formM() < 0) { 00083 cerr << "WARNING FrequencyAlgo::solverCurrentStep() - "; 00084 cerr << "the Integrator failed in formK().\n"; 00085 return -3; 00086 } 00087 00088 if (theSOE->solve(numModes) < 0) { 00089 cerr << "Warning FrequencyAlgo::solveCurrentStep() - "; 00090 cerr << "the EigenSOE failed in solve().\n"; 00091 return -4; 00092 } 00093 00094 // now set the eigenvalues and eigenvectors in the model 00095 theModel->setNumEigenvectors(numModes); 00096 Vector theEigenvalues(numModes); 00097 for (int i=1; i<=numModes; i++) { 00098 theEigenvalues[i-1] = theSOE->getEigenvalue(i); 00099 theModel->setEigenvector(i, theSOE->getEigenvector(i)); 00100 } 00101 theModel->setEigenvalues(theEigenvalues); 00102 00103 return 0; 00104 } 00105 00106 int 00107 FrequencyAlgo::sendSelf(int cTag, Channel &theChannel) 00108 { 00109 return 0; 00110 } 00111 00112 int 00113 FrequencyAlgo::recvSelf(int cTag, Channel &theChannel, 00114 FEM_ObjectBroker &theBroker) 00115 { 00116 return 0; 00117 } 00118 00119 void 00120 FrequencyAlgo::Print(ostream &s, int flag) 00121 { 00122 s << "\t Eigen Algorithm \n"; 00123 } 00124 00125