00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
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
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
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
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 }