Package HAL.GridsAndAgents
Class Grid2Ddouble
- java.lang.Object
-
- HAL.GridsAndAgents.Grid2Ddouble
-
- All Implemented Interfaces:
Grid2D
,java.io.Serializable
public class Grid2Ddouble extends java.lang.Object implements Grid2D, java.io.Serializable
a 2D Grid of doubles- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Grid2Ddouble(int xDim, int yDim)
creates a new Grid2Ddouble of length xDim without wraparoundGrid2Ddouble(int xDim, int yDim, boolean wrapX, boolean wrapY)
creates a new Grid2Ddouble of length xDim with optional wraparound
-
Method Summary
Modifier and Type Method Description void
Add(int i, double val)
adds to the current field value at the specified indexvoid
Add(int x, int y, double val)
adds to the current field value at the specified coordinatesvoid
AddAll(double val)
adds specified value to all entries of the curr fieldvoid
BoundAll(double min, double max)
Bounds all values in the current field between min and maxdouble
Get(int i)
gets the current field value at the specified indexdouble
Get(int x, int y)
gets the current field value at the specified coordinatesdouble
GetAvg()
gets the average value of all squares in the current fielddouble[]
GetField()
returns the complete field as an arraydouble
GetMax()
returns the max value in the griddouble
GetMin()
returns the min value in the griddouble
GradientX(int x, int y)
returns the gradient of the field in the X direction at the coordinates specifieddouble
GradientX(int x, int y, double boundaryCond)
returns the gradient of the field in the X direction at the coordinates specified, will use the boundary value provided for gradients that go over the boundarydouble
GradientY(int x, int y)
returns the gradient of the field in the Y direction at the coordinates specifieddouble
GradientY(int x, int y, double boundaryCond)
returns the gradient of the field in the Y direction at the coordinates specified, will use the boundary value provided for gradients that go over the boundaryboolean
IsWrapX()
boolean
IsWrapY()
int
Length()
void
MulAll(double val)
multiplies all entries in the field by the valuevoid
Scale(int i, double val)
multiplies the current field value at the specified indexvoid
Scale(int x, int y, double val)
multiplies the current field value at the specified coordinatesvoid
Set(int i, double val)
sets the current field value at the specified indexvoid
Set(int x, int y, double val)
sets the current field value at the specified coordinatesvoid
SetAll(double val)
sets all squares in current the field to the specified valuevoid
SetAll(double[] vals)
sets all squares in the field to the specified valueint
Xdim()
int
Ydim()
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface HAL.Interfaces.Grid2D
AlongLineIs, ApplyHood, ApplyHood, ApplyHoodMapped, ApplyRectangle, BoundaryIs, ContainsValidI, ContainsValidI, DispX, DispY, Dist, DistSquared, GetHoodI, I, I, In, In, InWrap, ItoX, ItoY, MapHood, MapHood, MapHood, MapHood, MapI, MapXpt, MapXsq, MapYpt, MapYsq, RandomHoodI, WrapI
-
-
-
-
Method Detail
-
Get
public double Get(int i)
gets the current field value at the specified index
-
GetField
public double[] GetField()
returns the complete field as an array
-
Get
public double Get(int x, int y)
gets the current field value at the specified coordinates
-
Set
public void Set(int i, double val)
sets the current field value at the specified index
-
Set
public void Set(int x, int y, double val)
sets the current field value at the specified coordinates
-
Add
public void Add(int x, int y, double val)
adds to the current field value at the specified coordinates
-
Scale
public void Scale(int x, int y, double val)
multiplies the current field value at the specified coordinates
-
Scale
public void Scale(int i, double val)
multiplies the current field value at the specified index
-
Add
public void Add(int i, double val)
adds to the current field value at the specified index
-
BoundAll
public void BoundAll(double min, double max)
Bounds all values in the current field between min and max
-
SetAll
public void SetAll(double val)
sets all squares in current the field to the specified value
-
AddAll
public void AddAll(double val)
adds specified value to all entries of the curr field
-
MulAll
public void MulAll(double val)
multiplies all entries in the field by the value
-
SetAll
public void SetAll(double[] vals)
sets all squares in the field to the specified value
-
GetAvg
public double GetAvg()
gets the average value of all squares in the current field
-
GetMax
public double GetMax()
returns the max value in the grid
-
GetMin
public double GetMin()
returns the min value in the grid
-
GradientX
public double GradientX(int x, int y)
returns the gradient of the field in the X direction at the coordinates specified
-
GradientY
public double GradientY(int x, int y)
returns the gradient of the field in the Y direction at the coordinates specified
-
GradientX
public double GradientX(int x, int y, double boundaryCond)
returns the gradient of the field in the X direction at the coordinates specified, will use the boundary value provided for gradients that go over the boundary
-
GradientY
public double GradientY(int x, int y, double boundaryCond)
returns the gradient of the field in the Y direction at the coordinates specified, will use the boundary value provided for gradients that go over the boundary
-
-