Computational Physics - Department of Physics

(Axel Boer) #1

6.7 A vector and matrix class 203


template
inline constT& Array::operator()(inti,intj)const {
#ifCHECKBOUNDS_ON
indexOk(i,j);
#endif
returndata[i + j*dx1];
}


template
inline constT& Array::operator()(inti,intj,intk)const {
#ifCHECKBOUNDS_ON
indexOk(i,j,k);
#endif
returndata[i + jdx1 + kdx2];
}


template
inline constT& Array::operator()(inti,intj,intk,intl)const {
#ifCHECKBOUNDS_ON
indexOk(i,j,k,l);
#endif
returndata[i + jdx1 + kdx2 + l*dx3];
}


template
inline constT& Array::operator()(inti,intj,intk,intl,intm)const {
#ifCHECKBOUNDS_ON
indexOk(i,j,k,l, m);
#endif
returndata[i + jdx1 + kdx2 + ldx3 + mdx4];
}


template
inline constT& Array::operator()(inti,intj,intk,intl,intm,intn)const {
#ifCHECKBOUNDS_ON
indexOk(i,j,k,l,m,n);
#endif
returndata[i + jdx1 + kdx2 + ldx3 + mdx4 + n*dx5];
}


template
inlineT& Array::operator()(inti){
#ifCHECKBOUNDS_ON
indexOk(i);
#endif
returndata[i];
}


template
inlineT& Array::operator()(inti,intj){
#ifCHECKBOUNDS_ON
indexOk(i,j);

Free download pdf