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

UniformExcitation.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: 2000/12/12 07:47:46 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/domain/pattern/UniformExcitation.cpp,v $
00024                                                                         
00025                                                                         
00026 // File: ~/domain/load/UniformExcitation.h
00027 //
00028 // Written: fmk 11/98
00029 // Revised:
00030 //
00031 // Purpose: This file contains the class definition for UniformExcitation.
00032 // UniformExcitation is an abstract class.
00033 
00034 #include <UniformExcitation.h>
00035 #include <Domain.h>
00036 #include <NodeIter.h>
00037 #include <Node.h>
00038 #include <ElementIter.h>
00039 #include <Element.h>
00040 
00041 UniformExcitation::UniformExcitation(GroundMotion &_theMotion, 
00042        int dof, int tag, double velZero)
00043 :EarthquakePattern(tag, LOAD_TAG_UniformExcitation), 
00044   theMotion(&_theMotion), theDof(dof), vel0(velZero)
00045 {
00046   // add the motion to the list of ground motions
00047   this->addMotion(*theMotion);
00048 }
00049 
00050 
00051 UniformExcitation::~UniformExcitation()
00052 {
00053 
00054 }
00055 
00056 
00057 void
00058 UniformExcitation::setDomain(Domain *theDomain) 
00059 {
00060   this->LoadPattern::setDomain(theDomain);
00061 
00062   // now we go through and set all the node velocities to be vel0
00063   if (vel0 != 0.0) {
00064     NodeIter &theNodes = theDomain->getNodes();
00065     Node *theNode;
00066     Vector newVel(1);
00067     int currentSize = 1;
00068     while ((theNode = theNodes()) != 0) {
00069       int numDOF = theNode->getNumberDOF();
00070       if (numDOF != currentSize) 
00071  newVel.resize(numDOF);
00072       
00073       newVel = theNode->getVel();
00074       newVel(theDof) = vel0;
00075       theNode->setTrialVel(newVel);
00076       theNode->commitState();
00077     }
00078   }
00079 }
00080 
00081 void
00082 UniformExcitation::applyLoad(double time)
00083 {
00084   Domain *theDomain = this->getDomain();
00085   if (theDomain == 0)
00086     return;
00087 
00088 //  if (numNodes != theDomain->getNumNodes()) {
00089     NodeIter &theNodes = theDomain->getNodes();
00090     Node *theNode;
00091     while ((theNode = theNodes()) != 0) {
00092       theNode->setNumColR(1);
00093       theNode->setR(theDof, 0, 1.0);
00094     }
00095 //  }
00096 
00097   this->EarthquakePattern::applyLoad(time);
00098 
00099   return;
00100 }
00101 
00102 
00103 
00104 int 
00105 UniformExcitation::sendSelf(int commitTag, Channel &theChannel)
00106 {
00107   cerr << "UniformExcitation::sendSelf() - not yet implemented\n";
00108   return 0;
00109 }
00110 
00111 
00112 int 
00113 UniformExcitation::recvSelf(int commitTag, Channel &theChannel, 
00114       FEM_ObjectBroker &theBroker)
00115 {
00116   cerr << "UniformExcitation::recvSelf() - not yet implemented\n";
00117   return 0;
00118 }
00119 
00120 
00121 void 
00122 UniformExcitation::Print(ostream &s, int flag)
00123 {
00124   s << "UniformExcitation - Need to Print the GroundMotion\n";
00125 }
00126 
00127 LoadPattern *
00128 UniformExcitation::getCopy(void)
00129 {
00130   LoadPattern *theCopy = new UniformExcitation(*theMotion, theDof, this->getTag());
00131    return theCopy;
00132 }
Copyright Contact Us