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

RigidBeam.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/RigidBeam.cpp,v $
00024                                                                         
00025                                                                         
00026 // File: ~/model/constraints/RigidBeam.C
00027 //
00028 // Written: fmk 12/99
00029 // Revised:
00030 //
00031 // Purpose: This file contains the class implementation for RigidBeam.
00032 
00033 #include <G3Globals.h>
00034 #include <Domain.h>
00035 #include <Node.h>
00036 #include <MP_Constraint.h>
00037 #include <Matrix.h>
00038 #include <ID.h>
00039 #include <RigidBeam.h>
00040 
00041 
00042 RigidBeam::RigidBeam(Domain &theDomain, int nR, int nC, int startMPtag) {
00043 
00044     
00045     // get a pointer to the retained and constrained nodes - make sure they exist
00046     Node *nodeR = theDomain.getNode(nR);
00047     if (nodeR == 0) {
00048       g3ErrorHandler->warning("RigidBeam::RigidBeam - %s %d %s\n",
00049          "retained Node", nR, "not in domain");
00050       return;
00051     }
00052     Node *nodeC = theDomain.getNode(nC);
00053     if (nodeR == 0) {
00054       g3ErrorHandler->warning("RigidBeam::RigidBeam - %s %d %s\n",
00055          "constrained Node", nC, "not in domain");
00056       return;
00057     }
00058 
00059     // get the coordinates of the two nodes - check dimensions are the same FOR THE MOMENT
00060     const Vector &crdR = nodeR->getCrds();
00061     const Vector &crdC = nodeC->getCrds();
00062     int dimR = crdR.Size();
00063     int dimC = crdC.Size();
00064     if (dimR != dimC) {
00065       g3ErrorHandler->warning("RigidBeam::RigidBeam - mismatch in dimension %s %d %s %d\n",
00066          "between constrained Node", nC, "and Retained node",nR);
00067       return;
00068     }
00069     
00070     // check the number of dof at each node is the same
00071     int numDOF = nodeR->getNumberDOF();
00072     if (numDOF != nodeC->getNumberDOF()){ 
00073       g3ErrorHandler->warning("RigidBeam::RigidBeam - mismatch in numDOF %s %d %s %d\n",
00074          "between constrained Node", nC, "and Retained node",nR);
00075       return;
00076     }
00077 
00078     // check the number of dof at the nodes >= dimension of problem
00079     if(numDOF < dimR){    
00080       g3ErrorHandler->warning("RigidBeam::RigidBeam - numDOF at nodes %d %d %s\n",
00081          nR, nC, "must be >= dimension of problem");
00082       return;
00083     }
00084 
00085     
00086     // create the ID to identify the constrained dof 
00087     ID id(numDOF);
00088 
00089     // construct the tranformation matrix Ccr, where  Uc = Ccr Ur & set the diag, Ccr = I
00090     Matrix mat(numDOF,numDOF);
00091     mat.Zero();
00092 
00093     // set the values
00094     for (int i=0; i<numDOF; i++) {
00095       mat(i,i) = 1.0;
00096       id(i) = i;
00097     }
00098 
00099     // if there are rotational dof - we must modify Ccr DONE ASSUMING SMALL ROTATIONS
00100     if (dimR != numDOF) {
00101       if (dimR == 2 && numDOF == 3) {
00102  double deltaX = crdC(0) - crdR(0);
00103  double deltaY = crdC(1) - crdR(1);     
00104  mat(0,2) = -deltaY;
00105  mat(1,2) = deltaX;
00106       } else if (dimR == 3 && numDOF == 6) {
00107  double deltaX = crdC(0) - crdR(0);
00108  double deltaY = crdC(1) - crdR(1);     
00109  double deltaZ = crdC(2) - crdR(2);
00110  // rotation about z/3 axis
00111  mat(0,5) = -deltaY;
00112  mat(1,5) = deltaX; 
00113 
00114  // rotation about y/2 axis
00115  mat(0,4) = deltaZ;
00116  mat(2,4) = -deltaX;
00117 
00118  // rotation about x/1 axis
00119  mat(1,3) = -deltaZ;
00120  mat(2,3) = deltaY;
00121       } else { // not valid
00122  g3ErrorHandler->warning("RigidBeam::RigidBeam -  for nodes %d %d %s\n",
00123     nR, nC, "nodes do not have valid numDOF for their dimension");
00124  return;
00125       }
00126  
00127     } 
00128     
00129     // create the MP_Constraint
00130     MP_Constraint *newC = new MP_Constraint(startMPtag+1, nR, nC, 
00131          mat, id, id);
00132     if (newC == 0) {
00133       g3ErrorHandler->warning("RigidBeam::RigidBeam - for nodes %d %d, out of memory\n",
00134          nC, nR);
00135     } else {
00136       // add the constraint to the domain
00137       if (theDomain.addMP_Constraint(newC) == false) {
00138  g3ErrorHandler->warning("RigidBeam::RigidBeam - for nodes %d %d, could not add to domain\n",
00139     nC, nR);
00140  delete newC;
00141       }
00142     }
00143 }
00144  
00145     
00146 RigidBeam::~RigidBeam()
00147 {
00148     // does nothing
00149 }
00150 
00151  
00152 
Copyright Contact Us