EigenAnalysis.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.4 $
00022 // $Date: 2005/08/31 17:39:34 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/analysis/analysis/EigenAnalysis.cpp,v $
00024                                                                         
00025                                                                         
00026 // File: ~/analysis/analysis/eigenAnalysis/EigenAnalysis.C
00027 //
00028 // Written: Jun Peng
00029 // Created: Wed Jan 27, 1999
00030 // Revision: A
00031 //
00032 // Description: This file contains the class definition of EigenAnalysis.
00033 // EigenAnalysis is a subclass of Analysis, it is used to perform the 
00034 // eigen vlaue analysis on the FE_Model.
00035 //
00036 // This class is inheritanted from the base class of Analysis
00037 // which was created by fmk (Frank).
00038 
00039 
00040 #include <EigenAnalysis.h>
00041 #include <EigenAlgorithm.h>
00042 #include <AnalysisModel.h>
00043 #include <EigenSOE.h>
00044 #include <DOF_Numberer.h>
00045 #include <ConstraintHandler.h>
00046 #include <EigenIntegrator.h>
00047 #include <Domain.h>
00048 #include <Timer.h>
00049 #include <FE_Element.h>
00050 #include <DOF_Group.h>
00051 #include <FE_EleIter.h>
00052 #include <DOF_GrpIter.h>
00053 #include <Matrix.h>
00054 #include <ID.h>
00055 #include <Graph.h>
00056 
00057 
00058 EigenAnalysis::EigenAnalysis(Domain &the_Domain,
00059                              ConstraintHandler &theHandler,
00060                              DOF_Numberer &theNumberer,
00061                              AnalysisModel &theModel,
00062                              EigenAlgorithm &theAlgo,
00063                              EigenSOE &theEigenSOE,
00064                              EigenIntegrator &theEigenIntegrator)
00065   :Analysis(the_Domain), theConstraintHandler(&theHandler),
00066    theDOF_Numberer(&theNumberer), theAnalysisModel(&theModel),
00067    theAlgorithm(&theAlgo), theSOE(&theEigenSOE),
00068    theIntegrator(&theEigenIntegrator), domainStamp(0)
00069 {
00070   // first set up the links needed by the elements in the aggregation.
00071     theAnalysisModel->setLinks(the_Domain, *theConstraintHandler);
00072     theConstraintHandler->setLinks(the_Domain, theModel, theEigenIntegrator);
00073     theDOF_Numberer->setLinks(theModel);
00074     theIntegrator->setLinks(theModel, theEigenSOE);
00075     theAlgorithm->setLinks(theModel, theEigenIntegrator, theEigenSOE);
00076 }
00077 
00078 
00079 EigenAnalysis::~EigenAnalysis()
00080 {
00081   // do nothing now.
00082   this->clearAll();
00083 }
00084 
00085 void
00086 EigenAnalysis::clearAll(void)
00087 {
00088   // invoke the destructor on all the objects in the aggregation
00089   delete theAnalysisModel;
00090   delete theConstraintHandler;
00091   delete theDOF_Numberer;
00092   delete theIntegrator;
00093   delete theAlgorithm;
00094   delete theSOE;
00095 }    
00096 
00097 
00098 
00099 int 
00100 EigenAnalysis::analyze(int numModes)
00101 {
00102     int result = 0;
00103     Domain *the_Domain = this->getDomainPtr();
00104 
00105     // check for change in Domain since last step. As a change can
00106     // occur in a commit() in a domaindecomp with load balancing
00107     // this must now be inside the loop
00108     int stamp = the_Domain->hasDomainChanged();
00109     if (stamp != domainStamp) {
00110         domainStamp = stamp;
00111         result = this->domainChanged();
00112         if (result < 0) {
00113             opserr << "EigenAnalysis::analyze() - domainChanged failed\n";
00114             return -1;
00115         }       
00116     }
00117 
00118     result = theIntegrator->newStep();
00119     if (result < 0) {
00120         opserr << "EigenAnalysis::analyze() - integrator failed\n";
00121         return -2;
00122     }
00123 
00124     result = theAlgorithm->solveCurrentStep(numModes);
00125     if (result < 0) {
00126         opserr << "EigenAnalysis::analyze() - algorithm failed\n";
00127         return -3;
00128     }
00129     
00130     return 0;
00131 }
00132 
00133 int 
00134 EigenAnalysis::domainChanged()
00135 {
00136     theAnalysisModel->clearAll();    
00137     theConstraintHandler->clearAll();      
00138     theConstraintHandler->handle();
00139 
00140     theDOF_Numberer->numberDOF();
00141     theConstraintHandler->doneNumberingDOF();
00142 
00143     Graph &theGraph = theAnalysisModel->getDOFGraph();
00144     theSOE->setSize(theGraph);
00145 
00146     theIntegrator->domainChanged();
00147     theAlgorithm->domainChanged();
00148 
00149     return 0;
00150 }
00151 
00152 int 
00153 EigenAnalysis::setAlgorithm(EigenAlgorithm &theAlgo)
00154 {
00155     opserr << "EigenAnalysis::setAlgorithm() - does nothing yet\n";
00156     return 0;
00157 }
00158 
00159 int 
00160 EigenAnalysis::setIntegrator(EigenIntegrator &theIntegrator)
00161 {
00162     opserr << "EigenAnalysis::setIntegrator() - does nothing yet\n";    
00163     return 0;
00164 }
00165 
00166 int 
00167 EigenAnalysis::setEigenSOE(EigenSOE &theSOE)
00168 {
00169     opserr << "EigenAnalysis::setEigenSOE() - does nothing yet\n";    
00170     return 0;
00171 }
00172 
00173 ConstraintHandler *
00174 EigenAnalysis::getConstraintHandlerPtr() const
00175 {
00176     return theConstraintHandler;
00177 }
00178 
00179 DOF_Numberer *
00180 EigenAnalysis::getDOF_NumbererPtr() const
00181 {
00182     return theDOF_Numberer;
00183 }
00184 
00185 AnalysisModel *
00186 EigenAnalysis::getAnalysisModelPtr() const
00187 {
00188     return theAnalysisModel;
00189 }
00190 
00191 EigenAlgorithm *
00192 EigenAnalysis::getEigenAlgorithm() const
00193 {
00194     return theAlgorithm;
00195 }
00196 
00197 EigenSOE *
00198 EigenAnalysis::getEigenSOE() const
00199 {
00200     return theSOE;
00201 }
00202 
00203 EigenIntegrator *
00204 EigenAnalysis::getEigenIntegrator() const
00205 {
00206     return theIntegrator;
00207 }

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