Class PDEInitialize
PDEInitialize encapsulates a particular initialization "type" (uniform,
random, localized shapes, Gaussian, ring, etc.), a background density vector,
an optional dependent-component index and an RNG for randomized initial
configurations. It provides a single entry point init(double[][])
that fills a preallocated two-dimensional
density array where each row corresponds to the state vector at a lattice
site.
Concepts and inputs
- density - destination array of shape [space.getSize()][nDim]; each row receives the initial density vector for a spatial location.
- y0 - baseline initial state vector (peak or default densities) used for the selected initialization pattern.
- background - background density vector used for locations outside the initialized region (e.g. outside a circle or square).
- dependent - index of a dependent component (or
-1if none). When set, several initialization modes perform a correction and normalization so the dependent component and the total density are consistent (e.g. for frequency-based models). - rng - random number generator used for RANDOM initializations.
Supported initialization types
The class supports the following patterns via the inner PDEInitialize.Type enum:
UNIFORM, RANDOM, PERTURBATION, SQUARE, CIRCLE, GAUSSIAN (sombrero) and RING.
The chosen type determines how y0 and background are applied
across the lattice: globally, randomly, locally (centered square/circle),
or using radially/gaussian-scaled profiles.
Usage
Construct an instance with the desired PDEInitialize.Type, background vector,
dependent index and RNG (if needed), then call init(double[][]) to
populate the simulation density array prior to starting integration or
discrete updates.
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class ODEInitialize
ODEInitialize.InitType -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPDEInitialize(PDE pde) Create an initializer tied to the supplied PDE model. -
Method Summary
Modifier and TypeMethodDescription(package private) voidapply(int x, int l, double[] y0, double[][] dest) Applies the initialization forGeometryType.LINEAR.(package private) voidapply(int x, int y, int l, double[] y0, double[][] dest) Applies the initialization forGeometryType.SQUAREand variants.(package private) voidapply(int x, int y, int z, int l, int lz, double[] y0, double[][] dest) Applies the initialization forGeometryType.CUBE.voidinit(double[][] density) Initialize the density array according to the configured type.private voidinitFunction(double[][] density, double[] y0, AbstractGeometry space) Dispatch initialization based on the dimensionality of the geometry.private voidinitFunction1D(double[][] density, double[] y0, AbstractGeometry space) Initialization forGeometryType.LINEARgeometries extracted to reduce complexity.private voidinitFunction2D(double[][] density, double[] y0, AbstractGeometry space) Initialization for square/triangular/hexagonal lattice geometries extracted to reduce cognitive complexity.private voidinitFunction3D(double[][] density, double[] y0, AbstractGeometry space) Initialization forGeometryType.CUBEgeometries extracted to reduce complexity.private voidinitPerturbation(double[][] density, double[] y0, AbstractGeometry space) Initialize a uniform background with a single perturbed site at the center.private voidinitRandom(double[][] density, double[] y0, AbstractGeometry space) Initialize each site independently at random (normalized if needed).private voidinitUniform(double[][] density, double[] y0, AbstractGeometry space) Initialize every lattice point with the same state.private voidscaleDensity(double[] y0, double scale, double[] d) Helper method to scale the density vectordby the scalar factorscale.Methods inherited from class ODEInitialize
init, parse
-
Field Details
-
pde
Owning PDE model providing geometry and background data.
-
-
Constructor Details
-
PDEInitialize
PDEInitialize(PDE pde) Create an initializer tied to the supplied PDE model.- Parameters:
pde- owning PDE
-
-
Method Details
-
init
public void init(double[][] density) Initialize the density array according to the configured type.- Parameters:
density- per-node trait densities to fill
-
initUniform
Initialize every lattice point with the same state.- Parameters:
density- per-node density buffer to populatey0- base state vector copied to each nodespace- simulation geometry describing the lattice size
-
initPerturbation
Initialize a uniform background with a single perturbed site at the center.- Parameters:
density- per-node density buffer to populatey0- perturbed state vector applied to the central nodespace- simulation geometry describing the lattice
-
initRandom
Initialize each site independently at random (normalized if needed).- Parameters:
density- per-node density buffer to populatey0- base amplitudes for random samplingspace- simulation geometry describing the lattice size
-
initFunction
Dispatch initialization based on the dimensionality of the geometry.- Parameters:
density- per-node density buffer to populatey0- peak density vector for the localized shapesspace- simulation geometry describing the lattice
-
initFunction3D
Initialization forGeometryType.CUBEgeometries extracted to reduce complexity.- Parameters:
density- per-node density buffer to populatey0- peak density vector for the localized shapespace- simulation geometry describing the lattice
-
initFunction1D
Initialization forGeometryType.LINEARgeometries extracted to reduce complexity.- Parameters:
density- per-node density buffer to populatey0- peak density vector for the localized shapespace- simulation geometry describing the lattice
-
initFunction2D
Initialization for square/triangular/hexagonal lattice geometries extracted to reduce cognitive complexity.- Parameters:
density- per-node density buffer to populatey0- peak density vector for the localized shapespace- simulation geometry describing the lattice
-
apply
void apply(int x, int l, double[] y0, double[][] dest) Applies the initialization forGeometryType.LINEAR.- Parameters:
x- the x coordinatel- the linear length of the latticey0- the initial statedest- the destination array
-
apply
void apply(int x, int y, int l, double[] y0, double[][] dest) Applies the initialization forGeometryType.SQUAREand variants.- Parameters:
x- the x coordinatey- the y coordinatel- the linear length of the latticey0- the initial statedest- the destination array
-
apply
void apply(int x, int y, int z, int l, int lz, double[] y0, double[][] dest) Applies the initialization forGeometryType.CUBE.- Parameters:
x- the x coordinatey- the y coordinatez- the z coordinatel- the linear length of the latticelz- the linear height of the lattice (lz == lexcept for NOVA)y0- the initial statedest- the destination array
-
scaleDensity
private void scaleDensity(double[] y0, double scale, double[] d) Helper method to scale the density vectordby the scalar factorscale. The scalar must lie in \((0, 1)\) such that the initial densities/frequencies represent the maximum.- Parameters:
y0- the initial density vectorscale- the scaling factord- the location to store the scaled density
-