Thermodynamic transformations in magnetically polarizable undeformable media