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
00031
00032
00033 #include <OPS_Globals.h>
00034 #include <stdlib.h>
00035 #include <Domain.h>
00036 #include <Node.h>
00037 #include <MP_Constraint.h>
00038 #include <Matrix.h>
00039 #include <ID.h>
00040 #include <RigidDiaphragm.h>
00041
00042
00043 RigidDiaphragm::RigidDiaphragm(Domain &theDomain, int nR, ID &nC,
00044 int perpPlaneConstrained, int startMPtag) {
00045
00046
00047 if (perpPlaneConstrained < 0 || perpPlaneConstrained > 2) {
00048 opserr << "RigidDiaphragm::RigidDiaphragm - " <<
00049 "the dirn of perpendicular to constrained plane" << perpPlaneConstrained << "not valid\n";
00050 return;
00051 }
00052
00053
00054 if (nC.getLocation(nR) >= 0) {
00055 opserr << "RigidDiaphragm::RigidDiaphragm - " <<
00056 "retained node" << nR << "is in constrained node list\n";
00057 return;
00058 }
00059
00060
00061 Node *nodeR = theDomain.getNode(nR);
00062 if (nodeR == 0) {
00063 opserr << "RigidDiaphragm::RigidDiaphragm - " <<
00064 "retained Node" << nR << "not in domain\n";
00065 return;
00066 }
00067
00068 const Vector &crdR = nodeR->getCrds();
00069 if ((nodeR->getNumberDOF() != 6) || (crdR.Size() != 3)){
00070 opserr << "RigidDiaphragm::RigidDiaphragm - " <<
00071 "retained Node" << nR << "not in 3d space with 6 dof\n";
00072
00073
00074 return;
00075 }
00076
00077
00078
00079
00080
00081
00082
00083 ID id(3);
00084
00085
00086 Matrix mat(3,3);
00087 mat.Zero();
00088 mat(0,0) = 1.0; mat(1,1) = 1.0; mat(2,2) = 1.0;
00089
00090
00091
00092
00093
00094
00095
00096 for (int i=0; i<nC.Size(); i++) {
00097
00098
00099 int ndC = nC(i);
00100 Node *nodeC = theDomain.getNode(ndC);
00101
00102
00103 if (nodeC != 0) {
00104
00105
00106 const Vector &crdC = nodeC->getCrds();
00107
00108
00109 if ((nodeR->getNumberDOF() == 6) && (crdR.Size() == 3)){
00110
00111
00112 double deltaX = crdC(0) - crdR(0);
00113 double deltaY = crdC(1) - crdR(1);
00114 double deltaZ = crdC(2) - crdR(2);
00115
00116
00117 if (perpPlaneConstrained == 2) {
00118
00119
00120 if (deltaZ == 0.0) {
00121
00122
00123 id(0) = 0; id(1) = 1; id(2) = 5;
00124
00125
00126 mat(0,2) = - deltaY;
00127 mat(1,2) = deltaX;
00128
00129 } else
00130 opserr << "RigidDiaphragm::RigidDiaphragm - ignoring constrained Node " << ndC << ", not in xy plane\n";
00131
00132
00133 } else if (perpPlaneConstrained == 1) {
00134
00135
00136 if (deltaY == 0.0) {
00137
00138
00139 id(0) = 0; id(1) = 2; id(2) = 4;
00140
00141
00142 mat(0,2) = deltaZ;
00143 mat(1,2) = -deltaX;
00144
00145 } else
00146 opserr << "RigidDiaphragm::RigidDiaphragm - ignoring constrained Node " << ndC << ", not in xz plane\n";
00147
00148
00149 } else {
00150
00151
00152 if (deltaX == 0.0) {
00153
00154
00155 id(0) = 1; id(1) = 2; id(2) = 3;
00156
00157
00158 mat(0,2) = -deltaZ;
00159 mat(1,2) = deltaY;
00160
00161 } else
00162 opserr << "RigidDiaphragm::RigidDiaphragm - ignoring constrained Node " << ndC <<
00163 ", not in xz plane\n";
00164 }
00165
00166
00167 MP_Constraint *newC = new MP_Constraint(startMPtag+i, nR, ndC,
00168 mat, id, id);
00169 if (newC == 0) {
00170 opserr << "RigidDiaphragm::RigidDiaphragm - ignoring constrained Node " << ndC <<
00171 ", out of memory\n";
00172 } else {
00173
00174 if (theDomain.addMP_Constraint(newC) == false) {
00175 opserr << "RigidDiaphragm::RigidDiaphragm - ignoring constrained Node " << ndC <<
00176 ", failed to add\n";
00177 delete newC;
00178 }
00179 }
00180
00181 } else
00182 opserr << "RigidDiaphragm::RigidDiaphragm - ignoring constrained Node " << ndC <<
00183 ", not 3d node\n";
00184
00185 } else
00186 opserr << "RigidDiaphragm::RigidDiaphragm - ignoring constrained Node " << ndC <<
00187 " as no node in domain\n";
00188
00189 }
00190 }
00191
00192
00193
00194
00195
00196
00197 RigidDiaphragm::~RigidDiaphragm()
00198 {
00199
00200 }
00201
00202
00203