Adaptive Smoothed Particle Hydrodynamics, with Application to Cosmology: Methodology | Synapse