Class FDM3DGridUtil
java.lang.Object
net.finmath.finitedifference.solvers.adi.FDM3DGridUtil
Utility methods for indexing and boundary handling on a three-dimensional
grid.
The flattening convention is
k = i0 + n0 * (i1 + n1 * i2)
This class is intentionally stateless and generic.
- Author:
- Alessandro Gnoatto
-
Method Summary
Modifier and TypeMethodDescriptionstatic intflatten(int i0, int i1, int i2, int n0, int n1) Performs the operation.static booleanisInteriorPoint(int i0, int i1, int i2, int n0, int n1, int n2) Returns whether the condition holds.static booleanisOnAnyBoundary(int i0, int i1, int i2, int n0, int n1, int n2) Returns whether the condition holds.static booleanisOnLowerBoundaryFirstDirection(int i0) Returns whether the condition holds.static booleanisOnLowerBoundarySecondDirection(int i1) Returns whether the condition holds.static booleanisOnLowerBoundaryThirdDirection(int i2) Returns whether the condition holds.static booleanisOnUpperBoundaryFirstDirection(int i0, int n0) Returns whether the condition holds.static booleanisOnUpperBoundarySecondDirection(int i1, int n1) Returns whether the condition holds.static booleanisOnUpperBoundaryThirdDirection(int i2, int n2) Returns whether the condition holds.static int[]unflatten(int flatIndex, int n0, int n1, int n2) Performs the operation.static voidvalidateGridShape(int n0, int n1, int n2) Performs the operation.static voidvalidateIndex(int i0, int i1, int i2, int n0, int n1, int n2) Performs the operation.
-
Method Details
-
flatten
public static int flatten(int i0, int i1, int i2, int n0, int n1) Performs the operation.- Parameters:
i0- The value.i1- The value.i2- The value.n0- The value.n1- The value.- Returns:
- The value.
-
unflatten
public static int[] unflatten(int flatIndex, int n0, int n1, int n2) Performs the operation.- Parameters:
flatIndex- The value.n0- The value.n1- The value.n2- The value.- Returns:
- The value.
-
isOnLowerBoundaryFirstDirection
public static boolean isOnLowerBoundaryFirstDirection(int i0) Returns whether the condition holds.- Parameters:
i0- The value.- Returns:
- The value.
-
isOnUpperBoundaryFirstDirection
public static boolean isOnUpperBoundaryFirstDirection(int i0, int n0) Returns whether the condition holds.- Parameters:
i0- The value.n0- The value.- Returns:
- The value.
-
isOnLowerBoundarySecondDirection
public static boolean isOnLowerBoundarySecondDirection(int i1) Returns whether the condition holds.- Parameters:
i1- The value.- Returns:
- The value.
-
isOnUpperBoundarySecondDirection
public static boolean isOnUpperBoundarySecondDirection(int i1, int n1) Returns whether the condition holds.- Parameters:
i1- The value.n1- The value.- Returns:
- The value.
-
isOnLowerBoundaryThirdDirection
public static boolean isOnLowerBoundaryThirdDirection(int i2) Returns whether the condition holds.- Parameters:
i2- The value.- Returns:
- The value.
-
isOnUpperBoundaryThirdDirection
public static boolean isOnUpperBoundaryThirdDirection(int i2, int n2) Returns whether the condition holds.- Parameters:
i2- The value.n2- The value.- Returns:
- The value.
-
isOnAnyBoundary
public static boolean isOnAnyBoundary(int i0, int i1, int i2, int n0, int n1, int n2) Returns whether the condition holds.- Parameters:
i0- The value.i1- The value.i2- The value.n0- The value.n1- The value.n2- The value.- Returns:
- The value.
-
isInteriorPoint
public static boolean isInteriorPoint(int i0, int i1, int i2, int n0, int n1, int n2) Returns whether the condition holds.- Parameters:
i0- The value.i1- The value.i2- The value.n0- The value.n1- The value.n2- The value.- Returns:
- The value.
-
validateGridShape
public static void validateGridShape(int n0, int n1, int n2) Performs the operation.- Parameters:
n0- The value.n1- The value.n2- The value.
-
validateIndex
public static void validateIndex(int i0, int i1, int i2, int n0, int n1, int n2) Performs the operation.- Parameters:
i0- The value.i1- The value.i2- The value.n0- The value.n1- The value.n2- The value.
-