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
00034
00035
00036
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
00047
00048
00049
00050 Element::Element(int tag, int cTag)
00051 :DomainComponent(tag, cTag), Ki(0)
00052 {
00053
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
00107 int ndof = this->getNumDOF();
00108 Vector load(ndof);
00109 Vector RV(ndof);
00110
00111
00112
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
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 }