Chemistry · function
elementTotals
Reduce kilograms per species into moles per element.
Explained in Chemistry.
function elementTotals(registry: SpeciesRegistry, speciesMass: Float64Array, out: Float64Array): voidimport { elementTotals } from '@driftengine/chemistry';Parameters
| Parameter | Type | Description |
|---|---|---|
registry | SpeciesRegistry | |
speciesMass | Float64Array | |
out | Float64Array |
In depth
out is overwritten, not accumulated into, so a caller may hold one vector for the life of a
world and re-derive totals every tick without clearing it first. speciesMass is indexed by
species, so it is the registry's width; a species with no mass costs one comparison.