Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

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.1.1.1 $
00022 // $Date: 2000/09/15 08:23:16 $
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);
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      cerr << "EigenAnalysis::analyze() - domainChanged failed\n";
00114      return -1;
00115  } 
00116     }
00117 
00118     result = theIntegrator->newStep();
00119     if (result < 0) {
00120         cerr << "EigenAnalysis::analyze() - integrator failed\n";
00121  return -2;
00122     }
00123 
00124     result = theAlgorithm->solveCurrentStep(numModes);
00125     if (result < 0) {
00126         cerr << "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 
00142     Graph &theGraph = theAnalysisModel->getDOFGraph();
00143     theSOE->setSize(theGraph);
00144 
00145     theIntegrator->domainChanged();
00146     theAlgorithm->domainChanged();
00147 
00148     return 0;
00149 }
00150 
00151 int 
00152 EigenAnalysis::setAlgorithm(EigenAlgorithm &theAlgo)
00153 {
00154     cerr << "EigenAnalysis::setAlgorithm() - does nothing yet\n";
00155     return 0;
00156 }
00157 
00158 int 
00159 EigenAnalysis::setIntegrator(EigenIntegrator &theIntegrator)
00160 {
00161     cerr << "EigenAnalysis::setIntegrator() - does nothing yet\n";    
00162     return 0;
00163 }
00164 
00165 int 
00166 EigenAnalysis::setEigenSOE(EigenSOE &theSOE)
00167 {
00168     cerr << "EigenAnalysis::setEigenSOE() - does nothing yet\n";    
00169     return 0;
00170 }
00171 
00172 ConstraintHandler *
00173 EigenAnalysis::getConstraintHandlerPtr() const
00174 {
00175     return theConstraintHandler;
00176 }
00177 
00178 DOF_Numberer *
00179 EigenAnalysis::getDOF_NumbererPtr() const
00180 {
00181     return theDOF_Numberer;
00182 }
00183 
00184 AnalysisModel *
00185 EigenAnalysis::getAnalysisModelPtr() const
00186 {
00187     return theAnalysisModel;
00188 }
00189 
00190 EigenAlgorithm *
00191 EigenAnalysis::getEigenAlgorithm() const
00192 {
00193     return theAlgorithm;
00194 }
00195 
00196 EigenSOE *
00197 EigenAnalysis::getEigenSOE() const
00198 {
00199     return theSOE;
00200 }
00201 
00202 EigenIntegrator *
00203 EigenAnalysis::getEigenIntegrator() const
00204 {
00205     return theIntegrator;
00206 }
Copyright Contact Us