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 #include <SectionForceDeformation.h>
00037 #include <Information.h>
00038 #include <Matrix.h>
00039 #include <Vector.h>
00040 #include <MaterialResponse.h>
00041
00042 #include <string.h>
00043
00044 double invert2by2Matrix(const Matrix &a, Matrix &b);
00045 double invert3by3Matrix(const Matrix &a, Matrix &b);
00046 void invertMatrix(int n, const Matrix &a, Matrix &b);
00047
00048 SectionForceDeformation::SectionForceDeformation(int tag, int classTag)
00049 :Material(tag,classTag), fDefault(0)
00050 {
00051
00052 }
00053
00054 SectionForceDeformation::~SectionForceDeformation()
00055 {
00056 if (fDefault != 0)
00057 delete fDefault;
00058 }
00059
00060 const Matrix&
00061 SectionForceDeformation::getSectionFlexibility ()
00062 {
00063 int order = this->getOrder();
00064
00065 if (fDefault == 0) {
00066 fDefault = new Matrix(order,order);
00067 if (fDefault == 0)
00068 g3ErrorHandler->fatal("%s -- failed to allocate flexibility matrix",
00069 "SectionForceDeformation::getSectionFlexibility");
00070 }
00071
00072 const Matrix &k = this->getSectionTangent();
00073
00074 switch(order) {
00075 case 1:
00076 if (k(0,0) != 0.0)
00077 (*fDefault)(0,0) = 1.0/k(0,0);
00078 break;
00079
00080
00081
00082
00083
00084
00085
00086
00087 default:
00088 invertMatrix(order,k,*fDefault);
00089 break;
00090 }
00091
00092 return *fDefault;
00093 }
00094
00095 double
00096 SectionForceDeformation::getRho(void)
00097 {
00098 return 0.0 ;
00099 }
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154 Response*
00155 SectionForceDeformation::setResponse(char **argv, int argc, Information §Info)
00156 {
00157
00158 if (strcmp(argv[0],"deformations") == 0 || strcmp(argv[0],"deformation") == 0)
00159 return new MaterialResponse(this, 1, this->getSectionDeformation());
00160
00161
00162 else if (strcmp(argv[0],"forces") == 0 || strcmp(argv[0],"force") == 0)
00163 return new MaterialResponse(this, 2, this->getStressResultant());
00164
00165
00166 else if (strcmp(argv[0],"stiff") == 0 || strcmp(argv[0],"stiffness") == 0)
00167 return new MaterialResponse(this, 3, this->getSectionTangent());
00168
00169 else
00170 return 0;
00171 }
00172
00173 int
00174 SectionForceDeformation::getResponse(int responseID, Information &secInfo)
00175 {
00176 switch (responseID) {
00177 case 1:
00178 return secInfo.setVector(this->getSectionDeformation());
00179
00180 case 2:
00181 return secInfo.setVector(this->getStressResultant());
00182
00183 case 3:
00184 return secInfo.setMatrix(this->getSectionTangent());
00185
00186 default:
00187 return -1;
00188 }
00189 }