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 #include <Beam3dPointLoad.h>
00030 #include <Vector.h>
00031 #include <Channel.h>
00032 #include <FEM_ObjectBroker.h>
00033
00034 Vector Beam3dPointLoad::data(4);
00035
00036 Beam3dPointLoad::Beam3dPointLoad(int tag, double py, double pz, double dist,
00037 const ID &theElementTags, double px)
00038 :ElementalLoad(tag, LOAD_TAG_Beam3dPointLoad, theElementTags),
00039 Py(py), Pz(pz), Px(px), x(dist)
00040 {
00041
00042 }
00043
00044 Beam3dPointLoad::Beam3dPointLoad()
00045 :ElementalLoad(LOAD_TAG_Beam3dPointLoad),
00046 Py(0.0), Pz(0.0), Px(0.0), x(0.0)
00047 {
00048
00049 }
00050
00051 Beam3dPointLoad::~Beam3dPointLoad()
00052 {
00053
00054 }
00055
00056 const Vector &
00057 Beam3dPointLoad::getData(int &type, double loadFactor)
00058 {
00059 type = LOAD_TAG_Beam3dPointLoad;
00060 data(0) = Py;
00061 data(1) = Pz;
00062 data(2) = Px;
00063 data(3) = x;
00064 return data;
00065 }
00066
00067 int
00068 Beam3dPointLoad::sendSelf(int commitTag, Channel &theChannel)
00069 {
00070 int dbTag = this->getDbTag();
00071 const ID &theElements = this->getElementTags();
00072
00073 static Vector vectData(5);
00074 vectData(0) = Px;
00075 vectData(1) = Py;
00076 vectData(2) = Pz;
00077 vectData(3) = x;
00078 vectData(4) = theElements.Size();
00079
00080 int result = theChannel.sendVector(dbTag, commitTag, vectData);
00081 if (result < 0) {
00082 opserr << "Beam3dPointLoad::sendSelf - failed to send data\n";
00083 return result;
00084 }
00085
00086 result = theChannel.sendID(dbTag, commitTag, theElements);
00087 if (result < 0) {
00088 opserr << "Beam3dPointLoad::sendSelf - failed to send element tags\n";
00089 return result;
00090 }
00091
00092 return 0;
00093 }
00094
00095 int
00096 Beam3dPointLoad::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
00097 {
00098 int dbTag = this->getDbTag();
00099
00100 static Vector vectData(5);
00101
00102 int result = theChannel.recvVector(dbTag, commitTag, vectData);
00103 if (result < 0) {
00104 opserr << "Beam3dPointLoad::sendSelf - failed to send data\n";
00105 return result;
00106 }
00107
00108 Px = vectData(0);;
00109 Py = vectData(1);;
00110 Pz = vectData(2);;
00111 x = vectData(3);
00112 int numEle = vectData(4);
00113
00114
00115 if (theElementTags == 0 || theElementTags->Size() != numEle) {
00116 if (theElementTags != 0)
00117 delete theElementTags;
00118 theElementTags = new ID(numEle);
00119 if (theElementTags == 0) {
00120 opserr << "Beam3dPointLoad::sendSelf - failed to create an ID\n";
00121 return -3;
00122 }
00123 }
00124
00125 result = theChannel.recvID(dbTag, commitTag, *theElementTags);
00126 if (result < 0) {
00127 opserr << "Beam3dPointLoad::sendSelf - failed to send element tags\n";
00128 return result;
00129 }
00130
00131 return 0;
00132 }
00133
00134 void
00135 Beam3dPointLoad::Print(OPS_Stream &s, int flag)
00136 {
00137 s << "Beam3dPointLoad - Reference load" << endln;
00138 s << " Transverse (y): " << Py << endln;
00139 s << " Transverse (z): " << Pz << endln;
00140 s << " Axial (x): " << Px << endln;
00141 s << " Elements acted on: " << this->getElementTags();
00142 }