UniaxialMaterial.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.15 $
00022 // $Date: 2006/09/05 22:28:08 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/material/uniaxial/UniaxialMaterial.cpp,v $
00024                                                                         
00025                                                                         
00026 // Written: fmk 
00027 // Created: 05/98
00028 // Revision: A
00029 //
00030 // Description: This file contains the class implementation for 
00031 // UniaxialMaterial.
00032 //
00033 // What: "@(#) UniaxialMaterial.C, revA"
00034 
00035 #include <UniaxialMaterial.h>
00036 #include <string.h>
00037 #include <Information.h>
00038 #include <MaterialResponse.h>
00039 #include <float.h>
00040 #include <Vector.h>
00041 #include <DataOutputHandler.h>
00042 
00043 
00044 UniaxialMaterial::UniaxialMaterial(int tag, int clasTag)
00045 :Material(tag,clasTag)
00046 {
00047 
00048 }
00049 
00050 UniaxialMaterial::~UniaxialMaterial()
00051 {
00052         // does nothing
00053 }
00054 
00055 int
00056 UniaxialMaterial::setTrial(double strain, double &stress, double &tangent, double strainRate)
00057 {
00058   int res = this->setTrialStrain(strain, strainRate);
00059   if (res == 0) {
00060     stress = this->getStress();
00061     tangent = this->getTangent();
00062   } else {
00063     opserr << "UniaxialMaterial::setTrial() - material failed in setTrialStrain()\n"; 
00064   }
00065 
00066   return res;
00067 }
00068 
00069 // default operation for strain rate is zero
00070 double
00071 UniaxialMaterial::getStrainRate(void)
00072 {
00073     return 0.0;
00074 }
00075 
00076 
00077 
00078 // default operation for damping tangent is zero
00079 double
00080 UniaxialMaterial::getDampTangent(void)
00081 {
00082     return 0.0;
00083 }
00084 
00085 // default operation for secant stiffness
00086 double
00087 UniaxialMaterial::getSecant (void)
00088 {
00089         double strain = this->getStrain();
00090         double stress = this->getStress();
00091 
00092         if (strain != 0.0)
00093                 return stress/strain;
00094         else
00095                 return this->getTangent();
00096 }
00097 
00098 double 
00099 UniaxialMaterial::getRho(void)
00100 {
00101         return 0.0;
00102 }
00103 
00104 UniaxialMaterial*
00105 UniaxialMaterial::getCopy(SectionForceDeformation *s)
00106 {
00107         return this->getCopy();
00108 }
00109 
00110 Response* 
00111 UniaxialMaterial::setResponse(const char **argv, int argc, Information &matInfo, OPS_Stream &theOutput)
00112 {
00113   Response *theResponse = 0;
00114 
00115   theOutput.tag("UniaxialMaterialOutput");
00116   theOutput.attr("matType", this->getClassType());
00117   theOutput.attr("matTag", this->getTag());
00118 
00119   // stress
00120   if (strcmp(argv[0],"stress") == 0) {
00121     theOutput.tag("ResponseType", "sigma11");
00122     theResponse =  new MaterialResponse(this, 1, this->getStress());
00123   }  
00124   // tangent
00125   else if (strcmp(argv[0],"tangent") == 0) {
00126     theOutput.tag("ResponseType", "C11");
00127     theResponse =  new MaterialResponse(this, 2, this->getTangent());
00128   }
00129 
00130   // strain
00131   else if (strcmp(argv[0],"strain") == 0) {
00132     theOutput.tag("ResponseType", "eps11");
00133     theResponse =  new MaterialResponse(this, 3, this->getStrain());
00134   }
00135 
00136   // strain
00137   else if ((strcmp(argv[0],"stressStrain") == 0) || 
00138            (strcmp(argv[0],"stressANDstrain") == 0)) {
00139     theOutput.tag("ResponseType", "sig11");
00140     theOutput.tag("ResponseType", "eps11");
00141     theResponse =  new MaterialResponse(this, 4, Vector(2));
00142   }
00143 
00144   theOutput.endTag();
00145   return theResponse;
00146 
00147 }
00148  
00149 int 
00150 UniaxialMaterial::getResponse(int responseID, Information &matInfo)
00151 {
00152   static Vector stressStrain(2);
00153   // each subclass must implement its own stuff    
00154   switch (responseID) {
00155     case 1:
00156       matInfo.setDouble(this->getStress());
00157       return 0;
00158       
00159     case 2:
00160       matInfo.setDouble(this->getTangent());
00161       return 0;      
00162 
00163     case 3:
00164       matInfo.setDouble(this->getStrain());
00165       return 0;      
00166     
00167     case 4:
00168       stressStrain(0) = this->getStress();
00169       stressStrain(1) = this->getStrain();
00170       matInfo.setVector(stressStrain);
00171       return 0;
00172       
00173   default:      
00174     return -1;
00175   }
00176 }
00177 
00178 
00179 // AddingSensitivity:BEGIN ////////////////////////////////////////
00180 double
00181 UniaxialMaterial::getStressSensitivity(int gradNumber, bool conditional)
00182 {
00183     return 0.0;
00184 }
00185 
00186 double
00187 UniaxialMaterial::getStrainSensitivity(int gradNumber)
00188 {
00189     return 0.0;
00190 }
00191 
00192 double
00193 UniaxialMaterial::getInitialTangentSensitivity(int gradNumber)
00194 {
00195     return 0.0;
00196 }
00197 
00198 double
00199 UniaxialMaterial::getRhoSensitivity(int gradNumber)
00200 {
00201     return 0.0;
00202 }
00203 
00204 double
00205 UniaxialMaterial::getDampTangentSensitivity(int gradNumber)
00206 {
00207     return 0.0;
00208 }
00209 
00210 int
00211 UniaxialMaterial::commitSensitivity(double strainSensitivity, int gradNumber, int numGrads)
00212 {
00213     return -1;
00214 }
00215 
00216 double
00217 UniaxialMaterial::getInitialTangent (void)
00218 {
00219         opserr << "UniaxialMaterial::getInitialTangent() -- this mehtod " << endln
00220                 << " is not implemented for the selected material. " << endln;
00221         return 0.0;
00222 }
00223 
00224 // AddingSensitivity:END //////////////////////////////////////////

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