FrequencyAlgo.cpp

Go to the documentation of this file.
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.2 $
00022 // $Date: 2003/02/14 23:00:41 $
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 <Vector.h>
00047 #include <Channel.h>
00048 #include <FEM_ObjectBroker.h>
00049 #include <Timer.h>
00050 
00051 FrequencyAlgo::FrequencyAlgo()
00052   :EigenAlgorithm(EigenALGORITHM_TAGS_Frequency)
00053 {
00054     // do nothing here.
00055 }
00056 
00057 FrequencyAlgo::~FrequencyAlgo()
00058 {
00059     // do nothing here.
00060 }
00061 
00062 int 
00063 FrequencyAlgo::solveCurrentStep(int numModes)
00064 {
00065     AnalysisModel *theModel = this->getAnalysisModelPtr();
00066     EigenSOE *theSOE = this->getEigenSOEptr();
00067     EigenIntegrator *theIntegrator = this->getEigenIntegratorPtr();
00068 
00069     if ((theModel == 0) || (theIntegrator == 0) || (theSOE == 0)) {
00070        opserr << "WARNING FrequencyAlgo::solverCurrentStep() - ";
00071        opserr << "setLinks() has not been called. \n";
00072        return -1;
00073     }
00074 
00075     if (theIntegrator->formK() < 0) {
00076        opserr << "WARNING FrequencyAlgo::solverCurrentStep() - ";
00077        opserr << "the Integrator failed in formK().\n";
00078        return -2;
00079     }
00080 
00081     if (theIntegrator->formM() < 0) {
00082        opserr << "WARNING FrequencyAlgo::solverCurrentStep() - ";
00083        opserr << "the Integrator failed in formK().\n";
00084        return -3;
00085     }
00086 
00087     if (theSOE->solve(numModes) < 0) {
00088        opserr << "Warning FrequencyAlgo::solveCurrentStep() - ";
00089        opserr << "the EigenSOE failed in solve().\n";
00090        return -4;
00091     }
00092 
00093     // now set the eigenvalues and eigenvectors in the model
00094     theModel->setNumEigenvectors(numModes);
00095     Vector theEigenvalues(numModes);
00096     for (int i=1; i<=numModes; i++) {
00097         theEigenvalues[i-1] = theSOE->getEigenvalue(i);
00098         theModel->setEigenvector(i, theSOE->getEigenvector(i));
00099     }    
00100     theModel->setEigenvalues(theEigenvalues);
00101     
00102     return 0;
00103 }
00104 
00105 int 
00106 FrequencyAlgo::sendSelf(int cTag, Channel &theChannel)
00107 {
00108     return 0;
00109 }
00110 
00111 int 
00112 FrequencyAlgo::recvSelf(int cTag, Channel &theChannel,
00113                         FEM_ObjectBroker &theBroker)
00114 {
00115     return 0;
00116 }
00117 
00118 void 
00119 FrequencyAlgo::Print(OPS_Stream &s, int flag)
00120 {
00121     s << "\t Eigen Algorithm \n";
00122 }
00123 
00124 

Generated on Mon Oct 23 15:04:57 2006 for OpenSees by doxygen 1.5.0