当按摩盒告诉我时,我有问题
exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
at Pla3d_2.Tkmat<Pla3d_2.java:509>
at Pla3d_2.Tkmat<Pla3d_2.java:327>
以下是参考代码的行
第327行
/***Construction and overall stiffness matrix of B Mato (line 326)
Tkmat(xyz,e1,p1,aj,psaig,aji,detjg,detjgg,gbg1,bmat,dep);(327)
/***Introduction of boundary conditions (328)
Fix(nb,n,nband,ix,iy,iz,u,v,w,ib,dtf,ux,uy,uz); (329)
/***Solutions for system of linear equations (330)
和
第509行
static void Tkmat(double xyz[][],double e1[],double p1[],
double aj[][][],double psaig[][][],double aji[][][],double detjg[],
double detjgg[][],double gbg1[][][],double bmat[][],double dep[][]){
int l,l1,l2,l3,l4,l5,ie,je,it,jt,iit,jjt;
double aj11,aj12,aj13,aj21,aj22,aj23,aj31,aj32,aj33,detj,sum;
double gek1[][] = new double[6][nodel*3];
double gek2[][] = new double[nodel*3][nodel*3];
double gekg[][][] = new double[8][nodel*3][nodel*3];
double gek[][] = new double[nodel*3][nodel*3];
//
for(l=0;l<ne;l++){
for(l1=0;l1<nodel;l1++){
lc[3*l1][l] =3*loc[l1][l]-2;
lc[3*l1+1][l]=3*loc[l1][l]-1;
lc[3*l1+2][l]=3*loc[l1][l];
}
for(l1=0;l1<nodel;l1++){
xyz[l1][0]=xx[loc[l1][l]-1]; [line 509]
xyz[l1][1]=yy[loc[l1][l]-1];
xyz[l1][2]=zz[loc[l1][l]-1];
}
for(l2=0;l2<8;l2++){
for(l1=0;l1<3;l1++){
for(l3=0;l3<3;l3++){
aj[l2][l1][l3]=0.0;
for(l4=0;l4<nodel;l4++){
aj[l2][l1][l3]=aj[l2][l1][l3]+psaig[l2][l1][l4]*xyz[l4][l3];
}
}
}
}
任何人都可以帮助我......提前谢谢..: - )
答案 0 :(得分:1)
除了您的代码非常难看并且没有人能够理解正在发生的事情之外,请检查
at Pla3d_2.Tkmat<Pla3d_2.java:509>
堆栈跟踪中的。它告诉你,你正在尝试在509行将一个对象设置为一个数组,但是该数组已经变得超出了大小 - 该数组中没有更多的空间。