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

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.5 $
00022 // $Date: 2001/07/18 22:05:54 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/material/uniaxial/UniaxialMaterial.cpp,v $
00024                                                                         
00025                                                                         
00026 // File: ~/material/UniaxialMaterial.C
00027 //
00028 // Written: fmk 
00029 // Created: 05/98
00030 // Revision: A
00031 //
00032 // Description: This file contains the class implementation for 
00033 // UniaxialMaterial.
00034 //
00035 // What: "@(#) UniaxialMaterial.C, revA"
00036 
00037 #include <UniaxialMaterial.h>
00038 #include <string.h>
00039 #include <Information.h>
00040 #include <MaterialResponse.h>
00041 #include <G3Globals.h>
00042 #include <float.h>
00043 #include <Vector.h>
00044 
00045 UniaxialMaterial::UniaxialMaterial(int tag, int clasTag)
00046 :Material(tag,clasTag)
00047 {
00048 
00049 }
00050 
00051 UniaxialMaterial::~UniaxialMaterial()
00052 {
00053  // does nothing
00054 }
00055 
00056 int
00057 UniaxialMaterial::setTrial(double strain, double &stress, double &tangent, double strainRate)
00058 {
00059   int res = this->setTrialStrain(strain, strainRate);
00060   if (res == 0) {
00061     stress = this->getStress();
00062     tangent = this->getTangent();
00063   }
00064   return res;
00065 }
00066 
00067 // default operation for strain rate is zero
00068 double
00069 UniaxialMaterial::getStrainRate(void)
00070 {
00071     return 0.0;
00072 }
00073 
00074 
00075 
00076 // default operation for damping tangent is zero
00077 double
00078 UniaxialMaterial::getDampTangent(void)
00079 {
00080     return 0.0;
00081 }
00082 
00083 // default operation for secant stiffness
00084 double
00085 UniaxialMaterial::getSecant (void)
00086 {
00087  double strain = this->getStrain();
00088  double stress = this->getStress();
00089 
00090  if (strain != 0.0)
00091   return stress/strain;
00092  else
00093   return this->getTangent();
00094 }
00095 
00096 UniaxialMaterial*
00097 UniaxialMaterial::getCopy(SectionForceDeformation *s)
00098 {
00099  return this->getCopy();
00100 }
00101 
00102 Response* 
00103 UniaxialMaterial::setResponse(char **argv, int argc, Information &matInfo)
00104 {
00105     // stress
00106     if (strcmp(argv[0],"stress") == 0)
00107   return new MaterialResponse(this, 1, this->getStress());
00108 
00109     // tangent
00110     else if (strcmp(argv[0],"tangent") == 0)
00111   return new MaterialResponse(this, 2, this->getTangent());
00112 
00113     // strain
00114  else if (strcmp(argv[0],"strain") == 0)
00115   return new MaterialResponse(this, 3, this->getStrain());
00116 
00117     // strain
00118     else if ((strcmp(argv[0],"stressStrain") == 0) || 
00119       (strcmp(argv[0],"stressANDstrain") == 0)) {
00120              
00121   return new MaterialResponse(this, 4, Vector(2));
00122 
00123     }
00124     // otherwise unknown
00125     else
00126   return 0;
00127 }
00128 
00129 int 
00130 UniaxialMaterial::getResponse(int responseID, Information &matInfo)
00131 {
00132     static Vector stressStrain(2);
00133 
00134   // each subclass must implement its own stuff    
00135   switch (responseID) {
00136     case 1:
00137       matInfo.setDouble(this->getStress());
00138       return 0;
00139       
00140     case 2:
00141       matInfo.setDouble(this->getTangent());
00142       return 0;      
00143 
00144     case 3:
00145       matInfo.setDouble(this->getStrain());
00146       return 0;      
00147     
00148     case 4:
00149         stressStrain(0) = this->getStress();
00150         stressStrain(1) = this->getStrain();
00151 
00152         matInfo.setVector(stressStrain);
00153         return 0;
00154 
00155     default:      
00156       return -1;
00157   }
00158 }
Copyright Contact Us