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

Generated on Mon Oct 23 15:05:19 2006 for OpenSees by doxygen 1.5.0