PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800
Classes | Namespaces | Functions
Units.hh File Reference
#include <string>
#include <memory>

Go to the source code of this file.

Classes

class  pism::units::System
 
struct  pism::units::DateTime
 
class  pism::units::Unit
 
class  pism::units::Converter
 

Namespaces

 pism
 
 pism::units
 

Functions

double pism::units::convert (System::Ptr system, double input, const std::string &spec1, const std::string &spec2)
 Convert a quantity from unit1 to unit2. More...
 
bool pism::units::are_convertible (const Unit &u1, const Unit &u2)
 

Detailed Description

This file contains thin wrappers around UDUNITS-2 objects. Nothing fancy. The only purpose is to simplify memory management for objects that are stored as data members of other C++ classes.

One thing is worth mentioning, though: in UDUNITS-2, every ut_unit object contains a pointer to the unit system that was used to create it.

We use C++ shared pointers to make sure that the system a Unit instance needs is allocated during the whole life span of this instance. (De-allocating the unit system too early results in having a "dangling" pointer.)

Definition in file Units.hh.