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 #include <HingeMidpointBeamIntegration.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 HingeMidpointBeamIntegration::HingeMidpointBeamIntegration(double lpi,
00036 double lpj):
00037 BeamIntegration(BEAM_INTEGRATION_TAG_HingeMidpoint), lpI(lpi), lpJ(lpj)
00038 {
00039
00040 }
00041
00042 HingeMidpointBeamIntegration::HingeMidpointBeamIntegration():
00043 BeamIntegration(BEAM_INTEGRATION_TAG_HingeMidpoint), lpI(0.0), lpJ(0.0)
00044 {
00045
00046 }
00047
00048 HingeMidpointBeamIntegration::~HingeMidpointBeamIntegration()
00049 {
00050
00051 }
00052
00053 void
00054 HingeMidpointBeamIntegration::getSectionLocations(int numSections, double L,
00055 double *xi)
00056 {
00057 double halfOneOverL = 0.5/L;
00058
00059 xi[0] = lpI*halfOneOverL;
00060 xi[3] = 1.0-lpJ*halfOneOverL;
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 HingeMidpointBeamIntegration::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 HingeMidpointBeamIntegration::getCopy(void)
00089 {
00090 return new HingeMidpointBeamIntegration(lpI, lpJ);
00091 }
00092
00093 int
00094 HingeMidpointBeamIntegration::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 << "HingeMidpointBeamIntegration::sendSelf() - failed to send Vector data\n";
00105 return -1;
00106 }
00107
00108 return 0;
00109 }
00110
00111 int
00112 HingeMidpointBeamIntegration::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 << "HingeMidpointBeamIntegration::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 HingeMidpointBeamIntegration::setParameter(const char **argv, int argc,
00132 Parameter ¶m)
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 HingeMidpointBeamIntegration::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 HingeMidpointBeamIntegration::activateParameter(int paramID)
00170 {
00171 parameterID = paramID;
00172
00173 return 0;
00174 }
00175
00176 void
00177 HingeMidpointBeamIntegration::Print(OPS_Stream &s, int flag)
00178 {
00179 s << "HingeMidpoint" << endln;
00180 s << " lpI = " << lpI;
00181 s << " lpJ = " << lpJ << endln;
00182
00183 return;
00184 }
00185
00186 void
00187 HingeMidpointBeamIntegration::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) {
00197 dptsdh[0] = halfOneOverL;
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) {
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] = -halfOneOverL;
00205 }
00206 if (parameterID == 3) {
00207 dptsdh[0] = halfOneOverL;
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] = -halfOneOverL;
00211 }
00212
00213 if (dLdh != 0.0) {
00214
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 HingeMidpointBeamIntegration::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) {
00233 dwtsdh[0] = oneOverL;
00234 dwtsdh[1] = -0.5*oneOverL;
00235 dwtsdh[2] = -0.5*oneOverL;
00236 }
00237 if (parameterID == 2) {
00238 dwtsdh[1] = -0.5*oneOverL;
00239 dwtsdh[2] = -0.5*oneOverL;
00240 dwtsdh[3] = oneOverL;
00241 }
00242 if (parameterID == 3) {
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
00253 opserr << "getWeightsDeriv -- to do" << endln;
00254 }
00255
00256 return;
00257 }