Changeset 5625 for issm/trunk/src/c/objects/Elements/TriaRef.cpp
- Timestamp:
- 08/30/10 17:01:51 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/TriaRef.cpp
r4921 r5625 180 180 } 181 181 /*}}}*/ 182 /*FUNCTION TriaRef::GetL {{{1*/182 /*FUNCTION TriaRef::GetL(double* L, double* xyz_list, double* gauss,int numdof) {{{1*/ 183 183 void TriaRef::GetL(double* L, double* xyz_list, double* gauss,int numdof){ 184 184 /*Compute L matrix. L=[L1 L2 L3] where Li is square and of size numdof. … … 221 221 } 222 222 /*}}}*/ 223 /*FUNCTION TriaRef::GetJacobian {{{1*/ 223 /*FUNCTION TriaRef::GetL(double* L, double* xyz_list,GaussTria* gauss,int numdof) {{{1*/ 224 void TriaRef::GetL(double* L, double* xyz_list,GaussTria* gauss,int numdof){ 225 /*Compute L matrix. L=[L1 L2 L3] where Li is square and of size numdof. 226 * For grid i, Li can be expressed in the actual coordinate system 227 * by: 228 * numdof=1: 229 * Li=h; 230 * numdof=2: 231 * Li=[ h 0 ] 232 * [ 0 h ] 233 * where h is the interpolation function for grid i. 234 * 235 * We assume L has been allocated already, of size: numgrids (numdof=1), or numdofx(numdof*numgrids) (numdof=2) 236 */ 237 238 int i; 239 const int NDOF2=2; 240 const int numgrids=3; 241 double l1l2l3[3]; 242 243 /*Get l1l2l3 in actual coordinate system: */ 244 GetNodalFunctions(l1l2l3,gauss); 245 246 /*Build L: */ 247 if(numdof==1){ 248 for (i=0;i<numgrids;i++){ 249 L[i]=l1l2l3[i]; 250 } 251 } 252 else{ 253 for (i=0;i<numgrids;i++){ 254 *(L+numdof*numgrids*0+numdof*i)=l1l2l3[i]; //L[0][NDOF2*i]=dh1dh3[0][i]; 255 *(L+numdof*numgrids*0+numdof*i+1)=0; 256 *(L+numdof*numgrids*1+numdof*i)=0; 257 *(L+numdof*numgrids*1+numdof*i+1)=l1l2l3[i]; 258 } 259 } 260 } 261 /*}}}*/ 262 /*FUNCTION TriaRef::GetJacobian(double* J, double* xyz_list,double* gauss) {{{1*/ 224 263 void TriaRef::GetJacobian(double* J, double* xyz_list,double* gauss){ 225 264 /*The Jacobian is constant over the element, discard the gaussian points. … … 244 283 } 245 284 /*}}}*/ 246 /*FUNCTION TriaRef::GetJacobianDeterminant2d {{{1*/ 285 /*FUNCTION TriaRef::GetJacobian(double* J, double* xyz_list,GaussTria* gauss) {{{1*/ 286 void TriaRef::GetJacobian(double* J, double* xyz_list,GaussTria* gauss){ 287 /*The Jacobian is constant over the element, discard the gaussian points. 288 * J is assumed to have been allocated of size NDOF2xNDOF2.*/ 289 290 const int NDOF2=2; 291 const int numgrids=3; 292 double x1,y1,x2,y2,x3,y3; 293 294 x1=*(xyz_list+numgrids*0+0); 295 y1=*(xyz_list+numgrids*0+1); 296 x2=*(xyz_list+numgrids*1+0); 297 y2=*(xyz_list+numgrids*1+1); 298 x3=*(xyz_list+numgrids*2+0); 299 y3=*(xyz_list+numgrids*2+1); 300 301 302 *(J+NDOF2*0+0)=0.5*(x2-x1); 303 *(J+NDOF2*1+0)=SQRT3/6.0*(2*x3-x1-x2); 304 *(J+NDOF2*0+1)=0.5*(y2-y1); 305 *(J+NDOF2*1+1)=SQRT3/6.0*(2*y3-y1-y2); 306 } 307 /*}}}*/ 308 /*FUNCTION TriaRef::GetJacobianDeterminant2d(double* Jdet, double* xyz_list,double* gauss) {{{1*/ 247 309 void TriaRef::GetJacobianDeterminant2d(double* Jdet, double* xyz_list,double* gauss){ 248 310 311 /*The Jacobian determinant is constant over the element, discard the gaussian points. 312 * J is assumed to have been allocated of size NDOF2xNDOF2.*/ 313 double J[2][2]; 314 315 /*Get Jacobian*/ 316 GetJacobian(&J[0][0],xyz_list,gauss); 317 318 /*Get Determinant*/ 319 Matrix2x2Determinant(Jdet,&J[0][0]); 320 if(*Jdet<0) ISSMERROR("negative jacobian determinant!"); 321 322 } 323 /*}}}*/ 324 /*FUNCTION TriaRef::GetJacobianDeterminant2d(double* Jdet, double* xyz_list,GaussTria* gauss) {{{1*/ 325 void TriaRef::GetJacobianDeterminant2d(double* Jdet, double* xyz_list,GaussTria* gauss){ 249 326 /*The Jacobian determinant is constant over the element, discard the gaussian points. 250 327 * J is assumed to have been allocated of size NDOF2xNDOF2.*/ … … 296 373 } 297 374 /*}}}*/ 298 /*FUNCTION TriaRef::GetNodalFunctions {{{1*/375 /*FUNCTION TriaRef::GetNodalFunctions(double* l1l2l3, double* gauss) {{{1*/ 299 376 void TriaRef::GetNodalFunctions(double* l1l2l3, double* gauss){ 300 377 /*This routine returns the values of the nodal functions at the gaussian point.*/ … … 303 380 l1l2l3[1]=gauss[1]; 304 381 l1l2l3[2]=gauss[2]; 382 383 } 384 /*}}}*/ 385 /*FUNCTION TriaRef::GetNodalFunctions(double* l1l2l3,GaussTria* gauss) {{{1*/ 386 void TriaRef::GetNodalFunctions(double* l1l2l3,GaussTria* gauss){ 387 /*This routine returns the values of the nodal functions at the gaussian point.*/ 388 389 l1l2l3[0]=gauss->coord1; 390 l1l2l3[1]=gauss->coord2; 391 l1l2l3[2]=gauss->coord3; 305 392 306 393 }
Note:
See TracChangeset
for help on using the changeset viewer.