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 #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
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
00068 double
00069 UniaxialMaterial::getStrainRate(void)
00070 {
00071 return 0.0;
00072 }
00073
00074
00075
00076
00077 double
00078 UniaxialMaterial::getDampTangent(void)
00079 {
00080 return 0.0;
00081 }
00082
00083
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
00106 if (strcmp(argv[0],"stress") == 0)
00107 return new MaterialResponse(this, 1, this->getStress());
00108
00109
00110 else if (strcmp(argv[0],"tangent") == 0)
00111 return new MaterialResponse(this, 2, this->getTangent());
00112
00113
00114 else if (strcmp(argv[0],"strain") == 0)
00115 return new MaterialResponse(this, 3, this->getStrain());
00116
00117
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
00125 else
00126 return 0;
00127 }
00128
00129 int
00130 UniaxialMaterial::getResponse(int responseID, Information &matInfo)
00131 {
00132 static Vector stressStrain(2);
00133
00134
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 }