Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

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.1.1.1 $
00022 // $Date: 2000/09/15 08:23:18 $
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 <G3Globals.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       g3ErrorHandler->warning("RigidDiaphragm::RigidDiaphragm - %s %d %s\n",
00049          "the dirn of perpendicular to constrained plane",
00050          perpPlaneConstrained, "not valid");
00051       return;
00052     }
00053 
00054     // check constrainedNodes ID does not contain the retained node
00055     if (nC.getLocation(nR) >= 0) {
00056       g3ErrorHandler->warning("RigidDiaphragm::RigidDiaphragm - %s %d %s\n",
00057          "retained node", 
00058          nR, 
00059          "is in constrained node list");
00060       return;
00061     } 
00062     
00063     // get a pointer to the retained node and check node in 3d with 6 dof
00064     Node *nodeR = theDomain.getNode(nR);
00065     if (nodeR == 0) {
00066       g3ErrorHandler->warning("RigidDiaphragm::RigidDiaphragm - %s %d %s\n",
00067          "retained Node", nR, "not in domain",nR);
00068       return;
00069     }
00070 
00071     const Vector &crdR = nodeR->getCrds();
00072     if ((nodeR->getNumberDOF() != 6) || (crdR.Size() != 3)){
00073       g3ErrorHandler->warning("RigidDiaphragm::RigidDiaphragm - %s %d %s\n",
00074          "retained Node",
00075          nR,
00076          "not in 3d space with 6 dof");
00077       return;
00078     } 
00079 
00080     // 
00081     // create some objects which will be passed to the MP_Constraint 
00082     // constructor, elements of objects are filled in later
00083     //
00084     
00085     // create the ID to identify the constrained dof 
00086     ID id(3);
00087 
00088     // construct the tranformation matrix Ccr, where  Uc = Ccr Ur & set the diag
00089     Matrix mat(3,3);
00090     mat.Zero();
00091     mat(0,0) = 1.0; mat(1,1) = 1.0; mat(2,2) = 1.0;
00092 
00093 
00094     // now for each of the specified constrained dof we:
00095     // 1. check it's in the plane of the retained node, 
00096     // 2. set the ID and transformation matrix,
00097     // 3. create the MP_Constrainet and add it to the domain
00098 
00099     for (int i=0; i<nC.Size(); i++) {
00100 
00101       // get the constrained node
00102       int ndC = nC(i);
00103       Node *nodeC = theDomain.getNode(ndC);
00104 
00105       // ensure node exists
00106       if (nodeC != 0) {
00107 
00108  // get node coordinates
00109  const Vector &crdC = nodeC->getCrds();
00110 
00111  // check constrained node has correct dim and number of dof
00112  if ((nodeR->getNumberDOF() == 6) && (crdR.Size() == 3)){
00113 
00114    // determine delta Coordintaes
00115    double deltaX = crdC(0) - crdR(0);
00116    double deltaY = crdC(1) - crdR(1);     
00117    double deltaZ = crdC(2) - crdR(2);
00118    
00119    // rigid diaphragm in xy plane
00120    if (perpPlaneConstrained == 2) { 
00121 
00122      // check constrained node in xy plane with retained node
00123      if (deltaZ == 0.0) {
00124 
00125        // dof corresponding to dX, dY and theta Z (0,1,5)
00126        id(0) = 0; id(1) = 1; id(2) = 5;
00127 
00128        // set up transformation matrix
00129        mat(0,2) = - deltaY;
00130        mat(1,2) = deltaX;
00131 
00132      } else 
00133        g3ErrorHandler->warning("RigidDiaphragm::RigidDiaphragm - ignoring constrained Node %d, not in xy plane\n",ndC);
00134 
00135    // rigid diaphragm in xz plane
00136    } else if (perpPlaneConstrained == 1) { 
00137 
00138      // check constrained node in xy plane with retained node
00139      if (deltaY == 0.0) {
00140 
00141        // dof corresponding to dX, dZ and theta Y (0,2,4)
00142        id(0) = 0; id(1) = 2; id(2) = 4;
00143 
00144        // set up transformation matrix
00145        mat(0,2) = deltaZ;
00146        mat(1,2) = -deltaX;
00147 
00148      } else
00149        g3ErrorHandler->warning("RigidDiaphragm::RigidDiaphragm - ignoring constrained Node %d, not in xz plane\n",ndC);
00150 
00151    // rigid diaphragm in yz plane
00152    } else {   
00153 
00154      // check constrained node in xy plane with retained node
00155      if (deltaX == 0.0) {
00156 
00157        // dof corresponding to dY, dZ and theta X (1,2,3)
00158        id(0) = 1; id(1) = 2; id(2) = 3;
00159 
00160        // set up transformation matrix
00161        mat(0,2) = -deltaZ;
00162        mat(1,2) = deltaY;
00163 
00164      } else
00165        g3ErrorHandler->warning("RigidDiaphragm::RigidDiaphragm - ignoring constrained Node %d, not in xz plane\n",ndC);
00166    }
00167        
00168    // create the MP_Constraint
00169    MP_Constraint *newC = new MP_Constraint(startMPtag+i, nR, ndC, 
00170         mat, id, id);
00171    if (newC == 0) {
00172      g3ErrorHandler->warning("RigidDiaphragm::RigidDiaphragm - ignoring constrained Node %d, out of memory\n",ndC);
00173    } else {
00174      // add the constraint to the domain
00175      if (theDomain.addMP_Constraint(newC) == false) {
00176        g3ErrorHandler->warning("RigidDiaphragm::RigidDiaphragm - ignoring constrained Node %d, failed to add\n",ndC);
00177        delete newC;
00178      }
00179    }
00180 
00181  } else  // node not in 3d space
00182    g3ErrorHandler->warning("RigidDiaphragm::RigidDiaphragm - ignoring constrained Node %d, not 3d node\n",ndC);
00183  
00184       } else // node does not exist
00185  g3ErrorHandler->warning("RigidDiaphragm::RigidDiaphragm - ignoring constrained Node %d as no node in domain\n",ndC);
00186 
00187     } // for each node in constrained nodes
00188 }
00189 
00190 
00191 
00192  
00193  
00194     
00195 RigidDiaphragm::~RigidDiaphragm()
00196 {
00197     // does nothing
00198 }
00199 
00200  
00201 
Copyright Contact Us