public abstract class Substrate
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
double |
a
fraction of substrate size to distance of test boundary from actual
|
double[] |
border
boundary widths in each direction
|
static double |
factor
cheat factor for curved surfaces
|
boolean |
intersectsBoundary
flag to say whether an intersection is with the cell boundary or not
|
boolean |
spatialOptInitialised
flag indicating if spatial opt grid has been set or not
|
SubstrateObject[][] |
voxToObjects
map of subvoxels to arrays of substrate objects for
spatial optimisation
|
Constructor and Description |
---|
Substrate(double[] substrateDims)
constructor for testing.
|
Substrate(SimulationParams simParams,
double[] substrateDims)
constructor with p specified
|
Modifier and Type | Method and Description |
---|---|
void |
amend(Walker walker,
double[] step,
double t,
int n) |
abstract boolean |
crossesMembrane(Walker walker,
double[] offset,
double[] step,
double[] normal,
double[] d,
boolean skipCurrent,
double origLength,
boolean[] in,
double[] p)
checks if a step will cross a barrier or not
|
double[] |
getBottomLeft(int i,
int j,
int k)
calculates the spatial coordinates of the lower corner
of the subvoxel with given integer indices.
|
double |
getDiffusivityAt(double[] walkerPos)
returns the diffusivity at a given location on the substrate
|
double |
getLogMagnetisationChange(Walker walker,
double t,
double tLast)
returns the change in magnetisation at a given location and time
|
int[] |
getN() |
abstract double |
getPeakCoord() |
SubstrateObject[] |
getSubsObj() |
void |
getSubstrateCoords(double[] walkerPos,
double[] offset,
double[] newPos)
maps physical walker location into substrate cell.
|
abstract double[] |
getSubstrateSize() |
int |
getSubVoxelIndex(int i,
int j,
int k)
calculates linear index from three subvoxel coordinates.
|
double[] |
getUpperRight(int i,
int j,
int k)
calculates the spatial coordinates of the upper right
corner of the subvoxel given.
|
abstract void |
init()
initialiser for substrate.
|
void |
initBoundaryIntersectionArrays()
sets the values of the min and max values to use when
checking if a spin walks off the substrate.
|
void |
initCandidates(Walker walker,
double[] offset,
double[] step) |
void |
initialiseSpatialOptimisation(int[] n)
initialises the map of substrate objects to subvoxels
in the spatial optimisation grid.
|
abstract boolean |
intracellular(Walker walker)
checks if a walker is in intracellular (true) or
extracellular (false) space
|
static void |
main(java.lang.String[] args) |
double[] |
mapStepIntoSubstrate(Walker walker,
double[] offset,
double[] step)
maps the given step into the substrate coordinates.
|
boolean |
moreCandidates()
are there more candidates to check?
|
SubstrateObject |
nextCandidate()
get the next substrate object in the candidate list
|
void |
testAmendment(Walker walker,
double[] step,
double[] normal,
double[] d,
double origLength,
double[] toBarrier,
double[] amended,
double[] unamended)
test access to the amender.
|
static void |
testStepAmendment()
test of step amending code.
|
double[] |
unmapStepFromSubstrate(double[] subsCoords,
double[] offset,
double[] step)
unmaps a step that has been transformed using mapStepIntoSubstrate().
|
boolean |
voxelContains(double[] pos)
checks if a walker is in the current voxel.
|
public static double factor
public final double a
public double[] border
public boolean spatialOptInitialised
public SubstrateObject[][] voxToObjects
public boolean intersectsBoundary
public Substrate(SimulationParams simParams, double[] substrateDims)
simParams
- simulation parameterssubstrateDims
- substrate dimensionspublic Substrate(double[] substrateDims)
simParams
- simulation parameterssubstrateDims
- substrate dimensionspublic void initBoundaryIntersectionArrays()
public final void amend(Walker walker, double[] step, double t, int n)
public abstract boolean crossesMembrane(Walker walker, double[] offset, double[] step, double[] normal, double[] d, boolean skipCurrent, double origLength, boolean[] in, double[] p)
walker
- the walkerstep
- the step vectornormal
- container for the normalskipCurrent
- flag saying whether
to ignore the current
normal and distance
or notpublic abstract double[] getSubstrateSize()
public abstract double getPeakCoord()
public final int[] getN()
public abstract void init()
public abstract boolean intracellular(Walker walker)
walker
- the walker to checkpublic double getDiffusivityAt(double[] walkerPos)
location
- in world coordspublic double getLogMagnetisationChange(Walker walker, double t, double tLast)
walker
- the walkert
- current time (end of timestep)tLast
- the last time we were here (beginning of timestep)public void getSubstrateCoords(double[] walkerPos, double[] offset, double[] newPos)
walker
- the walker whose position we are mappingpublic final SubstrateObject[] getSubsObj()
public double[] mapStepIntoSubstrate(Walker walker, double[] offset, double[] step)
walker
- the walkoffset
- offset from current walker positionstep
- the steppublic double[] unmapStepFromSubstrate(double[] subsCoords, double[] offset, double[] step)
subsCoords
- the position of the walker on a substrateoffset
- offset from current positionstep
- the vector to transformpublic int getSubVoxelIndex(int i, int j, int k)
i
- x-coordj
- y-coordk
- z-coordpublic double[] getBottomLeft(int i, int j, int k)
i
- x index of subvoxj
- y index of subvoxk
- z index of subvoxpublic double[] getUpperRight(int i, int j, int k)
i
- x index of subvoxj
- y index of subvoxk
- z index of subvoxpublic void initialiseSpatialOptimisation(int[] n)
n
- number of subvoxels in each directionpublic boolean voxelContains(double[] pos)
pos
- the position to checkpublic void initCandidates(Walker walker, double[] offset, double[] step)
public final boolean moreCandidates()
public SubstrateObject nextCandidate()
public void testAmendment(Walker walker, double[] step, double[] normal, double[] d, double origLength, double[] toBarrier, double[] amended, double[] unamended)
walker
- walker making the stepstep
- step being madenormal
- barrier normald
- distance to barrierorigLength
- original length opf steptoBarrier
- step to the barrieramended
- amended portion of stepunamended
- unamended portion of steppublic static void testStepAmendment()
public static void main(java.lang.String[] args)