Site layout API
LatticeCore.AbstractSiteLayout — Type
AbstractSiteLayoutAbstract supertype for strategies that store the per-site AbstractSiteType of a lattice. Three concrete layouts are provided, each picking a different memory / flexibility trade-off:
UniformLayout— every site shares the same site type (stored once; zero per-site memory overhead)SublatticeLayout— each geometric sublattice has its own site type (Vector{Int}of sublattice ids)ExplicitLayout— oneAbstractSiteTypeper site (for disordered / quenched-random configurations)
All layouts satisfy site_type(layout, i)::AbstractSiteType.
LatticeCore.UniformLayout — Type
UniformLayout(st::AbstractSiteType)Every site has the same site type. The type parameter carries the concrete site-type singleton so that downstream MC code can dispatch on it at compile time (constant folding in the hot loop).
LatticeCore.SublatticeLayout — Type
SublatticeLayout(by_sublattice::NTuple{N, <:AbstractSiteType}, sublattice_of::Vector{Int})Per-sublattice site type. by_sublattice is a tuple of site type instances, one per geometric sublattice; sublattice_of[i] tells which sublattice site i belongs to (1-based).
This is the natural layout for mixed-spin models (e.g. Ising on the A sublattice, XY on B).
Ownership / mutability contract
SublatticeLayout stores the sublattice_of::Vector{Int} argument by reference, not by copy. The caller MUST treat the vector as immutable for the lifetime of the SublatticeLayout: mutating it (push!, setindex!, resize!, etc.) after construction will silently corrupt site-type lookups, since site_type(layout, i) indexes directly into this storage.
If the caller wants to keep a mutable copy of the assignment, it should pass copy(sublattice_of) to the constructor explicitly. A future release may switch the field to a read-only container (e.g. an NTuple{M,Int} or a wrapper); doing so would be a breaking change and is tracked separately.
LatticeCore.ExplicitLayout — Type
ExplicitLayout(types::Vector{<:AbstractSiteType})One site type per site. Use for quenched disorder or any configuration where the per-site type cannot be factored through a sublattice assignment.
LatticeCore.site_type — Function
site_type(layout::AbstractSiteLayout, i::Int) → AbstractSiteTypeReturn the site type stored at site index i.