void TurbulenceField::calculateTurbulenceField(MACVelocityField *vfield, FluidMaterialGrid &mgrid) { GridIndexVector fluidcells(mgrid.width, mgrid.height, mgrid.depth); for (int k = 0; k < mgrid.depth; k++) { for (int j = 0; j < mgrid.height; j++) { for (int i = 0; i < mgrid.width; i++) { if (mgrid.isCellFluid(i, j, k)) { fluidcells.push_back(i, j, k); } } } } calculateTurbulenceField(vfield, fluidcells); }
GridIndexVector FluidSource::getFluidCells(FluidMaterialGrid &materialGrid, double dx) { int w = materialGrid.width; int h = materialGrid.height; int d = materialGrid.depth; GridIndexVector cells(w, h, d); if (!isActive()) { return cells; } GridIndexVector overlappingIndices(w, h, d); _getOverlappingCells(overlappingIndices, dx); GridIndex g; for (unsigned int i = 0; i < overlappingIndices.size(); i++) { g = overlappingIndices[i]; if (materialGrid.isCellFluid(g)) { cells.push_back(g); } } return cells; }