Package HAL.Interfaces
Interface Grid1D
-
- All Known Implementing Classes:
AgentGrid1D
,Grid1Ddouble
,Grid1Dint
,Grid1Dlong
,Grid1Dobject
,PDEGrid1D
,PopulationGrid1D
,PopulationGrid1DLong
public interface Grid1D
holds functions that all 1D Grids share
-
-
Method Summary
Modifier and Type Method Description default int
ApplyHood(int[] hood, int centerX, IndexAction Action)
applies the action function to all positions in the neighborhooddefault void
ApplyHoodMapped(int[] hood, int validCount, IndexAction Action)
applies the action function to all positions in the neighborhood up to validCount, assumes the neighborhood is already mappeddefault void
ApplyRectangle(int startX, int width, IndexAction Action)
applies the action function to all positions in the rectangle, will use wraparound if appropriatedefault boolean
ContainsValidI(int[] hood, int centerX, IndexBool IsValid)
returns whether a valid index exists in the neighborhooddefault double
DispX(double x1, double x2)
gets the displacement from the first coorinate to the second.default double
Dist(double x1, double x2)
gets the distance between two positions with or without grid wrap around (if wraparound is enabled, the shortest distance taking this into account will be returned)default double
DistSquared(double x1, double x2)
gets the distance between two positions squared with or without grid wrap arounddefault int
GetHoodI(int[] hood, int centerX, int entryIndex)
gets a specified index from the hood after mapping to the center positiondefault boolean
In(double x)
returns whether the specified coordinates are inside the typeGrid boundsdefault boolean
In(int x)
returns whether the specified coordinates are inside the typeGrid boundsdefault boolean
InWrap(double x)
returns whether the specified coordinates are inside the Grid bounds with wraparounddefault boolean
InWrap(int x)
returns whether the specified coordinates are inside the Grid bounds with wraparoundboolean
IsWrapX()
int
Length()
default int
MapHood(int[] hood, int centerX)
This function takes a neighborhood centered around the origin, translates the set of coordinates to be centered around a particular central location, and computes which indices the translated coordinates map to.default int
MapHood(int[] hood, int centerX, Coords1DBool Eval)
This function is very similar to the previous definition of MapHood, only it additionally takes as argument an EvaluationFunctoin.default double
MapXpt(double x, Grid1D other)
returns the position that x rescales to in the other griddefault int
MapXsq(int x, Grid1D other)
returns the index of the center of the square in otherGrid that the coordinate maps to.default int
RandomHoodI(int[] hood, int centerX, Rand rng)
gets a random index from the full neighborhood, if the index does not map, returns -1default int
WrapI(int x)
gets the index of the square at the specified coordinates with wrap aroundint
Xdim()
-
-
-
Method Detail
-
WrapI
default int WrapI(int x)
gets the index of the square at the specified coordinates with wrap around
-
In
default boolean In(int x)
returns whether the specified coordinates are inside the typeGrid bounds
-
In
default boolean In(double x)
returns whether the specified coordinates are inside the typeGrid bounds
-
InWrap
default boolean InWrap(int x)
returns whether the specified coordinates are inside the Grid bounds with wraparound
-
InWrap
default boolean InWrap(double x)
returns whether the specified coordinates are inside the Grid bounds with wraparound
-
DispX
default double DispX(double x1, double x2)
gets the displacement from the first coorinate to the second. using wraparound if allowed over the given axis to find the shortest displacement.
-
Dist
default double Dist(double x1, double x2)
gets the distance between two positions with or without grid wrap around (if wraparound is enabled, the shortest distance taking this into account will be returned)
-
DistSquared
default double DistSquared(double x1, double x2)
gets the distance between two positions squared with or without grid wrap around
-
ApplyRectangle
default void ApplyRectangle(int startX, int width, IndexAction Action)
applies the action function to all positions in the rectangle, will use wraparound if appropriate
-
ApplyHood
default int ApplyHood(int[] hood, int centerX, IndexAction Action)
applies the action function to all positions in the neighborhood
-
ApplyHoodMapped
default void ApplyHoodMapped(int[] hood, int validCount, IndexAction Action)
applies the action function to all positions in the neighborhood up to validCount, assumes the neighborhood is already mapped
-
MapHood
default int MapHood(int[] hood, int centerX, Coords1DBool Eval)
This function is very similar to the previous definition of MapHood, only it additionally takes as argument an EvaluationFunctoin. this function should take as argument (i,x,y) of a location and return a boolean that decides whether that location should be included as a valid one.
-
MapHood
default int MapHood(int[] hood, int centerX)
This function takes a neighborhood centered around the origin, translates the set of coordinates to be centered around a particular central location, and computes which indices the translated coordinates map to. The function returns the number of valid locations it set. this function differs from HoodToIs and CoordsToIs in that it takes no ret[], MapHood instead puts the result of the mapping back into the hood array.
-
RandomHoodI
default int RandomHoodI(int[] hood, int centerX, Rand rng)
gets a random index from the full neighborhood, if the index does not map, returns -1
-
GetHoodI
default int GetHoodI(int[] hood, int centerX, int entryIndex)
gets a specified index from the hood after mapping to the center position
-
ContainsValidI
default boolean ContainsValidI(int[] hood, int centerX, IndexBool IsValid)
returns whether a valid index exists in the neighborhood
-
MapXsq
default int MapXsq(int x, Grid1D other)
returns the index of the center of the square in otherGrid that the coordinate maps to.
-
MapXpt
default double MapXpt(double x, Grid1D other)
returns the position that x rescales to in the other grid
-
Xdim
int Xdim()
-
Length
int Length()
-
IsWrapX
boolean IsWrapX()
-
-