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

ElasticMaterial.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:22 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/material/uniaxial/ElasticMaterial.cpp,v $
00024                                                                         
00025                                                                         
00026 // File: ~/material/ElasticMaterial.C
00027 //
00028 // Written: fmk 
00029 // Created: 07/98
00030 // Revision: A
00031 //
00032 // Description: This file contains the class implementation for 
00033 // ElasticMaterial. 
00034 //
00035 // What: "@(#) ElasticMaterial.C, revA"
00036 
00037 #include <ElasticMaterial.h>
00038 #include <Vector.h>
00039 #include <Channel.h>
00040 #include <Information.h>
00041 
00042 ElasticMaterial::ElasticMaterial(int tag, double e, double et)
00043 :UniaxialMaterial(tag,MAT_TAG_ElasticMaterial),
00044  commitStrain(0.0), commitStrainRate(0.0),
00045  trialStrain(0.0),  trialStrainRate(0.0),
00046   E(e), eta(et)
00047 {
00048 
00049 }
00050 
00051 ElasticMaterial::ElasticMaterial()
00052 :UniaxialMaterial(0,MAT_TAG_ElasticMaterial),
00053  commitStrain(0.0), commitStrainRate(0.0),
00054  trialStrain(0.0),  trialStrainRate(0.0),
00055   E(0.0), eta(0.0)
00056 {
00057 
00058 }
00059 
00060 ElasticMaterial::~ElasticMaterial()
00061 {
00062   // does nothing
00063 }
00064 
00065 int 
00066 ElasticMaterial::setTrialStrain(double strain, double strainRate)
00067 {
00068     trialStrain     = strain;
00069     trialStrainRate = strainRate;
00070     return 0;
00071 }
00072 
00073 double 
00074 ElasticMaterial::getStress(void)
00075 {
00076     return E*trialStrain + eta*trialStrainRate;
00077 }
00078 
00079 int 
00080 ElasticMaterial::commitState(void)
00081 {
00082     commitStrain     = trialStrain;
00083     commitStrainRate = trialStrainRate;
00084     return 0;
00085 }
00086 
00087 int 
00088 ElasticMaterial::revertToLastCommit(void)
00089 {
00090     trialStrain     = commitStrain;
00091     trialStrainRate = commitStrainRate;
00092     return 0;
00093 }
00094 
00095 int 
00096 ElasticMaterial::revertToStart(void)
00097 {
00098     commitStrain     = 0.0;
00099     commitStrainRate = 0.0;
00100     trialStrain      = 0.0;
00101     trialStrainRate  = 0.0;
00102     return 0;
00103 }
00104 
00105 UniaxialMaterial *
00106 ElasticMaterial::getCopy(void)
00107 {
00108     ElasticMaterial *theCopy = new ElasticMaterial(this->getTag(),E,eta);
00109     theCopy->trialStrain     = trialStrain;
00110     theCopy->trialStrainRate = trialStrainRate;
00111     return theCopy;
00112 }
00113 
00114 int 
00115 ElasticMaterial::sendSelf(int cTag, Channel &theChannel)
00116 {
00117   int res = 0;
00118   static Vector data(5);
00119   data(0) = this->getTag();
00120   data(1) = E;
00121   data(2) = eta;
00122   data(3) = commitStrain;
00123   data(4) = commitStrainRate;
00124   res = theChannel.sendVector(this->getDbTag(), cTag, data);
00125   if (res < 0) 
00126     cerr << "ElasticMaterial::sendSelf() - failed to send data\n";
00127 
00128   return res;
00129 }
00130 
00131 int 
00132 ElasticMaterial::recvSelf(int cTag, Channel &theChannel, 
00133           FEM_ObjectBroker &theBroker)
00134 {
00135   int res = 0;
00136   static Vector data(5);
00137   res = theChannel.recvVector(this->getDbTag(), cTag, data);
00138   
00139   if (res < 0) {
00140       cerr << "ElasticMaterial::recvSelf() - failed to receive data\n";
00141       E = 0; 
00142       this->setTag(0);      
00143   }
00144   else {
00145     this->setTag(data(0));
00146     E   = data(1);
00147     eta = data(2);
00148     commitStrain     = data(3);
00149     commitStrainRate = data(4);
00150     trialStrain      = commitStrain;
00151     trialStrainRate  = commitStrainRate;
00152   }
00153     
00154   return res;
00155 }
00156 
00157 void 
00158 ElasticMaterial::Print(ostream &s, int flag)
00159 {
00160     s << "Elastic tag: " << this->getTag() << endl;
00161     s << "  E: " << E << " eta: " << eta << endl;
00162 }
00163 
00164 int
00165 ElasticMaterial::setParameter(char **argv, int argc, Information &info)
00166 {
00167  if (strcmp(argv[0],"E") == 0) {
00168   info.theType = DoubleType;
00169   return 1;
00170  }
00171  else if (strcmp(argv[0],"eta") == 0) {
00172   info.theType = DoubleType;
00173   return 2;
00174  }
00175  else
00176   return -1;
00177 }
00178 
00179 int 
00180 ElasticMaterial::updateParameter(int parameterID, Information &info)
00181 {
00182  switch(parameterID) {
00183  case -1:
00184   return -1;
00185  case 1:
00186   E = info.theDouble;
00187   return 0;
00188  case 2:
00189   eta = info.theDouble;
00190   return 0;
00191  default:
00192   return -1;
00193  }
00194 }
00195 
Copyright Contact Us