Show / Hide Table of Contents

Class GridTopology

A grid topology is a topology with a regular repeating pattern. It supports more operations than a generic topology.

Inheritance
object
GridTopology
Implements
ITopology
Namespace: DeBroglie.Topo
Assembly: DeBroglie.dll
Syntax
public class GridTopology : ITopology

Constructors

| Edit this page View Source

GridTopology(DirectionSet, int, int, bool, bool, bool[])

Constructs a 2d topology.

Declaration
public GridTopology(DirectionSet directions, int width, int height, bool periodicX, bool periodicY, bool[] mask = null)
Parameters
Type Name Description
DirectionSet directions
int width
int height
bool periodicX
bool periodicY
bool[] mask
| Edit this page View Source

GridTopology(DirectionSet, int, int, int, bool, bool, bool, bool[])

Constructs a topology.

Declaration
public GridTopology(DirectionSet directions, int width, int height, int depth, bool periodicX, bool periodicY, bool periodicZ, bool[] mask = null)
Parameters
Type Name Description
DirectionSet directions
int width
int height
int depth
bool periodicX
bool periodicY
bool periodicZ
bool[] mask
| Edit this page View Source

GridTopology(int, int, bool)

Constructs a 2d square grid topology of given dimensions and periodicity.

Declaration
public GridTopology(int width, int height, bool periodic)
Parameters
Type Name Description
int width
int height
bool periodic
| Edit this page View Source

GridTopology(int, int, int, bool)

Constructs a 3d cube grid topology of given dimensions and periodicity.

Declaration
public GridTopology(int width, int height, int depth, bool periodic)
Parameters
Type Name Description
int width
int height
int depth
bool periodic

Properties

| Edit this page View Source

Depth

The extent along the z-axis.

Declaration
public int Depth { get; set; }
Property Value
Type Description
int
| Edit this page View Source

Directions

Characterizes the adjacency relationship between locations.

Declaration
public DirectionSet Directions { get; set; }
Property Value
Type Description
DirectionSet
| Edit this page View Source

DirectionsCount

Number of unique directions

Declaration
public int DirectionsCount { get; }
Property Value
Type Description
int
| Edit this page View Source

Height

The extent along the y-axis.

Declaration
public int Height { get; set; }
Property Value
Type Description
int
| Edit this page View Source

IndexCount

Number of unique indices (distinct locations) in the topology

Declaration
public int IndexCount { get; }
Property Value
Type Description
int
| Edit this page View Source

Mask

A array with one value per index indcating if the value is missing. Not all uses of Topology support masks.

Declaration
public bool[] Mask { get; set; }
Property Value
Type Description
bool[]
| Edit this page View Source

PeriodicX

Does the topology wrap on the x-axis.

Declaration
public bool PeriodicX { get; set; }
Property Value
Type Description
bool
| Edit this page View Source

PeriodicY

Does the topology wrap on the y-axis.

Declaration
public bool PeriodicY { get; set; }
Property Value
Type Description
bool
| Edit this page View Source

PeriodicZ

Does the topology wrap on the z-axis.

Declaration
public bool PeriodicZ { get; set; }
Property Value
Type Description
bool
| Edit this page View Source

Width

The extent along the x-axis.

Declaration
public int Width { get; set; }
Property Value
Type Description
int

Methods

| Edit this page View Source

GetCoord(int, out int, out int, out int)

Inverts GetIndex(int, int, int)

Declaration
public void GetCoord(int index, out int x, out int y, out int z)
Parameters
Type Name Description
int index
int x
int y
int z
| Edit this page View Source

GetIndex(int, int, int)

Reduces a three dimensional co-ordinate to a single integer. This is mostly used internally.

Declaration
public int GetIndex(int x, int y, int z)
Parameters
Type Name Description
int x
int y
int z
Returns
Type Description
int
| Edit this page View Source

IsSameSize(GridTopology)

Checks if two grids are the same size without regard for masks or periodicity.

Declaration
public bool IsSameSize(GridTopology other)
Parameters
Type Name Description
GridTopology other
Returns
Type Description
bool
| Edit this page View Source

TryMove(int, Direction, out int)

Given an index and a direction, gives the index that is one step in that direction, if it exists and is not masked out. Otherwise, it returns false.

Declaration
public bool TryMove(int index, Direction direction, out int dest)
Parameters
Type Name Description
int index
Direction direction
int dest
Returns
Type Description
bool
| Edit this page View Source

TryMove(int, Direction, out int, out Direction, out EdgeLabel)

Given an index and a direction, gives the index that is one step in that direction, if it exists and is not masked out. Otherwise, it returns false. Additionally returns information about the edge traversed.

Declaration
public bool TryMove(int index, Direction direction, out int dest, out Direction inverseDirection, out EdgeLabel edgeLabel)
Parameters
Type Name Description
int index
Direction direction
int dest
Direction inverseDirection
EdgeLabel edgeLabel
Returns
Type Description
bool
| Edit this page View Source

TryMove(int, int, int, Direction, out int)

Given a co-ordinate and a direction, gives the index that is one step in that direction, if it exists and is not masked out. Otherwise, it returns false.

Declaration
public bool TryMove(int x, int y, int z, Direction direction, out int dest)
Parameters
Type Name Description
int x
int y
int z
Direction direction
int dest
Returns
Type Description
bool
| Edit this page View Source

TryMove(int, int, int, Direction, out int, out Direction, out EdgeLabel)

Given a co-ordinate and a direction, gives the index that is one step in that direction, if it exists and is not masked out. Otherwise, it returns false. Additionally returns information about the edge traversed.

Declaration
public bool TryMove(int x, int y, int z, Direction direction, out int dest, out Direction inverseDirection, out EdgeLabel edgeLabel)
Parameters
Type Name Description
int x
int y
int z
Direction direction
int dest
Direction inverseDirection
EdgeLabel edgeLabel
Returns
Type Description
bool
| Edit this page View Source

TryMove(int, int, int, Direction, out int, out int, out int)

Given a co-ordinate and a direction, gives the co-ordinate that is one step in that direction, if it exists and is not masked out. Otherwise, it returns false.

Declaration
public bool TryMove(int x, int y, int z, Direction direction, out int destx, out int desty, out int destz)
Parameters
Type Name Description
int x
int y
int z
Direction direction
int destx
int desty
int destz
Returns
Type Description
bool
| Edit this page View Source

WithMask(ITopoArray<bool>)

Returns a GridTopology with the same parameters, but with the specified mask

Declaration
public GridTopology WithMask(ITopoArray<bool> mask)
Parameters
Type Name Description
ITopoArray<bool> mask
Returns
Type Description
GridTopology
| Edit this page View Source

WithMask(bool[])

Returns a GridTopology with the same parameters, but with the specified mask

Declaration
public GridTopology WithMask(bool[] mask)
Parameters
Type Name Description
bool[] mask
Returns
Type Description
GridTopology
| Edit this page View Source

WithPeriodic(bool, bool, bool)

Returns a GridTopology with the same parameters, with the dimensions overridden.

Declaration
public GridTopology WithPeriodic(bool periodicX, bool periodicY, bool periodicZ = false)
Parameters
Type Name Description
bool periodicX
bool periodicY
bool periodicZ
Returns
Type Description
GridTopology
| Edit this page View Source

WithSize(int, int, int)

Returns a GridTopology with the same parameters, with the dimensions overridden. Any mask is reset.

Declaration
public GridTopology WithSize(int width, int height, int depth = 1)
Parameters
Type Name Description
int width
int height
int depth
Returns
Type Description
GridTopology

Implements

ITopology

Extension Methods

TopologyExtensions.AsGridTopology(ITopology)
TopologyExtensions.ContainsIndex(ITopology, int)
TopologyExtensions.GetIndices(ITopology)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX