Ignition Common

API Reference

4.5.0

Encapsulates density types. More...

#include <MaterialDensity.hh>

Public Types

enum  Type {
  BEGIN = 0, STYROFOAM = BEGIN, PINE, WOOD,
  OAK, ICE, WATER, PLASTIC,
  CONCRETE, ALUMINUM, STEEL_ALLOY, STEEL_STAINLESS,
  IRON, BRASS, COPPER, TUNGSTEN,
  END
}
 Types of materials. Source: https://en.wikipedia.org/wiki/Density. More...
 

Static Public Member Functions

static double Density (const std::string &_material)
 Return the density of the given material name, or -1 if the material is not found. More...
 
static double Density (const Type _material)
 Return the density of a material. More...
 
static const std::map< Type, double > & Materials ()
 Accessor for retrieving density entries. More...
 
static std::tuple< Type, double > Nearest (const double _value, const double _epsilon=std::numeric_limits< double >::max())
 Return the material with the closest density value within _epsilon, or MATERIAL_TYPE_END if not found. More...
 
static Type NearestMaterial (const double _value, const double _epsilon=std::numeric_limits< double >::max())
 Return the material with the closest density value within _epsilon, or MATERIAL_TYPE_END if not found. More...
 

Detailed Description

Encapsulates density types.

Member Enumeration Documentation

◆ Type

enum Type
strong

Types of materials. Source: https://en.wikipedia.org/wiki/Density.

Enumerator
BEGIN 
STYROFOAM 

Styrofoam, density = 75.0 kg/m^3.

PINE 

Pine, density = 373.0 kg/m^3.

WOOD 

Wood, density = 700.0 kg/m^3.

OAK 

Oak, density = 710.0 kg/m^3.

ICE 

Ice, density = 916.0 kg/m^3.

WATER 

Water, density = 1000.0 kg/m^3.

PLASTIC 

Plastic, density = 1175.0 kg/m^3.

CONCRETE 

Concrete, density = 2000.0 kg/m^3.

ALUMINUM 

Aluminum, density = 2700.0 kg/m^3.

STEEL_ALLOY 

Steel alloy, density = 7600.0 kg/m^3.

STEEL_STAINLESS 

Stainless steel, density = 7800.0 kg/m^3.

IRON 

Iron, density = 7870.0 kg/m^3.

BRASS 

Brass, density = 8600.0 kg/m^3.

COPPER 

Copper, density = 8940.0 kg/m^3.

TUNGSTEN 

Tungsten, density = 19300.0 kg/m^3.

END 

Member Function Documentation

◆ Density() [1/2]

static double Density ( const std::string _material)
static

Return the density of the given material name, or -1 if the material is not found.

Parameters
[in]_materialName of the material, See Type.
Returns
Matching density if found, otherwise -1.

◆ Density() [2/2]

static double Density ( const Type  _material)
static

Return the density of a material.

Parameters
[in]_materialType of the material, See Type.
Returns
Matching density if found, otherwise -1.

◆ Materials()

static const std::map<Type, double>& Materials ( )
static

Accessor for retrieving density entries.

Returns
List of entries.

◆ Nearest()

static std::tuple<Type, double> Nearest ( const double  _value,
const double  _epsilon = std::numeric_limits< double >::max() 
)
static

Return the material with the closest density value within _epsilon, or MATERIAL_TYPE_END if not found.

Parameters
[in]_valueDensity value of entry to match.
[in]_epsilonAllowable range of difference between _value, and a material's density.
Returns
A tuple where the first element is the Type, and the second the density. A value of {MATERIAL_TYPE_END, -1} is returned on error.

◆ NearestMaterial()

static Type NearestMaterial ( const double  _value,
const double  _epsilon = std::numeric_limits< double >::max() 
)
static

Return the material with the closest density value within _epsilon, or MATERIAL_TYPE_END if not found.

Parameters
[in]_valueDensity value of entry to match.
[in]_epsilonAllowable range of difference between _value, and a material's density.
Returns
The nearest material type. MATERIAL_TYPE_END on error.

The documentation for this class was generated from the following file: