Commit 8c8a80cc authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

The (parallel) i/o now prints the conversion factor of each array to the file.



Former-commit-id: f743a026289b7404ad607a8d2f4e811343278d6a
parent 5380a052
......@@ -831,12 +831,13 @@ int main ( int argc , char *argv[] ) {
initUnitSystem(&us);
if ( myrank == 0 )
{
message( "Unit system: U_L = %e cm.", us.UnitLength_in_cgs );
message( "Unit system: U_M = %e g.", us.UnitMass_in_cgs );
message( "Unit system: U_L = %e cm.", us.UnitLength_in_cgs );
message( "Unit system: U_t = %e s.", us.UnitTime_in_cgs );
message( "Unit system: U_I = %e A.", us.UnitCurrent_in_cgs );
message( "Unit system: U_T = %e K.", us.UnitTemperature_in_cgs );
/* message( "Density units: %e a^%f h^%f.", conversionFactor(&us, UNIT_CONV_ENTROPY), aFactor(&us, UNIT_CONV_ENTROPY), hFactor(&us, UNIT_CONV_ENTROPY) ); */
message( "Density units: %e a^%f h^%f.", conversionFactor(&us, UNIT_CONV_DENSITY), aFactor(&us, UNIT_CONV_DENSITY), hFactor(&us, UNIT_CONV_DENSITY) );
message( "Entropy units: %e a^%f h^%f.", conversionFactor(&us, UNIT_CONV_ENTROPY), aFactor(&us, UNIT_CONV_ENTROPY), hFactor(&us, UNIT_CONV_ENTROPY) );
}
/* Read particles and space information from (GADGET) IC */
......@@ -922,7 +923,7 @@ int main ( int argc , char *argv[] ) {
/* Write the state of the system as it is before starting time integration. */
tic = getticks();
#ifdef WITH_MPI
write_output_parallel(&e, myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL);
write_output_parallel(&e, &us, myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL);
#else
write_output(&e);
#endif
......@@ -971,7 +972,7 @@ int main ( int argc , char *argv[] ) {
if ( j % 100 == 0 )
{
#ifdef WITH_MPI
write_output_parallel(&e, myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL);
write_output_parallel(&e, &us, myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL);
#else
write_output(&e);
#endif
......@@ -1016,7 +1017,7 @@ int main ( int argc , char *argv[] ) {
/* Write final output. */
#ifdef WITH_MPI
write_output_parallel( &e, myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL );
write_output_parallel( &e, &us, myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL );
#else
write_output( &e );
#endif
......
......@@ -520,7 +520,7 @@ void writeAttribute_s(hid_t grp, char* name, char* str)
*
* Calls #error() if an error occurs.
*/
void writeArrayBackEnd(hid_t grp, char* fileName, FILE* xmfFile, char* name, enum DATA_TYPE type, int N, int dim, char* part_c)
void writeArrayBackEnd(hid_t grp, char* fileName, FILE* xmfFile, char* name, enum DATA_TYPE type, int N, int dim, char* part_c /*, struct UnitSystem* us, enum UnitConversionFactor convFact */)
{
hid_t h_data=0, h_err=0, h_space=0;
void* temp = 0;
......@@ -606,7 +606,7 @@ void writeArrayBackEnd(hid_t grp, char* fileName, FILE* xmfFile, char* name, enu
* @param field The name (code name) of the field to read from.
*
*/
#define writeArray(grp, fileName, xmfFile, name, type, N, dim, part, field) writeArrayBackEnd(grp, fileName, xmfFile, name, type, N, dim, (char*)(&(part[0]).field))
#define writeArray(grp, fileName, xmfFile, name, type, N, dim, part, field /*, us, unitConv */) writeArrayBackEnd(grp, fileName, xmfFile, name, type, N, dim, (char*)(&(part[0]).field))
/**
* @brief Writes an HDF5 output file (GADGET-3 type) with its XMF descriptor
......
......@@ -43,6 +43,7 @@
#include "engine.h"
#include "error.h"
#include "kernel.h"
#include "units.h"
/**
* @brief The different types of data used in the GADGET IC files.
......@@ -549,9 +550,9 @@ void writeSPHflavour(hid_t h_file)
{
hid_t h_grpsph=0;
h_grpsph = H5Gcreate1(h_file, "/Header/SPH", 0);
h_grpsph = H5Gcreate1(h_file, "/SPH", 0);
if(h_grpsph < 0)
error("Error while creating SPH header\n");
error("Error while creating SPH group");
writeAttribute_f(h_grpsph, "Kernel eta", const_eta_kernel);
writeAttribute_f(h_grpsph, "Weighted N_ngb", kernel_nwneigh);
......@@ -579,10 +580,31 @@ void writeSPHflavour(hid_t h_file)
writeAttribute_f(h_grpsph, "Maximal Delta u change over dt", const_max_u_change);
writeAttribute_s(h_grpsph, "Kernel", kernel_name);
/* Close headers */
H5Gclose(h_grpsph);
}
/**
* @brief Writes the current Unit System
* @param h_file The (opened) HDF5 file in which to write
*/
void writeUnitSystem(hid_t h_file, struct UnitSystem* us)
{
hid_t h_grpunit=0;
h_grpunit = H5Gcreate1(h_file, "/Units", 0);
if(h_grpunit < 0)
error("Error while creating Unit System group");
writeAttribute_d(h_grpunit, "Unit mass in cgs", getBaseUnit(us, UNIT_MASS));
writeAttribute_d(h_grpunit, "Unit length in cgs", getBaseUnit(us, UNIT_LENGTH));
writeAttribute_d(h_grpunit, "Unit time in cgs", getBaseUnit(us, UNIT_TIME));
writeAttribute_d(h_grpunit, "Unit current in cgs", getBaseUnit(us, UNIT_CURRENT));
writeAttribute_d(h_grpunit, "Unit temperature in cgs", getBaseUnit(us, UNIT_TEMPERATURE));
H5Gclose(h_grpunit);
}
/**
* @brief Writes a data array in given HDF5 group.
*
......@@ -596,13 +618,15 @@ void writeSPHflavour(hid_t h_file)
* @param N_total Total number of particles across all cores
* @param offset Offset in the array where this mpi task starts writing
* @param part_c A (char*) pointer on the first occurence of the field of interest in the parts array
* @param us The UnitSystem currently in use
* @param convFactor The UnitConversionFactor for this array
*
* @todo A better version using HDF5 hyperslabs to write the file directly from the part array
* will be written once the strucutres have been stabilized.
*
* Calls #error() if an error occurs.
*/
void writeArrayBackEnd(hid_t grp, char* fileName, FILE* xmfFile, char* name, enum DATA_TYPE type, int N, int dim, int N_total, int mpi_rank, int offset, char* part_c)
void writeArrayBackEnd(hid_t grp, char* fileName, FILE* xmfFile, char* name, enum DATA_TYPE type, int N, int dim, int N_total, int mpi_rank, int offset, char* part_c, struct UnitSystem* us, enum UnitConversionFactor convFactor)
{
hid_t h_data=0, h_err=0, h_memspace=0, h_filespace=0, h_plist_id=0;
hsize_t shape[2], shape_total[2], offsets[2];
......@@ -612,6 +636,7 @@ void writeArrayBackEnd(hid_t grp, char* fileName, FILE* xmfFile, char* name, enu
const size_t copySize = typeSize * dim;
const size_t partSize = sizeof(struct part);
char* temp_c = 0;
char buffer[150];
/* message("Writing '%s' array...", name); */
......@@ -694,6 +719,13 @@ void writeArrayBackEnd(hid_t grp, char* fileName, FILE* xmfFile, char* name, enu
if(mpi_rank == 0)
writeXMFline(xmfFile, fileName, name, N_total, dim, type);
/* Write unit conversion factors for this data set */
conversionString( buffer, us, convFactor );
writeAttribute_d( h_data, "CGS conversion factor", conversionFactor( us, convFactor ) );
writeAttribute_d( h_data, "h-scale exponant", hFactor( us, convFactor ) );
writeAttribute_d( h_data, "a-scale exponant", aFactor( us, convFactor ) );
writeAttribute_s( h_data, "Conversion factor", buffer );
/* Free and close everything */
free(temp);
......@@ -717,9 +749,11 @@ void writeArrayBackEnd(hid_t grp, char* fileName, FILE* xmfFile, char* name, enu
* @param offset Offset in the array where this mpi task starts writing
* @param part A (char*) pointer on the first occurence of the field of interest in the parts array
* @param field The name (code name) of the field to read from.
* @param us The UnitSystem currently in use
* @param convFactor The UnitConversionFactor for this array
*
*/
#define writeArray(grp, fileName, xmfFile, name, type, N, dim, part, N_total, mpi_rank, offset, field) writeArrayBackEnd(grp, fileName, xmfFile, name, type, N, dim, N_total, mpi_rank, offset, (char*)(&(part[0]).field))
#define writeArray(grp, fileName, xmfFile, name, type, N, dim, part, N_total, mpi_rank, offset, field, us, convFactor) writeArrayBackEnd(grp, fileName, xmfFile, name, type, N, dim, N_total, mpi_rank, offset, (char*)(&(part[0]).field), us, convFactor)
/**
* @brief Writes an HDF5 output file (GADGET-3 type) with its XMF descriptor
......@@ -734,7 +768,7 @@ void writeArrayBackEnd(hid_t grp, char* fileName, FILE* xmfFile, char* name, enu
* Calls #error() if an error occurs.
*
*/
void write_output_parallel (struct engine *e, int mpi_rank, int mpi_size, MPI_Comm comm, MPI_Info info)
void write_output_parallel (struct engine *e, struct UnitSystem* us, int mpi_rank, int mpi_size, MPI_Comm comm, MPI_Info info)
{
hid_t h_file=0, h_grp=0;
......@@ -823,6 +857,9 @@ void write_output_parallel (struct engine *e, int mpi_rank, int mpi_size, MPI_Co
/* Print the SPH parameters */
writeSPHflavour(h_file);
/* Print the system of Units */
writeUnitSystem(h_file, us);
/* Close header */
H5Gclose(h_grp);
......@@ -833,15 +870,15 @@ void write_output_parallel (struct engine *e, int mpi_rank, int mpi_size, MPI_Co
error( "Error while creating particle group.\n");
/* Write arrays */
writeArray(h_grp, fileName, xmfFile, "Coordinates", DOUBLE, N, 3, parts, N_total, mpi_rank, offset, x);
writeArray(h_grp, fileName, xmfFile, "Velocities", FLOAT, N, 3, parts, N_total, mpi_rank, offset, v);
writeArray(h_grp, fileName, xmfFile, "Masses", FLOAT, N, 1, parts, N_total, mpi_rank, offset, mass);
writeArray(h_grp, fileName, xmfFile, "SmoothingLength", FLOAT, N, 1, parts, N_total, mpi_rank, offset, h);
writeArray(h_grp, fileName, xmfFile, "InternalEnergy", FLOAT, N, 1, parts, N_total, mpi_rank, offset, u);
writeArray(h_grp, fileName, xmfFile, "ParticleIDs", ULONGLONG, N, 1, parts, N_total, mpi_rank, offset, id);
writeArray(h_grp, fileName, xmfFile, "TimeStep", FLOAT, N, 1, parts, N_total, mpi_rank, offset, dt);
writeArray(h_grp, fileName, xmfFile, "Acceleration", FLOAT, N, 3, parts, N_total, mpi_rank, offset, a);
writeArray(h_grp, fileName, xmfFile, "Density", FLOAT, N, 1, parts, N_total, mpi_rank, offset, rho);
writeArray(h_grp, fileName, xmfFile, "Coordinates", DOUBLE, N, 3, parts, N_total, mpi_rank, offset, x, us, UNIT_CONV_LENGTH);
writeArray(h_grp, fileName, xmfFile, "Velocities", FLOAT, N, 3, parts, N_total, mpi_rank, offset, v, us, UNIT_CONV_SPEED);
writeArray(h_grp, fileName, xmfFile, "Masses", FLOAT, N, 1, parts, N_total, mpi_rank, offset, mass, us, UNIT_CONV_MASS);
writeArray(h_grp, fileName, xmfFile, "SmoothingLength", FLOAT, N, 1, parts, N_total, mpi_rank, offset, h, us, UNIT_CONV_LENGTH);
writeArray(h_grp, fileName, xmfFile, "InternalEnergy", FLOAT, N, 1, parts, N_total, mpi_rank, offset, u, us, UNIT_CONV_ENERGY_PER_UNIT_MASS);
writeArray(h_grp, fileName, xmfFile, "ParticleIDs", ULONGLONG, N, 1, parts, N_total, mpi_rank, offset, id, us, UNIT_CONV_NO_UNITS);
writeArray(h_grp, fileName, xmfFile, "TimeStep", FLOAT, N, 1, parts, N_total, mpi_rank, offset, dt, us, UNIT_CONV_TIME);
writeArray(h_grp, fileName, xmfFile, "Acceleration", FLOAT, N, 3, parts, N_total, mpi_rank, offset, a, us, UNIT_CONV_ACCELERATION);
writeArray(h_grp, fileName, xmfFile, "Density", FLOAT, N, 1, parts, N_total, mpi_rank, offset, rho, us, UNIT_CONV_DENSITY);
/* Close particle group */
H5Gclose(h_grp);
......
......@@ -22,7 +22,7 @@
void read_ic_parallel ( char* fileName, double dim[3], struct part **parts, int* N, int* periodic, int mpi_rank, int mpi_size, MPI_Comm comm, MPI_Info info);
void write_output_parallel ( struct engine* e, int mpi_rank, int mpi_size, MPI_Comm comm, MPI_Info info);
void write_output_parallel ( struct engine* e, struct UnitSystem* us, int mpi_rank, int mpi_size, MPI_Comm comm, MPI_Info info);
#endif
......@@ -36,10 +36,11 @@
#include "queue.h"
#include "runner.h"
#include "engine.h"
#include "units.h"
#include "io.h"
#include "parallel_io.h"
#include "debug.h"
#include "units.h"
#ifdef LEGACY_GADGET2_SPH
#include "runner_iact_legacy.h"
......
......@@ -49,11 +49,67 @@ void initUnitSystem(struct UnitSystem* us)
us->UnitTemperature_in_cgs = 1.;
}
/**
* @brief Returns the base unit conversion factor for a given unit system
* @param us The UnitSystem used
* @param baseUnit The base unit
*/
double getBaseUnit(struct UnitSystem* us, enum BaseUnits baseUnit)
{
switch(baseUnit)
{
case UNIT_MASS: return us->UnitMass_in_cgs;
case UNIT_LENGTH: return us->UnitLength_in_cgs;
case UNIT_TIME: return us->UnitTime_in_cgs;
case UNIT_CURRENT: return us->UnitCurrent_in_cgs;
case UNIT_TEMPERATURE: return us->UnitTemperature_in_cgs;
default: error( "Invalid base Unit" );
}
}
/**
* @brief Returns the base unit symbol
* @param baseUnit The base unit
*/
const char* getBaseUnitSymbol(enum BaseUnits baseUnit)
{
switch(baseUnit)
{
case UNIT_MASS: return "U_M";
case UNIT_LENGTH: return "U_L";
case UNIT_TIME: return "U_t";
case UNIT_CURRENT: return "U_I";
case UNIT_TEMPERATURE: return "U_T";
default: error( "Invalid base Unit" );
}
}
/**
* @brief Returns the base unit symbol in the cgs system
* @param baseUnit The base unit
*/
const char* getBaseUnitCGSSymbol(enum BaseUnits baseUnit)
{
switch(baseUnit)
{
case UNIT_MASS: return "g";
case UNIT_LENGTH: return "cm";
case UNIT_TIME: return "s";
case UNIT_CURRENT: return "A";
case UNIT_TEMPERATURE: return "K";
default: error( "Invalid base Unit" );
}
}
void getBaseUnitExponantsArray(float baseUnitsExp[5], enum UnitConversionFactor unit)
{
switch( unit )
{
case UNIT_CONV_NO_UNITS:
break;
case UNIT_CONV_MASS:
baseUnitsExp[UNIT_MASS] = 1; break;
......@@ -87,6 +143,9 @@ void getBaseUnitExponantsArray(float baseUnitsExp[5], enum UnitConversionFactor
case UNIT_CONV_ENTROPY:
baseUnitsExp[UNIT_MASS] = 1. - const_hydro_gamma; baseUnitsExp[UNIT_LENGTH] = 3.*const_hydro_gamma - 1.; baseUnitsExp[UNIT_TIME] = -2; break;
case UNIT_CONV_ENTROPY_PER_UNIT_MASS:
baseUnitsExp[UNIT_MASS] = -const_hydro_gamma; baseUnitsExp[UNIT_LENGTH] = 3.*const_hydro_gamma - 1.; baseUnitsExp[UNIT_TIME] = -2; break;
case UNIT_CONV_POWER:
baseUnitsExp[UNIT_MASS] = 1; baseUnitsExp[UNIT_LENGTH] = 2; baseUnitsExp[UNIT_TIME] = -3; break;
......@@ -104,7 +163,7 @@ void getBaseUnitExponantsArray(float baseUnitsExp[5], enum UnitConversionFactor
*/
double conversionFactor(struct UnitSystem* us, enum UnitConversionFactor unit)
{
float baseUnitsExp[5] = { 0, 0, 0, 0, 0 };
float baseUnitsExp[5] = { 0.f };
getBaseUnitExponantsArray(baseUnitsExp, unit);
......@@ -118,7 +177,7 @@ double conversionFactor(struct UnitSystem* us, enum UnitConversionFactor unit)
*/
double hFactor(struct UnitSystem* us, enum UnitConversionFactor unit)
{
float baseUnitsExp[5] = { 0, 0, 0, 0, 0 };
float baseUnitsExp[5] = { 0.f };
getBaseUnitExponantsArray(baseUnitsExp, unit);
......@@ -134,7 +193,7 @@ double hFactor(struct UnitSystem* us, enum UnitConversionFactor unit)
*/
double aFactor(struct UnitSystem* us, enum UnitConversionFactor unit)
{
float baseUnitsExp[5] = { 0, 0, 0, 0, 0 };
float baseUnitsExp[5] = { 0.f };
getBaseUnitExponantsArray(baseUnitsExp, unit);
......@@ -143,11 +202,24 @@ double aFactor(struct UnitSystem* us, enum UnitConversionFactor unit)
}
/**
* @brief Returns a string containg the exponants of the base units making up the conversion factors
*/
void conversionString(char * buffer, struct UnitSystem* us, enum UnitConversionFactor unit)
{
float baseUnitsExp[5] = { 0.f };
getBaseUnitExponantsArray(baseUnitsExp, unit);
generalConversionString(buffer, us, baseUnitsExp);
}
/**
* @brief Returns the conversion factor for a given unit (expressed in terms of the 5 fundamental units) in the chosen unit system
* @param us The unit system used
* @param baseUnitsExponants The exponant (integer) of each base units required to form the desired quantity. See conversionFactor() for a working example
* @param baseUnitsExponants The exponant of each base units required to form the desired quantity. See conversionFactor() for a working example
*/
double generalConversionFactor(struct UnitSystem* us, float baseUnitsExponants[5])
{
......@@ -156,7 +228,7 @@ double generalConversionFactor(struct UnitSystem* us, float baseUnitsExponants[5
for(i = 0 ; i < 5 ; ++i )
if(baseUnitsExponants[i] != 0)
factor *= pow( *( &( us->UnitMass_in_cgs ) + i ) , baseUnitsExponants[i] );
factor *= pow( getBaseUnit( us, i ) , baseUnitsExponants[i] );
return factor;
}
......@@ -165,7 +237,7 @@ double generalConversionFactor(struct UnitSystem* us, float baseUnitsExponants[5
/**
* @brief Returns the h factor exponentiation for a given unit (expressed in terms of the 5 fundamental units)
* @param us The unit system used
* @param baseUnitsExponants The exponant (integer) of each base units required to form the desired quantity. See conversionFactor() for a working example
* @param baseUnitsExponants The exponant of each base units required to form the desired quantity. See conversionFactor() for a working example
*/
double generalhFactor(struct UnitSystem* us, float baseUnitsExponants[5])
{
......@@ -182,7 +254,7 @@ double generalhFactor(struct UnitSystem* us, float baseUnitsExponants[5])
/**
* @brief Returns the scaling factor exponentiation for a given unit (expressed in terms of the 5 fundamental units)
* @param us The unit system used
* @param baseUnitsExponants The exponant (integer) of each base units required to form the desired quantity. See conversionFactor() for a working example
* @param baseUnitsExponants The exponant of each base units required to form the desired quantity. See conversionFactor() for a working example
*/
double generalaFactor(struct UnitSystem* us, float baseUnitsExponants[5])
{
......@@ -192,3 +264,65 @@ double generalaFactor(struct UnitSystem* us, float baseUnitsExponants[5])
return factor_exp;
}
/**
* @brief Returns a string containg the exponants of the base units making up the conversion factors (expressed in terms of the 5 fundamental units)
* @param buffer The buffer in which to write (The buffer must be long enough, 140 chars at most)
* @param us The UnistSystem in use.
* @param baseUnitsExponants The exponant of each base units required to form the desired quantity. See conversionFactor() for a working example
*/
void generalConversionString(char * buffer, struct UnitSystem* us, float baseUnitsExponants[5])
{
char temp[14];
double a_exp = generalaFactor(us, baseUnitsExponants);
double h_exp = generalhFactor(us, baseUnitsExponants);
int i;
/* Add a-factor */
if(a_exp == 1)
sprintf(buffer, "h");
else if(remainder(a_exp, 1.) == 0)
sprintf(buffer, "a^%d ", (int) a_exp);
else
sprintf(buffer, "a^%7.4f ", a_exp);
/* Add h-factor */
if(h_exp == 1)
sprintf(temp, "h");
else if(remainder(h_exp, 1.) == 0)
sprintf(temp, "h^%d ", (int) h_exp);
else
sprintf(temp, "h^%7.4f ", h_exp);
strncat(buffer, temp, 12);
/* Add conversion units */
for(i = 0 ; i < 5 ; ++i )
if(baseUnitsExponants[i] != 0)
{
if(baseUnitsExponants[i] == 1.)
sprintf(temp, "%s ", getBaseUnitSymbol(i));
else if(remainder(baseUnitsExponants[i], 1.) == 0)
sprintf(temp, "%s^%d ", getBaseUnitSymbol(i), (int) baseUnitsExponants[i]);
else
sprintf(temp, "%s^%7.4f ", getBaseUnitSymbol(i), baseUnitsExponants[i]);
strncat(buffer, temp, 12);
}
/* Add CGS units */
strncat(buffer, " [", 2);
for(i = 0 ; i < 5 ; ++i )
if(baseUnitsExponants[i] != 0)
{
if(baseUnitsExponants[i] == 1.)
sprintf(temp, "%s ", getBaseUnitCGSSymbol(i));
else if(remainder(baseUnitsExponants[i], 1.) == 0)
sprintf(temp, "%s^%d ", getBaseUnitCGSSymbol(i), (int) baseUnitsExponants[i]);
else
sprintf(temp, "%s^%7.4f ", getBaseUnitCGSSymbol(i), baseUnitsExponants[i]);
strncat(buffer, temp, 12);
}
strncat(buffer, "]", 2);
}
......@@ -56,6 +56,7 @@ enum BaseUnits
*/
enum UnitConversionFactor
{
UNIT_CONV_NO_UNITS,
UNIT_CONV_MASS,
UNIT_CONV_LENGTH,
UNIT_CONV_TIME,
......@@ -66,9 +67,10 @@ enum UnitConversionFactor
UNIT_CONV_ENERGY,
UNIT_CONV_ENERGY_PER_UNIT_MASS,
UNIT_CONV_ENTROPY,
UNIT_CONV_ENTROPY_PER_UNIT_MASS,
UNIT_CONV_POWER,
UNIT_CONV_PRESSURE,
UNIT_CONV_FREQUENCY
UNIT_CONV_FREQUENCY,
};
......@@ -77,6 +79,21 @@ enum UnitConversionFactor
*/
void initUnitSystem(struct UnitSystem*);
/**
* @brief Returns the base unit conversion factor for a given unit system
*/
double getBaseUnit(struct UnitSystem*, enum BaseUnits);
/**
* @brief Returns the base unit symbol in the cgs system
*/
const char* getBaseUnitSymbol(enum BaseUnits);
/**
* @brief Returns the base unit symbol in the cgs system
*/
const char* getBaseUnitCGSSymbol(enum BaseUnits);
/**
* @brief Returns the conversion factor for a given unit (expressed in terms of the 5 fundamental units) in the chosen unit system
......@@ -112,3 +129,15 @@ double generalaFactor(struct UnitSystem* us, float baseUnitsExponants[5]);
* @brief Returns the scaling factor for a given unit in the chosen unit system
*/
double aFactor(struct UnitSystem* us, enum UnitConversionFactor unit);
/**
* @brief Returns a string containg the exponants of the base units making up the conversion factors (expressed in terms of the 5 fundamental units)
*/
void generalConversionString(char * buffer, struct UnitSystem* us, float baseUnitsExponants[5]);
/**
* @brief Returns a string containg the exponants of the base units making up the conversion factors
*/
void conversionString(char * buffer, struct UnitSystem* us, enum UnitConversionFactor unit);
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