MapBasedDistanceGrid

floodsim.model.grid.MapBasedDistanceGrid
final case class MapBasedDistanceGrid[T <: GridElement](grid: MapBasedGrid[T]) extends DistanceGrid[T]

DistanceGrid implementation backed by an internal MapBasedGrid. Provides efficient distance-based neighbor searches using a multi-source BFS computed from all not-full cells. The distance map is lazily evaluated and cached to optimize repeated neighbor queries during flood propagation. Transparently exports properties and methods of the internal grid (width, height, getElementAt, elementsMap) for seamless integration with existing grid operations.

Type parameters

T

element type

Value parameters

grid

underlying immutable grid

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait DistanceGrid[T]
trait Grid[T]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def getNotEmptyCells: Seq[(Coordinate, T)]

Lists cells that are not empty according to a presence criterion. For elements of type floodsim.model.cell.Cell this means water volume strictly greater than 0. Useful for identifying active flood areas and computing simulation statistics.

Lists cells that are not empty according to a presence criterion. For elements of type floodsim.model.cell.Cell this means water volume strictly greater than 0. Useful for identifying active flood areas and computing simulation statistics.

Attributes

def getNotFullNeighbors(coordinate: Coordinate): Seq[(Coordinate, T)]

Returns neighbors of the coordinate that are not "full" per the filling metric. Searches at a dynamic radius based on distance to nearest not-full cell, optimizing neighbor discovery in sparsely flooded grids. Falls back to immediate (distance=1) neighbors if no not-full cells found at computed radius. For elements of type floodsim.model.cell.Cell, "not full" means the flooded percentage is less than 100%.

Returns neighbors of the coordinate that are not "full" per the filling metric. Searches at a dynamic radius based on distance to nearest not-full cell, optimizing neighbor discovery in sparsely flooded grids. Falls back to immediate (distance=1) neighbors if no not-full cells found at computed radius. For elements of type floodsim.model.cell.Cell, "not full" means the flooded percentage is less than 100%.

Attributes

def map(f: (Coordinate, T) => T): DistanceGrid[T]

Applies an immutable transformation to all elements, with access to their coordinates.

Applies an immutable transformation to all elements, with access to their coordinates.

Attributes

def overwrite(coordinate: Coordinate, element: T): DistanceGrid[T]

Returns a new grid with the element at the coordinate replaced, if the coordinate is inside bounds. If the coordinate is out of bounds, returns the same instance unchanged.

Returns a new grid with the element at the coordinate replaced, if the coordinate is inside bounds. If the coordinate is out of bounds, returns the same instance unchanged.

Attributes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product