Beam3dPointLoad.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.3 $
00022 // $Date: 2003/02/14 23:00:57 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/domain/load/Beam3dPointLoad.cpp,v $
00024                                                                         
00025 // Written: fmk 
00026 
00027 // Purpose: This file contains the class implementation Beam3dPointLoad.
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 }

Generated on Mon Oct 23 15:05:01 2006 for OpenSees by doxygen 1.5.0