00001
00002
00004
00005 #include "YS_Evolution.h"
00006
00007 Vector YS_Evolution::crd1(1);
00008 Vector YS_Evolution::crd2(2);
00009 Vector YS_Evolution::crd3(3);
00010
00012
00014
00015 YS_Evolution::YS_Evolution(int tag, int classtag,
00016 double iso_ratio, double kin_ratio,
00017 int _dimension,
00018 double shr_iso, double shr_kin)
00019 :TaggedObject(tag), MovableObject(classtag),
00020 isotropicRatio(iso_ratio), kinematicRatio(kin_ratio),
00021 isotropicRatio_orig(iso_ratio), kinematicRatio_orig(kin_ratio),
00022 dimension(_dimension), deformable(false),
00023 translate_hist(_dimension), translate(_dimension), translate_init(_dimension),
00024 isotropicFactor(_dimension), isotropicFactor_hist(_dimension),
00025 isotropicRatio_shrink(shr_iso), kinematicRatio_shrink(shr_kin),
00026 freezeEvolution(false)
00027 {
00028
00029
00030
00031
00032
00033
00034 translate.Zero();
00035 translate_hist.Zero();
00036 translate_init.Zero();
00037
00038
00039 for(int i=0; i<dimension;i++)
00040 {
00041 isotropicFactor(i)=1;
00042 isotropicFactor_hist(i)=1;
00043 }
00044 }
00045
00046 YS_Evolution::~YS_Evolution()
00047 {
00048 }
00049
00050 void YS_Evolution::setInitTranslation(Vector &initTranslate)
00051 {
00052 if(initTranslate.Size() > dimension)
00053 {
00054 opserr << "WARNING - newTranslate" << initTranslate << " outside the dimensions\n";
00055 }
00056
00057 translate = initTranslate;
00058 translate_hist = initTranslate;
00059 translate_init = initTranslate;
00060 }
00061
00062 const Vector &YS_Evolution::getInitTranslation(void)
00063 {
00064 return translate_init;
00065 }
00066
00067
00068 int YS_Evolution::update(int flag)
00069 {
00070
00071 return 0;
00072 }
00073
00074 void YS_Evolution::setResidual(double res)
00075 {
00076
00077 }
00078
00079
00080 int YS_Evolution::commitState()
00081 {
00082 isotropicFactor_hist = isotropicFactor;
00083 translate_hist = translate;
00084 return 0;
00085 }
00086
00087 int YS_Evolution::revertToLastCommit(void)
00088 {
00089 isotropicFactor = isotropicFactor_hist;
00090 translate = translate_hist;
00091 return 0;
00092 }
00093
00094 void YS_Evolution::toDeformedCoord(Vector &coord)
00095 {
00096
00097
00098
00099
00100
00101
00102
00103
00104 for(int i=0; i< coord.Size(); i++)
00105 {
00106 coord(i) = coord(i)*isotropicFactor(i) + translate(i);
00107 }
00108
00109 }
00110
00111 void YS_Evolution::toOriginalCoord(Vector &coord)
00112 {
00113 for(int i=0; i< coord.Size(); i++)
00114 {
00115 double notrans = coord(i) - translate(i);
00116 coord(i) = notrans/isotropicFactor(i);
00117 }
00118
00119 }
00120
00121 void YS_Evolution::toDeformedCoord(double &x)
00122 {
00123
00124 crd1(0) = x;
00125 this->toDeformedCoord(crd1);
00126 x = crd1(0);
00127 }
00128
00129 void YS_Evolution::toDeformedCoord(double &x, double &y)
00130 {
00131
00132 crd2(0) = x;
00133 crd2(1) = y;
00134 this->toDeformedCoord(crd2);
00135 x = crd2(0);
00136 y = crd2(1);
00137 }
00138
00139 void YS_Evolution::toDeformedCoord(double &x, double &y, double &z)
00140 {
00141
00142 crd3(0) = x;
00143 crd3(1) = y;
00144 crd3(2) = z;
00145 this->toDeformedCoord(crd3);
00146 x = crd3(0);
00147 y = crd3(1);
00148 z = crd3(2);
00149
00150 }
00151
00152 void YS_Evolution::toOriginalCoord(double &x)
00153 {
00154
00155 crd1(0) = x;
00156 this->toOriginalCoord(crd1);
00157 x = crd1(0);
00158
00159 }
00160
00161 void YS_Evolution::toOriginalCoord(double &x, double &y)
00162 {
00163
00164 crd2(0) = x;
00165 crd2(1) = y;
00166 this->toOriginalCoord(crd2);
00167 x = crd2(0);
00168 y = crd2(1);
00169 }
00170
00171 void YS_Evolution::toOriginalCoord(double &x, double &y, double &z)
00172 {
00173
00174 crd3(0) = x;
00175 crd3(1) = y;
00176 crd3(2) = z;
00177 this->toOriginalCoord(crd3);
00178 x = crd3(0);
00179 y = crd3(1);
00180 z = crd3(2);
00181
00182 }
00183
00184 double YS_Evolution::getCommitTranslation(int dir)
00185 {
00186 #ifdef _G3DEBUG
00187 checkDimension(dir);
00188 #endif
00189
00190 return translate_hist(dir);
00191 }
00192
00193 double YS_Evolution::getTrialTranslation(int dir)
00194 {
00195 #ifdef _G3DEBUG
00196 checkDimension(dir);
00197 #endif
00198
00199 return translate(dir);
00200 }
00201
00202 double YS_Evolution::getCommitIsotropicFactor(int dir)
00203 {
00204 return isotropicFactor_hist(dir);
00205 }
00206
00207 double YS_Evolution::getTrialIsotropicFactor(int dir)
00208 {
00209 return isotropicFactor(dir);
00210 }
00211
00212 void YS_Evolution::checkDimension(int dir)
00213 {
00214 if(dir < 0 || dir >= dimension)
00215 {
00216 opserr << "WARNING - Direction " << dir << " outside the dimensions\n";
00217 }
00218
00219 }
00220
00221 void YS_Evolution::setDeformable(bool defo)
00222 {
00223 this->deformable = defo;
00224 }
00225
00226 void YS_Evolution::Print(OPS_Stream &s, int flag)
00227 {
00228 opserr << " YS_Evolution - tag = " << getTag() << endln;
00229 }
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239