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

Element.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.5 $
00022 // $Date: 2001/07/11 23:09:00 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/element/Element.cpp,v $
00024                                                                         
00025                                                                         
00026 // File: ~/model/Element.C
00027 //
00028 // Written: fmk 11/95
00029 // Revised:
00030 //
00031 // Purpose: This file contains the class definition for Element.
00032 // Element is an abstract base class and thus no objects of it's type
00033 // can be instantiated. It has pure virtual functions which must be
00034 // implemented in it's derived classes. 
00035 //
00036 // The interface:
00037 //
00038 
00039 #include "Element.h"
00040 #include <Renderer.h>
00041 #include <Vector.h>
00042 #include <Matrix.h>
00043 #include <Node.h>
00044 #include <Domain.h>
00045 
00046 // Element(int tag, int noExtNodes);
00047 //  constructor that takes the element's unique tag and the number
00048 // of external nodes for the element.
00049 
00050 Element::Element(int tag, int cTag) 
00051   :DomainComponent(tag, cTag), Ki(0)
00052 {
00053     // does nothing
00054 }
00055 
00056 
00057 Element::~Element() 
00058 {
00059   if (Ki != 0)
00060     delete Ki;
00061 }
00062 
00063 int
00064 Element::update(void)
00065 {
00066     return 0;
00067 }
00068 
00069 int
00070 Element::revertToStart(void)
00071 {
00072     return 0;
00073 }
00074 
00075 int
00076 Element::setKi(void) {
00077   if (Ki != 0)
00078     delete Ki;
00079   Ki = new Matrix(this->getTangentStiff());
00080   if (Ki == 0) {
00081     cerr << "Element::setKi(void) - out of memory for element " << this->getTag() << endl;
00082     return -1;
00083   }
00084   return 0;
00085 }
00086       
00087   
00088 const Matrix &
00089 Element::getKi(void) {
00090   if (Ki != 0)
00091     return *Ki;
00092   else {
00093     this->setKi();
00094     if (Ki == 0)
00095       return this->getTangentStiff();
00096     else
00097       return *Ki;
00098   }
00099 }
00100 
00101 
00102 
00103 int 
00104 Element::addInertiaLoadToUnbalance(const Vector &accel)
00105 {
00106   // some vectors to hold the load increment and RV
00107   int ndof = this->getNumDOF();
00108   Vector load(ndof);
00109   Vector RV(ndof);
00110 
00111   // 
00112   // for each node we will add it's R*accel contribution to RV
00113   //
00114 
00115   const ID &theNodes = this->getExternalNodes();
00116   int numNodes = theNodes.Size();
00117   int loc = 0;
00118   Domain *theDomain = this->getDomain();
00119   for (int i=0; i<numNodes; i++) {
00120     Node *theNode = theDomain->getNode(theNodes(i));
00121     if (theNode == 0)
00122       return -1;
00123     else {
00124       int numNodeDOF = theNode->getNumberDOF();
00125       const Vector &nodeRV = theNode->getRV(accel);
00126       for (int j=0; j<numNodeDOF; j++)
00127 #ifdef _G3DEBUG
00128   if (loc<ndof)
00129 #endif
00130    RV(loc++) = nodeRV(j);
00131     }
00132   }
00133 
00134   //
00135   // now we determine - M * R * accel
00136   //
00137   const Matrix &mass = this->getMass();
00138   load = mass * RV;
00139   load *= -1.0;
00140 
00141   return this->addLoad(load);
00142 }
00143 
00144 bool
00145 Element::isSubdomain(void)
00146 {
00147     return false;
00148 }
00149 
00150 Response*
00151 Element::setResponse(char **argv, int argc, Information &eleInfo)
00152 {
00153  return 0;
00154 }
00155 
00156 int
00157 Element::getResponse(int responseID, Information &eleInformation)
00158 {
00159     return -1;
00160 }
Copyright Contact Us