Commit 3fc03c54 authored by Ole Klein's avatar Ole Klein

improve coordinates <-> indices conversion

parent a500b8f9
......@@ -365,7 +365,7 @@ namespace Dune {
{
for (unsigned int i = 0; i < dim; i++)
{
globalIndices[i] = (unsigned int) (location[i] * cells[i] / extensions[i]);
globalIndices[i] = (unsigned int) (location[i] * (cells[i] + 1e-6) / extensions[i]);
localIndices[i] = globalIndices[i] - offset[i];
}
}
......@@ -382,7 +382,7 @@ namespace Dune {
for (unsigned int i = 0; i < dim; i++)
{
globalIndices[i] = localIndices[i] + offset[i];
location[i] = (globalIndices[i] * extensions[i] + 0.5) / cells[i];
location[i] = (globalIndices[i] + 0.5) * extensions[i] / cells[i];
}
}
......
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