Hook file into Doxygen.

While here, doxygenise the information describing convert::to() and
convert::from(), and the prefixes as well.
This commit is contained in:
Bård Skaflestad 2012-07-18 11:00:50 +02:00
parent ab03dfafbf
commit e690659bc5

View File

@ -35,18 +35,24 @@
#ifndef OPENRS_UNITS_HEADER #ifndef OPENRS_UNITS_HEADER
#define OPENRS_UNITS_HEADER #define OPENRS_UNITS_HEADER
/**
* \file
* Constants and routines to assist in handling units of measurement. These are
* geared towards handling common units in reservoir descriptions.
*/
namespace Opm namespace Opm
{ {
namespace prefix namespace prefix
/// Conversion prefix for units. /// Conversion prefix for units.
{ {
const double micro = 1.0e-6; const double micro = 1.0e-6; /**< Unit prefix [\f$\mu\f$] */
const double milli = 1.0e-3; const double milli = 1.0e-3; /**< Unit prefix [m] */
const double centi = 1.0e-2; const double centi = 1.0e-2; /**< Non-standard unit prefix [c] */
const double deci = 1.0e-1; const double deci = 1.0e-1; /**< Non-standard unit prefix [d] */
const double kilo = 1.0e3; const double kilo = 1.0e3; /**< Unit prefix [k] */
const double mega = 1.0e6; const double mega = 1.0e6; /**< Unit prefix [M] */
const double giga = 1.0e9; const double giga = 1.0e9; /**< Unit prefix [G] */
} // namespace prefix } // namespace prefix
namespace unit namespace unit
@ -137,15 +143,6 @@ namespace Opm
const double Poise = prefix::deci*Pas; const double Poise = prefix::deci*Pas;
/// @} /// @}
/// \name Permeability
/// @{
///
/// A porous medium with a permeability of 1 darcy permits a
/// flow (flux) of \f$1\,cm^3/s\f$ of a fluid with viscosity
/// \f$1\,cP\f$ (\f$1\,mPa\cdot s\f$) under a pressure
/// gradient of \f$1\,atm/cm\f$ acting across an area of
/// \f$1\,cm^2\f$.
///
namespace perm_details { namespace perm_details {
const double p_grad = atm / (prefix::centi*meter); const double p_grad = atm / (prefix::centi*meter);
const double area = square(prefix::centi*meter); const double area = square(prefix::centi*meter);
@ -156,47 +153,63 @@ namespace Opm
// == 1e-7 [m^2] / 101325 // == 1e-7 [m^2] / 101325
// == 9.869232667160130e-13 [m^2] // == 9.869232667160130e-13 [m^2]
} }
/// \name Permeability
/// @{
///
/// A porous medium with a permeability of 1 darcy permits a flow (flux)
/// of \f$1\,\mathit{cm}^3/s\f$ of a fluid with viscosity
/// \f$1\,\mathit{cP}\f$ (\f$1\,mPa\cdot s\f$) under a pressure gradient
/// of \f$1\,\mathit{atm}/\mathit{cm}\f$ acting across an area of
/// \f$1\,\mathit{cm}^2\f$.
///
const double darcy = perm_details::darcy; const double darcy = perm_details::darcy;
/// @} /// @}
// Unit conversion support. /**
// * Unit conversion routines.
// Note: Under the penalty of treason will you be */
//
// using namespace Opm::unit::convert;
//
// I mean it!
//
namespace convert { namespace convert {
// Convert from external units of measurements to equivalent /**
// internal units of measurements. Note: The internal units * Convert from external units of measurements to equivalent
// of measurements are *ALWAYS*, and exclusively, SI. * internal units of measurements. Note: The internal units of
// * measurements are *ALWAYS*, and exclusively, SI.
// Example: Convert a double kx, containing a permeability *
// value in units of milli-darcy (mD) to the equivalent * Example: Convert a double @c kx, containing a permeability value
// value in SI units (m^2). * in units of milli-darcy (mD) to the equivalent value in SI units
// * (i.e., \f$m^2\f$).
// using namespace Opm::unit; * \code
// using namespace Opm::prefix; * using namespace Opm::unit;
// convert::from(kx, milli*darcy); * using namespace Opm::prefix;
// * convert::from(kx, milli*darcy);
* \endcode
*
* @param[in] q Physical quantity.
* @param[in] unit Physical unit of measurement.
* @return Value of @c q in equivalent SI units of measurements.
*/
inline double from(const double q, const double unit) inline double from(const double q, const double unit)
{ {
return q * unit; return q * unit;
} }
// Convert from internal units of measurements to equivalent /**
// external units of measurements. Note: The internal units * Convert from internal units of measurements to equivalent
// of measurements are *ALWAYS*, and exclusively, SI. * external units of measurements. Note: The internal units of
// * measurements are *ALWAYS*, and exclusively, SI.
// Example: Convert a std::vector<double> p, containing *
// pressure values in the SI unit Pascal (i.e., unit::Pascal) * Example: Convert a <CODE>std::vector<double> p</CODE>, containing
// to the equivalent values in Psi (unit::psia). * pressure values in the SI unit Pascal (i.e., unit::Pascal) to the
// * equivalent values in Psi (unit::psia).
// using namespace Opm::unit; * \code
// std::transform(p.begin(), p.end(), p.begin(), * using namespace Opm::unit;
// boost::bind(convert::to, _1, psia)); * std::transform(p.begin(), p.end(), p.begin(),
// * boost::bind(convert::to, _1, psia));
* \endcode
*
* @param[in] q Physical quantity, measured in SI units.
* @param[in] unit Physical unit of measurement.
* @return Value of @c q in unit <CODE>unit</CODE>.
*/
inline double to(const double q, const double unit) inline double to(const double q, const double unit)
{ {
return q / unit; return q / unit;