Commit 11b6b7b8 authored by Moritz's avatar Moritz

VectorFieldWriter: length of the dimensions is now the closest highest power of two

parent 1153b69a
......@@ -62,14 +62,23 @@ namespace Teamproject {
#region vector
private void SquareGridVEC() {
//find dimension with highest count
int maxDimCount = 0;
//find highest dimension
int highestDim = 0;
if (_gridsize.x >= _gridsize.y && _gridsize.x >= _gridsize.z)
maxDimCount = (int)_gridsize.x;
highestDim = (int)_gridsize.x;
if (_gridsize.y >= _gridsize.x && _gridsize.y >= _gridsize.z)
maxDimCount = (int)_gridsize.y;
highestDim = (int)_gridsize.y;
if (_gridsize.z >= _gridsize.y && _gridsize.z >= _gridsize.x)
maxDimCount = (int)_gridsize.z;
highestDim = (int)_gridsize.z;
//find next highest dimension count, that is a result of 2^n
int maxDimCount = 0;
for (int i = 0; i < 10; i++) {
if(Math.Pow(2, i) > highestDim) {
maxDimCount = (int)Math.Pow(2, i);
break;
}
}
//number of indices that have to be filled in each dimension
int xFill, yFill, zFill;
......@@ -132,14 +141,23 @@ namespace Teamproject {
#region float
private void SquareGridFLOAT() {
//find dimension with highest count
int maxDimCount = 0;
//find highest dimension
int highestDim = 0;
if (_gridsize.x >= _gridsize.y && _gridsize.x >= _gridsize.z)
maxDimCount = (int)_gridsize.x;
highestDim = (int)_gridsize.x;
if (_gridsize.y >= _gridsize.x && _gridsize.y >= _gridsize.z)
maxDimCount = (int)_gridsize.y;
highestDim = (int)_gridsize.y;
if (_gridsize.z >= _gridsize.y && _gridsize.z >= _gridsize.x)
maxDimCount = (int)_gridsize.z;
highestDim = (int)_gridsize.z;
//find next highest dimension count, that is a result of 2^n
int maxDimCount = 0;
for (int i = 0; i < 10; i++) {
if (Math.Pow(2, i) > highestDim) {
maxDimCount = (int)Math.Pow(2, i);
break;
}
}
//number of indices that have to be filled in each dimension
int xFill, yFill, zFill;
......
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