HingeEndpointBeamIntegration.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.2 $
00022 // $Date: 2006/09/05 22:55:44 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/element/forceBeamColumn/HingeEndpointBeamIntegration.cpp,v $
00024 
00025 #include <HingeEndpointBeamIntegration.h>
00026 #include <ElementalLoad.h>
00027 
00028 #include <Matrix.h>
00029 #include <Vector.h>
00030 #include <Channel.h>
00031 #include <FEM_ObjectBroker.h>
00032 #include <Information.h>
00033 #include <Parameter.h>
00034 
00035 HingeEndpointBeamIntegration::HingeEndpointBeamIntegration(double lpi,
00036                                                            double lpj):
00037   BeamIntegration(BEAM_INTEGRATION_TAG_HingeEndpoint), lpI(lpi), lpJ(lpj)
00038 {
00039   // Nothing to do
00040 }
00041 
00042 HingeEndpointBeamIntegration::HingeEndpointBeamIntegration():
00043   BeamIntegration(BEAM_INTEGRATION_TAG_HingeEndpoint), lpI(0.0), lpJ(0.0)
00044 {
00045 
00046 }
00047 
00048 HingeEndpointBeamIntegration::~HingeEndpointBeamIntegration()
00049 {
00050   // Nothing to do
00051 }
00052 
00053 void
00054 HingeEndpointBeamIntegration::getSectionLocations(int numSections, double L,
00055                                                   double *xi)
00056 {
00057   double halfOneOverL = 0.5/L;
00058 
00059   xi[0] = 0.0;
00060   xi[3] = 1.0;
00061 
00062   double alpha = 0.5-(lpI+lpJ)*halfOneOverL;
00063   double beta  = 0.5+(lpI-lpJ)*halfOneOverL;
00064   xi[1] = alpha*(-1/sqrt(3.0)) + beta;
00065   xi[2] = alpha*(1/sqrt(3.0)) + beta;
00066 
00067   for (int i = 4; i < numSections; i++)
00068     xi[i] = 0.0;
00069 }
00070 
00071 void
00072 HingeEndpointBeamIntegration::getSectionWeights(int numSections, double L,
00073                                                 double *wt)
00074 {
00075   double oneOverL = 1.0/L;
00076 
00077   wt[0] = lpI*oneOverL;
00078   wt[3] = lpJ*oneOverL;
00079 
00080   wt[1] = 0.5-0.5*(lpI+lpJ)*oneOverL;
00081   wt[2] = 0.5-0.5*(lpI+lpJ)*oneOverL;
00082 
00083   for (int i = 4; i < numSections; i++)
00084     wt[i] = 1.0;
00085 }
00086 
00087 BeamIntegration*
00088 HingeEndpointBeamIntegration::getCopy(void)
00089 {
00090   return new HingeEndpointBeamIntegration(lpI, lpJ);
00091 }
00092 
00093 int
00094 HingeEndpointBeamIntegration::sendSelf(int cTag, Channel &theChannel)
00095 {
00096   static Vector data(2);
00097 
00098   data(0) = lpI;
00099   data(1) = lpJ;
00100 
00101   int dbTag = this->getDbTag();
00102 
00103   if (theChannel.sendVector(dbTag, cTag, data) < 0) {
00104     opserr << "HingeEndpointBeamIntegration::sendSelf() - failed to send Vector data\n";
00105     return -1;
00106   }    
00107 
00108   return 0;
00109 }
00110 
00111 int
00112 HingeEndpointBeamIntegration::recvSelf(int cTag, Channel &theChannel,
00113                                        FEM_ObjectBroker &theBroker)
00114 {
00115   static Vector data(2);
00116 
00117   int dbTag = this->getDbTag();
00118 
00119   if (theChannel.recvVector(dbTag, cTag, data) < 0)  {
00120     opserr << "HingeEndpointBeamIntegration::recvSelf() - failed to receive Vector data\n";
00121     return -1;
00122   }
00123   
00124   lpI = data(0);
00125   lpJ = data(1);
00126 
00127   return 0;
00128 }
00129 
00130 int
00131 HingeEndpointBeamIntegration::setParameter(const char **argv, int argc,
00132                                            Parameter &param)
00133 {
00134   if (argc < 1)
00135     return -1;
00136 
00137   if (strcmp(argv[0],"lpI") == 0)
00138     return param.addObject(1, this);
00139 
00140   if (strcmp(argv[0],"lpJ") == 0)
00141     return param.addObject(2, this);
00142 
00143   if (strcmp(argv[0],"lp") == 0)
00144     return param.addObject(3, this);
00145 
00146   return -1;
00147 }
00148 
00149 int
00150 HingeEndpointBeamIntegration::updateParameter(int parameterID,
00151                                               Information &info)
00152 {
00153   switch (parameterID) {
00154   case 1:
00155     lpI = info.theDouble;
00156     return 0;
00157   case 2:
00158     lpJ = info.theDouble;
00159     return 0;
00160   case 3:
00161     lpI = lpJ = info.theDouble;
00162     return 0;
00163   default:
00164     return -1;
00165   }
00166 }
00167 
00168 int
00169 HingeEndpointBeamIntegration::activateParameter(int paramID)
00170 {
00171   parameterID = paramID;
00172 
00173   return 0;
00174 }
00175 
00176 void
00177 HingeEndpointBeamIntegration::Print(OPS_Stream &s, int flag)
00178 {
00179   s << "HingeEndpoint" << endln;
00180   s << " lpI = " << lpI;
00181   s << " lpJ = " << lpJ << endln;
00182 
00183   return;
00184 }
00185 
00186 void 
00187 HingeEndpointBeamIntegration::getLocationsDeriv(int numSections, double L,
00188                                                 double dLdh, double *dptsdh)
00189 {
00190   double oneOverL = 1.0/L;
00191   double halfOneOverL = 0.5*oneOverL;
00192 
00193   for (int i = 0; i < numSections; i++)
00194     dptsdh[i] = 0.0;
00195 
00196   if (parameterID == 1) { // lpI
00197     dptsdh[0] = 0.0;
00198     dptsdh[1] = -0.5*(1.0-1/sqrt(3.0))*oneOverL + oneOverL;
00199     dptsdh[2] = -0.5*(1.0+1/sqrt(3.0))*oneOverL + oneOverL;
00200   }
00201   if (parameterID == 2) { // lpJ
00202     dptsdh[1] = -0.5*(1.0-1/sqrt(3.0))*oneOverL;
00203     dptsdh[2] = -0.5*(1.0+1/sqrt(3.0))*oneOverL;
00204     dptsdh[3] = 0.0;
00205   }
00206   if (parameterID == 3) { // lpI and lpJ
00207     dptsdh[0] = 0.0;
00208     dptsdh[1] = -(1.0-1/sqrt(3.0))*oneOverL + oneOverL;
00209     dptsdh[2] = -(1.0+1/sqrt(3.0))*oneOverL + oneOverL;
00210     dptsdh[3] = 0.0;
00211   }
00212 
00213   if (dLdh != 0.0) {
00214     // STILL TO DO
00215     opserr << "getPointsDeriv -- to do" << endln;
00216     dptsdh[0] = -0.5*(lpI*dLdh)/(L*L);
00217     dptsdh[1] = dLdh + 0.5*(lpJ*dLdh)/(L*L);
00218   }
00219 
00220   return;
00221 }
00222 
00223 void
00224 HingeEndpointBeamIntegration::getWeightsDeriv(int numSections, double L,
00225                                               double dLdh, double *dwtsdh)
00226 {
00227   double oneOverL = 1.0/L;
00228 
00229   for (int i = 0; i < numSections; i++)
00230     dwtsdh[i] = 0.0;
00231 
00232   if (parameterID == 1) { // lpI
00233     dwtsdh[0] = oneOverL;
00234     dwtsdh[1] = -0.5*oneOverL;
00235     dwtsdh[2] = -0.5*oneOverL;
00236   }
00237   if (parameterID == 2) { // lpJ
00238     dwtsdh[1] = -0.5*oneOverL;
00239     dwtsdh[2] = -0.5*oneOverL;
00240     dwtsdh[3] = oneOverL;
00241   }
00242   if (parameterID == 3) { // lpI and lpJ
00243     dwtsdh[0] = oneOverL;
00244     dwtsdh[1] = -oneOverL;
00245     dwtsdh[2] = -oneOverL;
00246     dwtsdh[3] = oneOverL;
00247   }
00248 
00249   if (dLdh != 0.0) {
00250     dwtsdh[0] = -lpI*dLdh/(L*L);
00251     dwtsdh[3] = -lpJ*dLdh/(L*L);
00252     // STILL TO DO
00253     opserr << "getWeightsDeriv -- to do" << endln;
00254   }
00255 
00256   return;
00257 }

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