MaterialDensity Class Reference
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
|
strong |
Types of materials. Source: https://en.wikipedia.org/wiki/Density.
Member Function Documentation
◆ Density() [1/2]
|
static |
Return the density of the given material name, or -1 if the material is not found.
- Parameters
-
[in] _material Name of the material, See Type.
- Returns
- Matching density if found, otherwise -1.
◆ Density() [2/2]
|
static |
Return the density of a material.
- Parameters
-
[in] _material Type of the material, See Type.
- Returns
- Matching density if found, otherwise -1.
◆ Materials()
Accessor for retrieving density entries.
- Returns
- List of entries.
◆ Nearest()
|
static |
Return the material with the closest density value within _epsilon, or MATERIAL_TYPE_END if not found.
- Parameters
-
[in] _value Density value of entry to match. [in] _epsilon Allowable 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 |
Return the material with the closest density value within _epsilon, or MATERIAL_TYPE_END if not found.
- Parameters
-
[in] _value Density value of entry to match. [in] _epsilon Allowable 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: