Commit 712da8ca authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Corrected a bug in the unit system that lead to the units of time being 0 in the outputs.


Former-commit-id: eead9a984fdab0f5311ee9a9e4d89704ef042c16
parent 320bf527
......@@ -47,7 +47,7 @@ void initUnitSystem(struct UnitSystem* us)
{
us->UnitMass_in_cgs = const_unit_mass_in_cgs;
us->UnitLength_in_cgs = const_unit_length_in_cgs;
us->UnitTime_in_cgs = 1.d / (const_unit_velocity_in_cgs / const_unit_length_in_cgs );
us->UnitTime_in_cgs = 1. / ((double) const_unit_velocity_in_cgs / ( (double)const_unit_length_in_cgs ));
us->UnitCurrent_in_cgs = 1.;
us->UnitTemperature_in_cgs = 1.;
}
......@@ -257,8 +257,7 @@ double generalConversionFactor(struct UnitSystem* us, float baseUnitsExponants[5
for(i = 0 ; i < 5 ; ++i )
if(baseUnitsExponants[i] != 0)
factor *= pow( getBaseUnit( us, i ) , baseUnitsExponants[i] );
factor *= pow( getBaseUnit( us, i ) , baseUnitsExponants[i] );
return factor;
}
......
......@@ -43,11 +43,11 @@ struct UnitSystem
*/
enum BaseUnits
{
UNIT_MASS,
UNIT_LENGTH,
UNIT_TIME,
UNIT_CURRENT,
UNIT_TEMPERATURE
UNIT_MASS = 0,
UNIT_LENGTH = 1,
UNIT_TIME = 2,
UNIT_CURRENT = 3,
UNIT_TEMPERATURE = 4
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment