Files
karl/include/simulation/unit_converter.h
2024-12-04 17:15:04 +01:00

33 lines
1.1 KiB
C++
Executable File

#ifndef UNIT_CONVERTER_H
#define UNIT_CONVERTER_H
#include <string>
namespace unitConvertion {
// transforms the value from current lenght unit "unit_from" to "unit_to"
// possible values for both "unit_from" and "unit_to": "mm", "cm", "m" otherwise
// an error is thrown and the program terminates
double length(double value,
const std::string& unit_from,
const std::string& unit_to);
// returns the value of unit/meter, supports "mm", "cm", "m" for any other value
// an error is thrown and the program terminates
double lengthPrefactor(const std::string& unit);
// transforms the value from current energy unit "unit_from" to "unit_to"
// possible values for both "unit_from" and "unit_to": "eV", "J" otherwise
// an error is thrown and the program terminates
double energy(double value,
const std::string& unit_from,
const std::string& unit_to);
// returns the value of unit/eV, supports "eV", "J" for any other value
// an error is thrown and the program terminates
double energyPrefactor(const std::string& unit);
}; // namespace unitConvertion
#endif /* UNIT_CONVERTER_H */