Package HAL.Interfaces
Interface Grid1D
-
- All Known Implementing Classes:
AgentGrid1D,Grid1Ddouble,Grid1Dint,Grid1Dlong,Grid1Dobject,PDEGrid1D,PopulationGrid1D,PopulationGrid1DLong
public interface Grid1Dholds functions that all 1D Grids share
-
-
Method Summary
Modifier and Type Method Description default intApplyHood(int[] hood, int centerX, IndexAction Action)applies the action function to all positions in the neighborhooddefault voidApplyHoodMapped(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 voidApplyRectangle(int startX, int width, IndexAction Action)applies the action function to all positions in the rectangle, will use wraparound if appropriatedefault booleanContainsValidI(int[] hood, int centerX, IndexBool IsValid)returns whether a valid index exists in the neighborhooddefault doubleDispX(double x1, double x2)gets the displacement from the first coorinate to the second.default doubleDist(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 doubleDistSquared(double x1, double x2)gets the distance between two positions squared with or without grid wrap arounddefault intGetHoodI(int[] hood, int centerX, int entryIndex)gets a specified index from the hood after mapping to the center positiondefault booleanIn(double x)returns whether the specified coordinates are inside the typeGrid boundsdefault booleanIn(int x)returns whether the specified coordinates are inside the typeGrid boundsdefault booleanInWrap(double x)returns whether the specified coordinates are inside the Grid bounds with wraparounddefault booleanInWrap(int x)returns whether the specified coordinates are inside the Grid bounds with wraparoundbooleanIsWrapX()intLength()default intMapHood(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 intMapHood(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 doubleMapXpt(double x, Grid1D other)returns the position that x rescales to in the other griddefault intMapXsq(int x, Grid1D other)returns the index of the center of the square in otherGrid that the coordinate maps to.default intRandomHoodI(int[] hood, int centerX, Rand rng)gets a random index from the full neighborhood, if the index does not map, returns -1default intWrapI(int x)gets the index of the square at the specified coordinates with wrap aroundintXdim()
-
-
-
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()
-
-