RigidDiaphragm.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: 2003/02/14 23:00:55 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/domain/constraints/RigidDiaphragm.cpp,v $
00024                                                                         
00025                                                                         
00026 // File: ~/model/constraints/RigidDiaphragm.C
00027 //
00028 // Written: fmk 1/99
00029 // Revised:
00030 //
00031 // Purpose: This file contains the class implementation for RigidDiaphragm.
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     // check plane is valid, i.e. perpPlaneConstrained must be 0, 1 or 2
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     // check constrainedNodes ID does not contain the retained node
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     // get a pointer to the retained node and check node in 3d with 6 dof
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     // create some objects which will be passed to the MP_Constraint 
00079     // constructor, elements of objects are filled in later
00080     //
00081     
00082     // create the ID to identify the constrained dof 
00083     ID id(3);
00084 
00085     // construct the tranformation matrix Ccr, where  Uc = Ccr Ur & set the diag
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     // now for each of the specified constrained dof we:
00092     // 1. check it's in the plane of the retained node, 
00093     // 2. set the ID and transformation matrix,
00094     // 3. create the MP_Constrainet and add it to the domain
00095 
00096     for (int i=0; i<nC.Size(); i++) {
00097 
00098       // get the constrained node
00099       int ndC = nC(i);
00100       Node *nodeC = theDomain.getNode(ndC);
00101 
00102       // ensure node exists
00103       if (nodeC != 0) {
00104 
00105         // get node coordinates
00106         const Vector &crdC = nodeC->getCrds();
00107 
00108         // check constrained node has correct dim and number of dof
00109         if ((nodeR->getNumberDOF() == 6) && (crdR.Size() == 3)){
00110 
00111           // determine delta Coordintaes
00112           double deltaX = crdC(0) - crdR(0);
00113           double deltaY = crdC(1) - crdR(1);        
00114           double deltaZ = crdC(2) - crdR(2);
00115           
00116           // rigid diaphragm in xy plane
00117           if (perpPlaneConstrained == 2) { 
00118 
00119             // check constrained node in xy plane with retained node
00120             if (deltaZ == 0.0) {
00121 
00122               // dof corresponding to dX, dY and theta Z (0,1,5)
00123               id(0) = 0; id(1) = 1; id(2) = 5;
00124 
00125               // set up transformation matrix
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           // rigid diaphragm in xz plane
00133           } else if (perpPlaneConstrained == 1) { 
00134 
00135             // check constrained node in xy plane with retained node
00136             if (deltaY == 0.0) {
00137 
00138               // dof corresponding to dX, dZ and theta Y (0,2,4)
00139               id(0) = 0; id(1) = 2; id(2) = 4;
00140 
00141               // set up transformation matrix
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           // rigid diaphragm in yz plane
00149           } else {        
00150 
00151             // check constrained node in xy plane with retained node
00152             if (deltaX == 0.0) {
00153 
00154               // dof corresponding to dY, dZ and theta X (1,2,3)
00155               id(0) = 1; id(1) = 2; id(2) = 3;
00156 
00157               // set up transformation matrix
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           // create the MP_Constraint
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             // add the constraint to the domain
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  // node not in 3d space
00182           opserr << "RigidDiaphragm::RigidDiaphragm - ignoring constrained Node " << ndC << 
00183             ", not 3d node\n";
00184         
00185       } else // node does not exist
00186       opserr << "RigidDiaphragm::RigidDiaphragm - ignoring constrained Node " << ndC << 
00187         " as no node in domain\n";
00188 
00189     } // for each node in constrained nodes
00190 }
00191 
00192 
00193 
00194         
00195         
00196     
00197 RigidDiaphragm::~RigidDiaphragm()
00198 {
00199     // does nothing
00200 }
00201 
00202  
00203 

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