void Engine::UpdateVoltages(unsigned int startX, unsigned int numX) { unsigned int pos[3]; bool shift[3]; pos[0] = startX; //voltage updates for (unsigned int posX=0; posX<numX; ++posX) { shift[0]=pos[0]; for (pos[1]=0; pos[1]<numLines[1]; ++pos[1]) { shift[1]=pos[1]; for (pos[2]=0; pos[2]<numLines[2]; ++pos[2]) { shift[2]=pos[2]; //do the updates here //for x volt[0][pos[0]][pos[1]][pos[2]] *= Op->vv[0][pos[0]][pos[1]][pos[2]]; volt[0][pos[0]][pos[1]][pos[2]] += Op->vi[0][pos[0]][pos[1]][pos[2]] * ( curr[2][pos[0]][pos[1] ][pos[2] ] - curr[2][pos[0]][pos[1]-shift[1]][pos[2] ] - curr[1][pos[0]][pos[1] ][pos[2] ] + curr[1][pos[0]][pos[1] ][pos[2]-shift[2]] ); //for y volt[1][pos[0]][pos[1]][pos[2]] *= Op->vv[1][pos[0]][pos[1]][pos[2]]; volt[1][pos[0]][pos[1]][pos[2]] += Op->vi[1][pos[0]][pos[1]][pos[2]] * ( curr[0][pos[0] ][pos[1]][pos[2] ] - curr[0][pos[0] ][pos[1]][pos[2]-shift[2]] - curr[2][pos[0] ][pos[1]][pos[2] ] + curr[2][pos[0]-shift[0]][pos[1]][pos[2] ] ); //for z volt[2][pos[0]][pos[1]][pos[2]] *= Op->vv[2][pos[0]][pos[1]][pos[2]]; volt[2][pos[0]][pos[1]][pos[2]] += Op->vi[2][pos[0]][pos[1]][pos[2]] * ( curr[1][pos[0] ][pos[1] ][pos[2]] - curr[1][pos[0]-shift[0]][pos[1] ][pos[2]] - curr[0][pos[0] ][pos[1] ][pos[2]] + curr[0][pos[0] ][pos[1]-shift[1]][pos[2]] ); } } ++pos[0]; } }
https://misskey-taube.s3.wasabisys.com/files/3ad13c34-a61a-4d75-b07d-f88d415e3cae.png