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 <ImposedMotionSP1.h>
00035 #include <classTags.h>
00036 #include <Vector.h>
00037 #include <Channel.h>
00038 #include <FEM_ObjectBroker.h>
00039 #include <GroundMotion.h>
00040 #include <Node.h>
00041 #include <Domain.h>
00042
00043
00044 ImposedMotionSP1::ImposedMotionSP1()
00045 :SP_Constraint(CNSTRNT_TAG_ImposedMotionSP1),
00046 theGroundMotion(0), theNode(0), theGroundMotionResponse(3), destroyMotion(0)
00047 {
00048
00049 }
00050
00051
00052 ImposedMotionSP1::ImposedMotionSP1(int tag, int node, int ndof,
00053 GroundMotion &theMotion, bool killMotion)
00054 :SP_Constraint(tag, node, ndof, CNSTRNT_TAG_ImposedMotionSP1),
00055 theNode(0), theGroundMotionResponse(3), destroyMotion(0)
00056 {
00057 theGroundMotion = &theMotion;
00058
00059 if (killMotion == true)
00060 destroyMotion = 1;
00061 }
00062
00063
00064 ImposedMotionSP1::~ImposedMotionSP1()
00065 {
00066 if (destroyMotion == 1)
00067 delete theGroundMotion;
00068 }
00069
00070
00071
00072 double
00073 ImposedMotionSP1::getValue(void)
00074 {
00075
00076 return theGroundMotionResponse(0);
00077 }
00078
00079
00080 int
00081 ImposedMotionSP1::applyConstraint(double time)
00082 {
00083
00084 if (theNode == 0) {
00085 Domain *theDomain = this->getDomain();
00086
00087 theNode = theDomain->getNode(nodeTag);
00088 if (theNode == 0) {
00089
00090 return -1;
00091 }
00092 }
00093
00094
00095 theGroundMotionResponse = theGroundMotion->getDispVelAccel(time);
00096
00097 return 0;
00098 }
00099
00100
00101 bool
00102 ImposedMotionSP1::isHomogeneous(void) const
00103 {
00104 return false;
00105 }
00106
00107
00108 int
00109 ImposedMotionSP1::sendSelf(int cTag, Channel &theChannel)
00110 {
00111 return -1;
00112 }
00113
00114 int
00115 ImposedMotionSP1::recvSelf(int cTag, Channel &theChannel,
00116 FEM_ObjectBroker &theBroker)
00117 {
00118 return -1;
00119 }
00120
00121 void
00122 ImposedMotionSP1::Print(ostream &s, int flag)
00123 {
00124 s << "ImposedMotionSP1: " << this->getTag();
00125 s << "\t Node: " << this->getNodeTag();
00126 s << " DOF: " << this->getDOF_Number() << endl;
00127 }
00128
00129
00130
00131
00132
00133
00134
00135