YieldSurface_BC.cpp

Go to the documentation of this file.
00001 // YieldSurface_BC.cpp: implementation of the YieldSurface_BC class.
00002 //
00004 
00005 #include "YieldSurface_BC.h"
00006 #include <stdlib.h>
00007 
00008 
00009 const int YieldSurface_BC::dFReturn(0);
00010 const int YieldSurface_BC::RadialReturn(1);
00011 const int YieldSurface_BC::ConstantXReturn(2);
00012 const int YieldSurface_BC::ConstantYReturn(3);
00013 const int YieldSurface_BC::NoFP(4);
00014 const int YieldSurface_BC::SurfOnly(5);
00015 const int YieldSurface_BC::StateLoading(6);
00016 
00018 // Construction/Destruction
00020 
00021 YieldSurface_BC::YieldSurface_BC(int tag, int classtag, YS_Evolution &model,
00022                                                                 double capx)
00023 :TaggedObject(tag), MovableObject(classtag), capX(capx), capY(-1.0), capZ(-1.0),
00024  capY_orig(-1.0), capZ_orig(-1.0), isLoading(true), ele_Tag(-1), ele_Location(-1)
00025 {
00026    dimension = 1;
00027    hModel = model.getCopy();
00028    theView = 0;
00029    T = 0;
00030    S = 0;
00031    capX_orig = capx;
00032    ele_Location  =-1;
00033    ele_Tag = -1;
00034 
00035 }
00036 
00037 
00038 // el-tawil unsym .. and probably others
00039 // cause problem by sending 0, 0 to the base class constructor
00040 // => tighly coupled - bad practice.
00041 // Since that is necessary... be aware
00042 YieldSurface_BC::YieldSurface_BC(int tag, int classtag, YS_Evolution &model,
00043                                                                 double capx, double capy)
00044 :TaggedObject(tag), MovableObject(classtag), capX(capx), capY(capy), capZ(-1.0), capZ_orig(-1),
00045 isLoading(true), ele_Tag(-1), ele_Location(-1)
00046 
00047 {
00048    dimension = 2;
00049    hModel = model.getCopy();
00050    theView = 0;
00051    T = 0;
00052    S = 0;
00053    capX_orig = capx;
00054    capY_orig = capy;
00055    capXdim = capX_orig;
00056    capYdim = capY_orig;
00057    ele_Location  =-1;
00058    ele_Tag = -1;   
00059 }
00060 
00061 
00062 YieldSurface_BC::YieldSurface_BC(int tag, int classtag, YS_Evolution &model,
00063                                                                 double capx, double capy, double capz)
00064 :TaggedObject(tag), MovableObject(classtag), capX(capx), capY(capy), capZ(capz),
00065  isLoading(true), ele_Tag(-1), ele_Location(-1)
00066 {
00067    dimension = 3;
00068    hModel = model.getCopy();
00069    theView = 0;
00070    T = 0;
00071    S = 0;
00072    capX_orig = capX;
00073    capY_orig = capY;
00074    capZ_orig = capZ;
00075    ele_Location  =-1;
00076    ele_Tag = -1;
00077 }
00078 
00079 
00080 YieldSurface_BC::~YieldSurface_BC()
00081 {
00082     if(T!=0) delete T;
00083     if(S!=0) delete S;
00084 
00085     if (hModel != 0)
00086       delete hModel;
00087 }
00088 
00089 int YieldSurface_BC::commitState(Vector &force)
00090 {
00091 //      return 0;
00092         
00093         if(dimension == 1)
00094         {
00095                 capXdim = capX_orig*hModel->getTrialIsotropicFactor(0);
00096         }
00097         else if(dimension == 2)
00098         {
00099                 capXdim = capX_orig*hModel->getTrialIsotropicFactor(0);
00100                 capYdim = capY_orig*hModel->getTrialIsotropicFactor(1);
00101         }
00102         else if(dimension == 3)
00103         {
00104                 capXdim = capX_orig*hModel->getTrialIsotropicFactor(0);
00105                 capYdim = capY_orig*hModel->getTrialIsotropicFactor(1);
00106                 capZdim = capZ_orig*hModel->getTrialIsotropicFactor(2);
00107         }
00108         else
00109                 opserr << "WARNING  YieldSurface_BC::commitState - dimension > 3 || < 1\n";
00110     return 0;
00111 }
00112 
00113 
00114 double YieldSurface_BC::getCap(int dir)
00115 {
00116         if(dir == 0)
00117                 return capX;
00118         else if(dir == 1)
00119                 return capY;
00120         else if(dir == 2)
00121                 return capZ;
00122         else
00123                 opserr << "YieldSurface_BC::getCap(int dir) - dir not valid\n";
00124 
00125     return 1;
00126 }
00127 
00128 
00129 double YieldSurface_BC::getDrift(double x1)
00130 {
00131         opserr << "YieldSurface_BC::getDrift(.) - This method should not be called\n";
00132         return 0;
00133 }
00134 
00135 double YieldSurface_BC::getDrift(double x1, double y1)
00136 {
00137         opserr << "YieldSurface_BC::getDrift(..) - This method should not be called\n";
00138         return 0;
00139 }
00140 
00141 
00142 double YieldSurface_BC::getDrift(double x1, double y1, double z1)
00143 {
00144         opserr << "YieldSurface_BC::getDrift(...) - This method should not be called\n";
00145         return 0;
00146 }
00147 
00148 
00149 double YieldSurface_BC::interpolate(double x1, double x2)
00150 {
00151         opserr << "YieldSurface_BC::interpolate(..)  - This method should not be called\n";
00152         return 0;
00153 }
00154 
00155 double YieldSurface_BC::interpolate(double x1, double y1, double x2, double y2)
00156 {
00157         opserr << "YieldSurface_BC::interpolate(....)  - This method should not be called\n";
00158         return 0;
00159 }
00160 double YieldSurface_BC::interpolate(double x1, double y1, double z1, double x2, double y2, double z2)
00161 {
00162         opserr << "YieldSurface_BC::interpolate(......)  - This method should not be called\n";
00163         return 0;
00164 }
00165 
00166 
00167 void YieldSurface_BC::setEleInfo(int tag, int loc)
00168 {
00169         ele_Tag = tag;
00170         ele_Location = loc;
00171 }
00172 
00174 // Set Transformation
00176 
00177 void YieldSurface_BC::setTransformation(int xDof, int xFact)
00178 {
00179     if(T || S)
00180     {
00181         opserr << "WARNING - YieldSurface_BC::setTransformation(int xDof)\n";
00182         opserr << "Transforation already set\n";
00183         return;
00184     }
00185     T = new ID(1);
00186     (*T)(0) = xDof;
00187 
00188     S = new ID(1);
00189     (*S)(0) = xFact;
00190 
00191 }
00192 
00193 void YieldSurface_BC::setTransformation(int xDof, int yDof, int xFact, int yFact)
00194 {
00195     if(T || S)
00196     {
00197         opserr << "WARNING - YieldSurface_BC::setTransformation(int xDof, int yDof)\n";
00198         opserr << "Transforation already set\n";
00199         return;
00200     }
00201 
00202     T = new ID(2);
00203     (*T)(0) = xDof;
00204     (*T)(1) = yDof;
00205 
00206     S = new ID(2);
00207     (*S)(0) = xFact;
00208     (*S)(1) = yFact;
00209 
00210 //      opserr << " T = " << *T << "\n, S = " << *S;
00211 }
00212 
00213 void YieldSurface_BC::setTransformation(int xDof, int yDof, int zDof,
00214                                        int xFact, int yFact, int zFact)
00215 {
00216     if(T || S)
00217     {
00218         opserr << "WARNING - YieldSurface_BC::setTransformation(int xDof, int yDof, int zDof)\n";
00219         opserr << "Transforation already set\n";
00220         return;
00221     }
00222 
00223     T = new ID(3);
00224     (*T)(0) = xDof;
00225     (*T)(1) = yDof;
00226     (*T)(2) = zDof;
00227 
00228     S = new ID(3);
00229     (*S)(0) = xFact;
00230     (*S)(1) = yFact;
00231     (*S)(2) = zFact;
00232 }
00233 
00235 // Transform to Local System
00237 
00238 
00239 void YieldSurface_BC::toLocalSystem (Vector &eleVector, double &x, bool nonDimensionalize, bool signMult)
00240 {
00241     if(!T)
00242     {
00243         checkT();
00244         return;
00245     }
00246 
00247 #ifdef _G3DEBUG
00248     if(T->Size() != 1)
00249     {
00250         opserr << "WARNING: YieldSurface_BC::toLocalSystem (Vector &eleVector, double &x)\n";
00251         opserr << "T size may not be correct\n";
00252     }
00253 #endif
00254         if(signMult==false)
00255                 x = eleVector((*T)(0));
00256         else
00257         x = eleVector((*T)(0))*((*S)(0));
00258         if (nonDimensionalize)
00259         x = x/capX;
00260 }
00261 
00262 void YieldSurface_BC::toLocalSystem (Vector &eleVector, double &x, double &y,
00263                                     bool nonDimensionalize, bool signMult)
00264 {
00265     if(!T)
00266     {
00267         checkT();
00268         return;
00269     }
00270 
00271 #ifdef _G3DEBUG
00272     if(T->Size() != 2)
00273     {
00274         opserr << "WARNING: YieldSurface_BC::toLocalSystem (Vector &eleVector, double &x, double &y)\n";
00275         opserr << "T size may not be correct\n";
00276     }
00277 #endif
00278 
00279         if(signMult==false)
00280         {
00281                 x = eleVector((*T)(0));
00282                 y = eleVector((*T)(1));
00283         }
00284         else
00285         {
00286         x = eleVector((*T)(0))*((*S)(0));
00287         y = eleVector((*T)(1))*((*S)(1));
00288         }
00289 
00290         if (nonDimensionalize)
00291         {
00292                 x = x/capX;
00293                 y = y/capY;
00294         }
00295 }
00296 
00297 void YieldSurface_BC::toLocalSystem (Vector &eleVector, double &x, double &y, double &z,
00298                                     bool nonDimensionalize, bool signMult)
00299 {
00300     if(!T)
00301     {
00302         checkT();
00303         return;
00304     }
00305 
00306 #ifdef _G3DEBUG
00307     if(T->Size() != 3)
00308     {
00309         opserr << "WARNING: YieldSurface_BC::toLocalSystem (Vector &eleVector, double &x, double &y, double &z)\n";
00310         opserr << "T size may not be correct\n";
00311     }
00312 #endif
00313 
00314         if(signMult==false)
00315         {
00316                 x = eleVector((*T)(0));
00317                 y = eleVector((*T)(1));
00318                 z = eleVector((*T)(2));
00319         }
00320         else
00321         {
00322         x = eleVector((*T)(0))*((*S)(0));
00323         y = eleVector((*T)(1))*((*S)(1));
00324         z = eleVector((*T)(2))*((*S)(2));
00325         }
00326 
00327         if (nonDimensionalize)
00328         {
00329                 x = x/capX;
00330                 y = y/capY;
00331                 z = z/capZ;
00332         }
00333 }
00334 
00335 void YieldSurface_BC::toLocalSystem (Matrix &eleMatrix, double &x, bool nonDimensionalize, bool signMult)
00336 {
00337     if(!T)
00338     {
00339         checkT();
00340         return;
00341     }
00342 
00343 #ifdef _G3DEBUG
00344     if(T->Size() != 1)
00345     {
00346         opserr << "WARNING: YieldSurface_BC::toLocalSystem (Matrix &eleMatrix, double &x)\n";
00347         opserr << "T size may not be correct\n";
00348     }
00349     if(eleMatrix.noCols() !=1)
00350     {
00351         opserr << "WARNING: YieldSurface_BC::toLocalSystem (Matrix &eleMatrix, ..)\n";
00352         opserr << "Matrix columns should be = 1\n";
00353     }
00354 #endif
00355 
00356         if(signMult==false)
00357         {
00358                 x = eleMatrix((*T)(0),0);
00359         }
00360         else
00361         {
00362         x = eleMatrix((*T)(0), 0)*((*S)(0));
00363         }
00364         if (nonDimensionalize)
00365         {
00366                 x = x/capX;
00367         }
00368 }
00369 
00370 void YieldSurface_BC::toLocalSystem (Matrix &eleMatrix, double &x, double &y,
00371                                     bool nonDimensionalize, bool signMult)
00372 {
00373     if(!T)
00374     {
00375         checkT();
00376         return;
00377     }
00378 
00379 #ifdef _G3DEBUG
00380     if(T->Size() != 2)
00381     {
00382         opserr << "WARNING: YieldSurface_BC::toLocalSystem (Vector &eleVector, double &x, double &y)\n";
00383         opserr << "T size may not be correct\n";
00384     }
00385     if(eleMatrix.noCols() !=1)
00386     {
00387         opserr << "WARNING: YieldSurface_BC::toLocalSystem (Matrix &eleMatrix, ..)\n";
00388         opserr << "Matrix columns should be = 1\n";
00389     }
00390 #endif
00391 
00392         if(signMult==false)
00393         {
00394                 x = eleMatrix((*T)(0),0);
00395                 y = eleMatrix((*T)(1),0);
00396         }
00397         else
00398         {
00399         x = eleMatrix((*T)(0), 0)*((*S)(0));
00400         y = eleMatrix((*T)(1), 0)*((*S)(1));
00401         }
00402 
00403         if (nonDimensionalize)
00404         {
00405                 x = x/capX;
00406                 y = y/capY;
00407         }
00408 }
00409 
00410 void YieldSurface_BC::toLocalSystem (Matrix &eleMatrix, double &x, double &y, double &z,
00411                                     bool nonDimensionalize, bool signMult)
00412 {
00413     if(!T)
00414     {
00415         checkT();
00416         return;
00417     }
00418 
00419 #ifdef _G3DEBUG
00420     if(T->Size() != 3)
00421     {
00422         opserr << "WARNING: YieldSurface_BC::toLocalSystem (Vector &eleVector, double &x, double &y, double &z)\n";
00423         opserr << "T size may not be correct\n";
00424     }
00425     if(eleMatrix.noCols() !=1)
00426     {
00427         opserr << "WARNING: YieldSurface_BC::toLocalSystem (Matrix &eleMatrix, ..)\n";
00428         opserr << "Matrix columns should be = 1\n";
00429     }
00430 #endif
00431 
00432         if(signMult==false)
00433         {
00434                 x = eleMatrix((*T)(0),0);
00435                 y = eleMatrix((*T)(1),0);
00436                 z = eleMatrix((*T)(2),0);
00437         }
00438         else
00439         {
00440         x = eleMatrix((*T)(0), 0)*((*S)(0));
00441         y = eleMatrix((*T)(1), 0)*((*S)(1));
00442         z = eleMatrix((*T)(2), 0)*((*S)(2));
00443         }
00444 
00445         if (nonDimensionalize)
00446         {
00447                 x = x/capX;
00448                 y = y/capY;
00449                 z = z/capZ;
00450         }
00451 }
00452 
00454 // Transform to Element Syatem
00456 
00457 void YieldSurface_BC::toElementSystem(Vector &eleVector, double &x, bool dimensionalize, bool signMult)
00458 {
00459     if(!T)
00460     {
00461         checkT();
00462         return;
00463     }
00464 
00465 #ifdef _G3DEBUG
00466     if(T->Size() != 1)
00467     {
00468         opserr << "WARNING: YieldSurface_BC::toElementSystem (Vector &eleVector, .. \n";
00469         opserr << "T size may not be correct\n";
00470     }
00471 #endif
00472 
00473 double x1 = x;
00474         if(dimensionalize)
00475         {
00476                 x1 = x*capX;
00477         }
00478         if(signMult==false)
00479         {
00480                 eleVector((*T)(0)) = x1;
00481         }
00482         else
00483         eleVector((*T)(0)) = x1*((*S)(0));
00484 
00485 }
00486 
00487 void YieldSurface_BC::toElementSystem(Vector &eleVector, double &x, double &y,
00488                                      bool dimensionalize, bool signMult)
00489 {
00490     if(!T)
00491     {
00492         checkT();
00493         return;
00494     }
00495 
00496 #ifdef _G3DEBUG
00497     if(T->Size() != 2)
00498     {
00499         opserr << "WARNING: YieldSurface_BC::toElementSystem (Vector &eleVector, .. \n";
00500         opserr << "T size may not be correct\n";
00501     }
00502 #endif
00503 
00504 double x1 = x, y1 = y;
00505         if(dimensionalize)
00506         {
00507                 x1 = x*capX;
00508                 y1 = y*capY;
00509         }
00510         if(signMult==false)
00511         {
00512                 eleVector((*T)(0)) = x1;
00513                 eleVector((*T)(1)) = y1;
00514         }
00515         else
00516         {
00517         eleVector((*T)(0)) = x1*((*S)(0));
00518         eleVector((*T)(1)) = y1*((*S)(1));
00519         }
00520 
00521 }
00522 
00523 void YieldSurface_BC::toElementSystem(Vector &eleVector, double &x, double &y, double &z,
00524                                      bool dimensionalize, bool signMult)
00525 {
00526     if(!T)
00527     {
00528         checkT();
00529         return;
00530     }
00531 
00532 #ifdef _G3DEBUG
00533     if(T->Size() != 3)
00534     {
00535         opserr << "WARNING: YieldSurface_BC::toElementSystem (Vector &eleVector, .. \n";
00536         opserr << "T size may not be correct\n";
00537     }
00538 #endif
00539 
00540 double x1 = x, y1 = y, z1= z;
00541         if(dimensionalize)
00542         {
00543                 x1 = x*capX;
00544                 y1 = y*capY;
00545                 z1 = z*capZ;
00546         }
00547         if(signMult==false)
00548         {
00549                 eleVector((*T)(0)) = x1;
00550                 eleVector((*T)(1)) = y1;
00551                 eleVector((*T)(2)) = z1;
00552         }
00553         else
00554         {
00555         eleVector((*T)(0)) = x1*((*S)(0));
00556         eleVector((*T)(1)) = y1*((*S)(1));
00557         eleVector((*T)(2)) = z1*((*S)(2));
00558         }
00559 }
00560 
00561 void YieldSurface_BC::toElementSystem(Matrix &eleMatrix, double &x, bool dimensionalize, bool signMult)
00562 {
00563     if(!T)
00564     {
00565         checkT();
00566         return;
00567     }
00568 
00569 #ifdef _G3DEBUG
00570     if(T->Size() != 1)
00571     {
00572         opserr << "WARNING: YieldSurface_BC::toElementSystem (Matrix &eleMatrix, .. \n";
00573         opserr << "T size may not be correct\n";
00574     }
00575     if(eleMatrix.noCols() != 1)
00576     {
00577         opserr << "WARNING: YieldSurface_BC::toElementSystem (Matrix &eleMatrix, .. \n";
00578         opserr << "eleMatrix columns not equal to 1\n";
00579     }
00580 #endif
00581 
00582 double x1 = x;
00583         if(dimensionalize)
00584         {
00585                 x1 = x*capX;
00586         }
00587 
00588         if(signMult==false)
00589         {
00590                 eleMatrix((*T)(0),0) = x1;
00591         }
00592         else
00593         {
00594                 eleMatrix((*T)(0),0) = x1*((*S)(0));
00595         }
00596 
00597 }
00598 
00599 void YieldSurface_BC::toElementSystem(Matrix &eleMatrix, double &x, double &y,
00600                                      bool dimensionalize, bool signMult)
00601 {
00602     if(!T)
00603     {
00604         checkT();
00605         return;
00606     }
00607 
00608 #ifdef _G3DEBUG
00609     if(T->Size() != 2)
00610     {
00611         opserr << "WARNING: YieldSurface_BC::toElementSystem (Matrix &eleMatrix, .. \n";
00612         opserr << "T size may not be correct\n";
00613     }
00614     if(eleMatrix.noCols() != 1)
00615     {
00616         opserr << "WARNING: YieldSurface_BC::toElementSystem (Matrix &eleMatrix, .. \n";
00617         opserr << "eleMatrix columns not equal to 1\n";
00618     }
00619 #endif
00620 
00621 double x1 = x, y1 = y;
00622         if(dimensionalize)
00623         {
00624                 x1 = x*capX;
00625                 y1 = y*capY;
00626         }
00627         if(signMult==false)
00628         {
00629                 eleMatrix((*T)(0),0) = x1;
00630                 eleMatrix((*T)(1),0) = y1;
00631         }
00632         else
00633         {
00634                 eleMatrix((*T)(0),0) = x1*((*S)(0));
00635         eleMatrix((*T)(1),0) = y1*((*S)(1));
00636         }
00637 
00638 
00639 }
00640 
00641 
00642 void YieldSurface_BC::toElementSystem(Matrix &eleMatrix, double &x, double &y, double &z,
00643                                      bool dimensionalize, bool signMult)
00644 {
00645     if(!T)
00646     {
00647         checkT();
00648         return;
00649     }
00650 
00651 #ifdef _G3DEBUG
00652     if(T->Size() != 3)
00653     {
00654         opserr << "WARNING: YieldSurface_BC::toElementSystem (Matrix &eleMatrix, .. \n";
00655         opserr << "T size may not be correct\n";
00656     }
00657     if(eleMatrix.noCols() != 1)
00658     {
00659         opserr << "WARNING: YieldSurface_BC::toElementSystem (Matrix &eleMatrix, .. \n";
00660         opserr << "eleMatrix columns not equal to 1\n";
00661     }
00662 #endif
00663 
00664 double x1 = x, y1 = y, z1 = z;
00665         if(dimensionalize)
00666         {
00667                 x1 = x*capX;
00668                 y1 = y*capY;
00669                 z1 = z*capZ;
00670         }
00671         if(signMult==false)
00672         {
00673                 eleMatrix((*T)(0),0) = x1;
00674                 eleMatrix((*T)(1),0) = y1;
00675                 eleMatrix((*T)(2),0) = z1;
00676         }
00677         else
00678         {
00679                 eleMatrix((*T)(0),0) = x1*((*S)(0));
00680         eleMatrix((*T)(1),0) = y1*((*S)(1));
00681         eleMatrix((*T)(2),0) = z1*((*S)(2));
00682         }
00683 
00684 }
00685 
00686 int YieldSurface_BC::checkT(void)
00687 {
00688     if(!T)
00689     {
00690         opserr << "FATAL: YieldSurface_BC::checkT(void)\n";
00691         opserr << "T = null, use setTransformation(..) after the YS object is created\n";
00692         opserr << "\a";
00693         return 0;
00694     }
00695     return 1;
00696 }
00697 
00699 // Other
00701 
00702 void YieldSurface_BC::setView(Renderer *theRenderer)
00703 {
00704         theView = theRenderer;
00705 }
00706 
00707 int YieldSurface_BC::displaySelf(Renderer &theViewer, int displayMode, float fact)
00708 {
00709 
00710         return -1;
00711 }
00712 
00713 int     YieldSurface_BC::displayForcePoint(Vector &force, int color)
00714 {
00715         return -1;
00716 }
00717 
00718 int YieldSurface_BC::update(int flag)
00719 {
00720         return 0;
00721 }
00722 
00723 void YieldSurface_BC::Print(OPS_Stream &s, int flag)
00724 {
00725         s << "YieldSurface_BC - tag = " << this->getTag() << endln;
00726         s << "Element Info:\n";
00727         s << "Element Tag = " << ele_Tag << "\t Location = " << ele_Location << endln;
00728         s << "-----------------------------------------" << endln;
00729 }
00730 
00731 // friend OPS_Stream &operator<<(OPS_Stream &s, const YieldSurface_BC &ys)
00732 //      A function is defined to allow user to print the vectors using OPS_Streams.
00733 /* // Already defined in TaggedObject
00734 OPS_Stream &operator<<(OPS_Stream &s, const YieldSurface_BC &ys)
00735 {
00736         ys.Print(s);
00737   return s;
00738 }
00739 */

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