/* Heat.cpp provides the function implementations for Heat, 
 * a library of heat-related constants and functions.
 *
 * Created by: Jane Roe, January, 1997, at Yoyodyne Industries.
 * Modification History: Kelvin functions added April, 1997 Ñ JR.
 *******************************************************************/

#include "Heat.h"
#include <cassert>

//---------------------------------------------

double fahrToCelsius(double tempFahr)
{
   assert(tempFahr >= MIN_FAHRENHEIT);
   return (tempFahr - 32.0) / 1.8;
}

//---------------------------------------------

double fahrToKelvin(double tempFahr)
{
   assert(tempFahr >= MIN_FAHRENHEIT);
   return celsiusToKelvin( fahrToCelsius(tempFahr) );
}

//---------------------------------------------

double celsiusToFahr(double tempCels)
{
   assert(tempCels >= MIN_CELSIUS);
   return tempCels * 1.8 + 32.0;
}

//---------------------------------------------

double celsiusToKelvin(double tempCels)
{
   assert(tempCels >= MIN_CELSIUS);
   return tempCels - MIN_CELSIUS;
}

//---------------------------------------------

double kelvinToCelsius(double tempKelv)
{
   assert(tempKelv >= MIN_KELVIN);
   return tempKelv + MIN_CELSIUS;
}

//---------------------------------------------

double kelvinToFahr(double tempKelv)
{
   assert(tempKelv >= MIN_KELVIN);
   return celsiusToFahr( kelvinToCelsius(tempKelv) );
}
