NDMaterial.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 ** Additions and changes by:                                          **
00021 **   Boris Jeremic (@ucdavis.edu)                                     **
00022 **                                                                    **
00023 ** ****************************************************************** */
00024                                                                         
00025 // $Revision: 1.20 $                                                              
00026 // $Date: 2006/09/05 21:25:35 $                                                                  
00027 // $Source: /usr/local/cvs/OpenSees/SRC/material/nD/NDMaterial.cpp,v $                                                                
00028                                                                         
00029 // File: ~/material/NDMaterial.C
00030 //
00031 // Written: MHS 
00032 // Created: Feb 2000
00033 // Revision: A
00034 //
00035 // Description: This file contains the class implementation for NDMaterial.
00036 //
00037 // What: "@(#) NDMaterial.C, revA"
00038 
00039 #include <NDMaterial.h>
00040 #include <Information.h>
00041 #include <OPS_Globals.h>
00042 #include <Matrix.h>
00043 #include <Vector.h>
00044 #include <stresst.h>
00045 #include <straint.h>
00046 #include <MaterialResponse.h>
00047 
00048 #include <PlaneStressMaterial.h>
00049 #include <BeamFiberMaterial.h>
00050 #include <PlateFiberMaterial.h>
00051 
00052 Matrix NDMaterial::errMatrix(1,1);
00053 Vector NDMaterial::errVector(1);
00054 Tensor NDMaterial::errTensor(2, def_dim_2, 0.0 );
00055 stresstensor NDMaterial::errstresstensor;
00056 straintensor NDMaterial::errstraintensor;
00057 
00058 NDMaterial::NDMaterial(int tag, int classTag)
00059 :Material(tag,classTag)
00060 {
00061 
00062 }
00063 
00064 NDMaterial::NDMaterial()
00065 :Material(0, 0)
00066 {
00067 
00068 }
00069 
00070 NDMaterial::~NDMaterial()
00071 {
00072 
00073 }
00074 
00075 NDMaterial*
00076 NDMaterial::getCopy(const char *type)
00077 {
00078   if (strcmp(type,"PlaneStress") == 0 ||
00079       strcmp(type,"PlaneStress2D") == 0) {
00080     NDMaterial *copy = this->getCopy("ThreeDimensional");
00081     PlaneStressMaterial *clone = new PlaneStressMaterial(this->getTag(),*copy);
00082     return clone;
00083   }
00084   else if (strcmp(type,"BeamFiber") == 0 ||
00085            strcmp(type,"TimoshenkoFiber") == 0) {
00086     NDMaterial *copy = this->getCopy("ThreeDimensional");
00087     BeamFiberMaterial *clone = new BeamFiberMaterial(this->getTag(),*copy);
00088     return clone;
00089   }
00090   else if (strcmp(type,"PlateFiber") == 0) {
00091     NDMaterial *copy = this->getCopy("ThreeDimensional");
00092     PlateFiberMaterial *clone = new PlateFiberMaterial(this->getTag(),*copy);
00093     return clone;
00094   }
00095   else
00096     return 0;
00097 }
00098 
00099 double
00100 NDMaterial::getRho(void)
00101 {
00102   return 0.0;
00103 }
00104 
00105 const Vector &
00106 NDMaterial::getCommittedStress(void) 
00107 {
00108   return this->getStress();
00109 }
00110 
00111 const Vector &
00112 NDMaterial::getCommittedStrain(void) 
00113 {
00114   return this->getStrain();
00115 }
00116 
00117 // methods to set and retrieve state.
00118 int 
00119 NDMaterial::setTrialStrain(const Vector &v)
00120 {
00121    opserr << "NDMaterial::setTrialStrain -- subclass responsibility\n";
00122    return -1;    
00123 }
00124 
00125 int 
00126 NDMaterial::setTrialStrain(const Vector &v, const Vector &r)
00127 {
00128    opserr << "NDMaterial::setTrialStrain -- subclass responsibility\n";
00129    return -1;    
00130 }
00131 
00132 int 
00133 NDMaterial::setTrialStrainIncr(const Vector &v)
00134 {
00135    opserr << "NDMaterial::setTrialStrainIncr -- subclass responsibility\n";
00136    return -1;    
00137 }
00138 
00139 int 
00140 NDMaterial::setTrialStrainIncr(const Vector &v, const Vector &r)
00141 {
00142    opserr << "NDMaterial::setTrialStrainIncr -- subclass responsibility\n";
00143    return -1;    
00144 }
00145 
00146 const Matrix &
00147 NDMaterial::getTangent(void)
00148 {
00149    opserr << "NDMaterial::getTangent -- subclass responsibility\n";
00150    return errMatrix;    
00151 }
00152 
00153 const Vector &
00154 NDMaterial::getStress(void)
00155 {
00156    opserr << "NDMaterial::getStress -- subclass responsibility\n";
00157    return errVector;    
00158 }
00159 
00160 const Vector &
00161 NDMaterial::getStrain(void)
00162 {
00163    opserr << "NDMaterial::getStrain -- subclass responsibility\n";
00164    return errVector;    
00165 }
00166 
00167 int 
00168 NDMaterial::setTrialStrain(const Tensor &v)
00169 {
00170    opserr << "NDMaterial::setTrialStrainIncr -- subclass responsibility\n";
00171    return -1;    
00172 }
00173 
00174 int 
00175 NDMaterial::setTrialStrain(const Tensor &v, const Tensor &r)    
00176 {
00177    opserr << "NDMaterial::setTrialStrainIncr -- subclass responsibility\n";
00178    return -1;    
00179 }
00180 
00181 int 
00182 NDMaterial::setTrialStrainIncr(const Tensor &v)
00183 {
00184    opserr << "NDMaterial::setTrialStrainIncr -- subclass responsibility\n";
00185    return -1;    
00186 }
00187 
00188 int 
00189 NDMaterial::setTrialStrainIncr(const Tensor &v, const Tensor &r)
00190 {
00191    opserr << "NDMaterial::setTrialStrainIncr -- subclass responsibility\n";
00192    return -1;    
00193 }
00194 
00195 
00196 // added Sept 22 2003 for Large Deformation, F is the Deformation Grandient
00197 
00198 int
00199 NDMaterial::setTrialF(const straintensor &f)
00200 {
00201    opserr << "NDMaterial::setTrialF -- subclass responsibility\n";
00202    return -1;
00203 }
00204 
00205 int
00206 NDMaterial::setTrialFIncr(const straintensor &df)
00207 {
00208    opserr << "NDMaterial::setTrialF -- subclass responsibility\n";
00209    return -1;
00210 }
00211 
00212 int
00213 NDMaterial::setTrialC(const straintensor &c)
00214 {
00215    opserr << "NDMaterial::setTrialC -- subclass responsibility\n";
00216    return -1;
00217 }
00218 
00219 int
00220 NDMaterial::setTrialCIncr(const straintensor &c)
00221 {
00222    opserr << "NDMaterial::setTrialC -- subclass responsibility\n";
00223    return -1;
00224 }
00225 
00226 const stresstensor& NDMaterial::getPK1StressTensor(void)
00227 {
00228    opserr << "NDMaterial::getPK1StressTensor -- subclass responsibility\n";
00229    return errstresstensor;    
00230 }
00231 
00232 const stresstensor& NDMaterial::getCauchyStressTensor(void)
00233 {
00234    opserr << "NDMaterial::getCauchyStressTensor -- subclass responsibility\n";
00235    return errstresstensor;    
00236 }
00237 
00238 const straintensor& NDMaterial::getF(void)
00239 {
00240    opserr << "NDMaterial::getF -- subclass responsibility\n";
00241    return errstraintensor;    
00242 }
00243 
00244 const straintensor& NDMaterial::getC(void)
00245 {
00246    opserr << "NDMaterial::getF -- subclass responsibility\n";
00247    return errstraintensor;    
00248 }
00249 
00250 const straintensor& NDMaterial::getFp(void)
00251 {
00252    opserr << "NDMaterial::getFp -- subclass responsibility\n";
00253    return errstraintensor;    
00254 }
00255 // Only For Large Deformation, END////////////////////////////
00256 
00257 const Tensor &
00258 NDMaterial::getTangentTensor(void)
00259 {
00260    opserr << "NDMaterial::getTangentTensor -- subclass responsibility\n";
00261    return errTensor;    
00262 }
00263 
00264 const stresstensor& NDMaterial::getStressTensor(void)
00265 {
00266    opserr << "NDMaterial::getStressTensor -- subclass responsibility\n";
00267    return errstresstensor;    
00268 }
00269 
00270 const straintensor& NDMaterial::getStrainTensor(void)
00271 {
00272    opserr << "NDMaterial::getStrainTensor -- subclass responsibility\n";
00273    return errstraintensor;    
00274 }
00275 
00276 const straintensor& NDMaterial::getPlasticStrainTensor(void)
00277 {
00278    opserr << "NDMaterial::getPlasticStrainTensor -- subclass responsibility\n";
00279    return errstraintensor;    
00280 }
00281 
00282 
00283 //const Tensor &
00284 //NDMaterial::getStrainTensor(void)
00285 //{
00286 //   opserr << "NDMaterial::getStrainTensor -- subclass responsibility\n";
00287 //   return errTensor;    
00288 //}
00289 
00290 Response*
00291 NDMaterial::setResponse (const char **argv, int argc, 
00292                          Information &matInfo, OPS_Stream &output)
00293 {
00294   Response *theResponse =0;
00295   const char *matType = this->getType();
00296 
00297   output.tag("NdMaterialOutput");
00298   output.attr("matType",this->getClassType());
00299   output.attr("matTag",this->getTag());
00300 
00301   if (strcmp(argv[0],"stress") == 0 || strcmp(argv[0],"stresses") == 0) {
00302     const Vector &res = this->getStress();
00303     int size = res.Size();
00304     
00305     if ( (strcmp(matType,"PlaneStress") == 0 && size == 3) ||
00306          (strcmp(matType,"PlaneStrain") == 0 && size == 3)) {
00307         output.tag("ResponseType","sigma11");
00308         output.tag("ResponseType","sigma22");
00309         output.tag("ResponseType","sigma12");
00310     } else if (strcmp(matType,"ThreeDimensional") == 0 && size == 6) {
00311         output.tag("ResponseType","sigma11");
00312         output.tag("ResponseType","sigma22");
00313         output.tag("ResponseType","sigma33");
00314         output.tag("ResponseType","sigma12");
00315         output.tag("ResponseType","sigma13");
00316         output.tag("ResponseType","sigma23");
00317     } else {
00318       for (int i=0; i<size; i++) 
00319         output.tag("ResponseType","UnknownStress");
00320       
00321       theResponse =  new MaterialResponse(this, 1, this->getStress());
00322     }
00323   } else if (strcmp(argv[0],"strain") == 0 || strcmp(argv[0],"strains") == 0) {
00324     const Vector &res = this->getStrain();
00325     int size = res.Size();
00326     if ( (strcmp(matType,"PlaneStress") == 0 && size == 3) ||
00327          (strcmp(matType,"PlaneStrain") == 0 && size == 3)) {
00328         output.tag("ResponseType","eta11");
00329         output.tag("ResponseType","eta22");
00330         output.tag("ResponseType","eta12");
00331     } else if (strcmp(matType,"ThreeDimensional") == 0 && size == 6) {
00332         output.tag("ResponseType","eps11");
00333         output.tag("ResponseType","eps22");
00334         output.tag("ResponseType","eps33");
00335         output.tag("ResponseType","eps12");
00336         output.tag("ResponseType","eps13");
00337         output.tag("ResponseType","eps23");
00338     } else {
00339       for (int i=0; i<size; i++) 
00340         output.tag("ResponseType","UnknownStrain");
00341       
00342       theResponse =  new MaterialResponse(this, 1, this->getStress());
00343     }
00344   }
00345 
00346   output.endTag(); // NdMaterialOutput
00347 
00348   return theResponse;
00349 }
00350 
00351 int 
00352 NDMaterial::getResponse (int responseID, Information &matInfo)
00353 {
00354   switch (responseID) {
00355   case 1:
00356     return matInfo.setVector(this->getStress());
00357     
00358   case 2:
00359     return matInfo.setVector(this->getStrain());
00360     
00361   default:
00362     return -1;
00363   }
00364 }
00365 
00366 
00367 
00368 // AddingSensitivity:BEGIN ////////////////////////////////////////
00369 const Vector &
00370 NDMaterial::getStressSensitivity(int gradNumber, bool conditional)
00371 {
00372         static Vector dummy(1);
00373         return dummy;
00374 }
00375 
00376 const Vector &
00377 NDMaterial::getStrainSensitivity(int gradNumber)
00378 {
00379         static Vector dummy(1);
00380         return dummy;
00381 }
00382 
00383 double
00384 NDMaterial::getRhoSensitivity(int gradNumber)
00385 {
00386         return 0.0;
00387 }
00388 
00389 const Matrix &
00390 NDMaterial::getDampTangentSensitivity(int gradNumber)
00391 {
00392         static Matrix dummy(1,1);
00393         return dummy;
00394 }
00395 const Matrix &
00396 NDMaterial::getTangentSensitivity(int gradNumber)
00397 {
00398         static Matrix dummy(1,1);
00399         return dummy;
00400 }
00401 int
00402 NDMaterial::commitSensitivity(Vector & strainSensitivity, int gradNumber, int numGrads)
00403 {
00404         return 0;
00405 }
00406 // AddingSensitivity:END //////////////////////////////////////////
00407 
00408 

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