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