void UniformGrid<T,CellType>::InitGrid(const AABB3<T> &boundingBox, const AABB3<T> &element) { m_dCellSize = 2.0 * element.getBoundingSphereRadius(); m_bxBox = boundingBox; int x = (2.0*m_bxBox.extents_[0]+m_dCellSize)/m_dCellSize; int y = (2.0*m_bxBox.extents_[1]+m_dCellSize)/m_dCellSize; int z = (2.0*m_bxBox.extents_[2]+m_dCellSize)/m_dCellSize; // int nGhostLayerCells = (2 * xy + 2 * xz + 2 * yz) + (4 * x + 4 * y + 4 * z) + 8; // pass a bounding box that is m_dCellSize bigger in each dimension m_pCells = new CellType[x*y*z]; // printf("cell size: %f\n",m_dCellSize); // printf("domain extends : %f %f %f\n",boundingBox.extents_[0],boundingBox.extents_[1],boundingBox.extents_[2]); // printf("element extends : %f %f %f\n",element.extents_[0],element.extents_[1],element.extents_[2]); // printf("Dimensions : %d %d %d\n",x,y,z); // printf("Number of cells in uniform grid : %d\n",x*y*z); m_iDimension[0] = x; m_iDimension[1] = y; m_iDimension[2] = z; m_iTotalEntries=0; }
UniformGrid<T,CellType>::UniformGrid(const AABB3<T> &boundingBox, const AABB3<T> &element) { m_dCellSize = 2.0 * element.getBoundingSphereRadius(); int x = (m_bxBox.extents_[0]+m_dCellSize)/m_dCellSize; int y = (m_bxBox.extents_[1]+m_dCellSize)/m_dCellSize; int z = (m_bxBox.extents_[2]+m_dCellSize)/m_dCellSize; int xy = x*y; int xz = x*z; int yz = y*z; // pass a bounding box that is m_dCellSize bigger in each dimension m_pCells = new CellType[x*y*z]; m_iTotalEntries=0; }