Model: Result: fixed colvec access

parent 7d173747
......@@ -18,23 +18,23 @@ void init()
}
void execute()
{
Col<int> counter=Col<int>(n);
Col<int> indexLookup=Col<int>(1);
ivec counter=ivec(n);
ivec indexLookup=ivec(x);
for( auto i=1;i<=n;++i){
counter(i-1, 1-1) = 0;
counter(i-1) = 0;
}
int k = 1;
int maxI = n-1;
for( auto i=1;i<=maxI;++i){
int minJ = i+1;
for( auto j=minJ;j<=n;++j){
counter(i-1, 1-1) = counter(i-1, 1-1)+1;
counter(j-1, 1-1) = counter(j-1, 1-1)+1;
counter(i-1) = counter(i-1)+1;
counter(j-1) = counter(j-1)+1;
if(aIsFasterIn[k-1]){
indexLookup(k-1, 1-1) = j;
indexLookup(k-1) = j;
}
else {
indexLookup(k-1, 1-1) = i;
indexLookup(k-1) = i;
}
k = k+1;
}
......@@ -45,7 +45,7 @@ stopOut[i-1] = false;
if(active){
for( auto i=1;i<=x;++i){
if(collisionIn[i-1]){
int curIndex = indexLookup(i-1, 1-1);
int curIndex = indexLookup(i-1);
stopOut[curIndex-1] = true;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment