EigenIntegrator.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.3 $
00022 // $Date: 2005/12/19 22:43:36 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/analysis/integrator/EigenIntegrator.cpp,v $
00024                                                                         
00025 // Written: Jun Peng
00026 // Created: Wed Jan 27, 1999
00027 // Revision: A
00028 //
00029 // Description: This file contains the class definition of EigenIntegrator.
00030 // EigenIntegrator is an algorithmic class for setting up the finite element 
00031 // equations for a eigen problem analysis.
00032 //
00033 // This class is inheritanted from the base class of Integrator which was
00034 // created by fmk (Frank).
00035 
00036 
00037 #include "EigenIntegrator.h"
00038 #include <FE_Element.h>
00039 #include <AnalysisModel.h>
00040 #include <EigenSOE.h>
00041 #include <Vector.h>
00042 #include <DOF_Group.h>
00043 #include <FE_EleIter.h>
00044 #include <DOF_GrpIter.h>
00045 
00046 EigenIntegrator::EigenIntegrator()
00047   :Integrator(EigenINTEGRATOR_TAGS_Eigen),
00048    theSOE(0), theAnalysisModel(0)
00049 {
00050 
00051 }
00052 
00053 EigenIntegrator::~EigenIntegrator()
00054 {
00055 
00056 }
00057 
00058 void
00059 EigenIntegrator::setLinks(AnalysisModel &theModel, EigenSOE &theSysOE)
00060 {
00061     theAnalysisModel = &theModel;
00062     theSOE = &theSysOE;
00063 }
00064 
00065 int 
00066 EigenIntegrator::formEleTangent(FE_Element *theEle)
00067 {
00068   if (flagK == 0)
00069       return this->formEleTangK(theEle);
00070   else
00071       return this->formEleTangM(theEle);
00072 }
00073 
00074 int 
00075 EigenIntegrator::formNodTangent(DOF_Group *theDof)
00076 {
00077   return this->formNodTangM(theDof);
00078 }
00079 
00080 int 
00081 EigenIntegrator::formEleResidual(FE_Element *theEle)
00082 {
00083     return 0;
00084 }
00085 
00086 int 
00087 EigenIntegrator::formNodUnbalance(DOF_Group *theDof)
00088 {
00089     return 0;
00090 }
00091 
00092 int 
00093 EigenIntegrator::newStep()
00094 {
00095     return 0;
00096 }
00097 
00098 int 
00099 EigenIntegrator::getLastResponse(Vector &result, const ID &id)
00100 {
00101     return 0;
00102 }
00103 
00104 int
00105 EigenIntegrator::formK()
00106 {
00107     if (theAnalysisModel == 0 || theSOE == 0) {
00108         opserr << "WARNING EigenIntegrator::formK -";
00109         opserr << " no AnalysisModel or EigenSOE has been set\n";
00110         return -1;
00111     }
00112     
00113     // the loops to form and add the tangents are broken into two for 
00114     // efficiency when performing parallel computations
00115 
00116     // loop through the FE_Elements getting them to form the tangent
00117     // FE_EleIter &theEles1 = theAnalysisModel->getFEs();
00118     FE_Element *elePtr;
00119 
00120     flagK = 0;
00121 
00122     theSOE->zeroA();
00123 
00124     //while((elePtr = theEles1()) != 0) 
00125     //  elePtr->formTangent(this);
00126    
00127    // loop through the FE_Elements getting them to add the tangent    
00128     int result = 0;
00129     FE_EleIter &theEles2 = theAnalysisModel->getFEs();    
00130     while((elePtr = theEles2()) != 0) {
00131       
00132         if (theSOE->addA(elePtr->getTangent(this), elePtr->getID()) < 0) {
00133             opserr << "WARNING EigenIntegrator::formK -";
00134             opserr << " failed in addA for ID " << elePtr->getID();         
00135             result = -2;
00136         }
00137     }
00138 
00139     return result;    
00140 }
00141 
00142 
00143 int
00144 EigenIntegrator::formM()
00145 {
00146     if (theAnalysisModel == 0 || theSOE == 0) {
00147         opserr << "WARNING EigenIntegrator::formK -";
00148         opserr << " no AnalysisModel or EigenSOE has been set\n";
00149         return -1;
00150     }
00151     
00152     // the loops to form and add the tangents are broken into two for 
00153     // efficiency when performing parallel computations
00154 
00155     // loop through the FE_Elements getting them to form the tangent
00156     // FE_EleIter &theEles1 = theAnalysisModel->getFEs();
00157     FE_Element *elePtr;
00158 
00159     flagK = 1;
00160     theSOE->zeroM();
00161 
00162     // while((elePtr = theEles1()) != 0) 
00163     //     elePtr->formTangent(this);
00164    
00165    // loop through the FE_Elements getting them to add the tangent    
00166     int result = 0;
00167     FE_EleIter &theEles2 = theAnalysisModel->getFEs();    
00168     while((elePtr = theEles2()) != 0) {     
00169         if (theSOE->addM(elePtr->getTangent(this), elePtr->getID()) < 0) {
00170             opserr << "WARNING EigenIntegrator::formK -";
00171             opserr << " failed in addA for ID " << elePtr->getID();         
00172             result = -2;
00173         }
00174     }
00175 
00176     DOF_Group *dofPtr;
00177     DOF_GrpIter &theDofs = theAnalysisModel->getDOFs();    
00178     while((dofPtr = theDofs()) != 0) {
00179         //      dofPtr->formTangent(this);
00180         if (theSOE->addM(dofPtr->getTangent(this),dofPtr->getID()) < 0) {
00181             opserr << "WARNING EigenIntegrator::formM -";
00182             opserr << " failed in addM for ID " << dofPtr->getID();         
00183             result = -3;
00184         }
00185     }
00186 
00187     return result;    
00188 }
00189 
00190 int 
00191 EigenIntegrator::formEleTangK(FE_Element *theEle)
00192 {
00193   theEle->zeroTangent();
00194   theEle->addKtToTang(1.0);
00195   return 0;
00196 }
00197 
00198 int 
00199 EigenIntegrator::formEleTangM(FE_Element *theEle)
00200 {
00201   theEle->zeroTangent();
00202   theEle->addMtoTang(1.0);
00203   return 0;
00204 }
00205 
00206 int 
00207 EigenIntegrator::formNodTangM(DOF_Group *theDof)
00208 {
00209   theDof->zeroTangent();
00210   theDof->addMtoTang(1.0);
00211   return 0;
00212 }
00213 
00214 int 
00215 EigenIntegrator::update(const Vector &deltaU)
00216 {
00217     return 0;
00218 }
00219 
00220 EigenSOE *
00221 EigenIntegrator::getEigenSOEPtr() const
00222 {
00223     return theSOE;
00224 }
00225 
00226 AnalysisModel *
00227 EigenIntegrator::getAnalysisModelPtr() const
00228 {
00229     return theAnalysisModel;
00230 }
00231 
00232 int 
00233 EigenIntegrator::sendSelf(int commitTag, Channel &theChannel)
00234 {
00235     return 0;
00236 }
00237 
00238 int 
00239 EigenIntegrator::recvSelf(int commitTag, Channel &theChannel,
00240                           FEM_ObjectBroker &theBroker)
00241 {
00242     return 0;
00243 }
00244 
00245 void 
00246 EigenIntegrator::Print(OPS_Stream &s, int flag)
00247 {
00248     s << "\t EigenIntegrator: \n";
00249 }
00250 
00251 

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