|
Phyth v0.1.0
A dimensional safe C++ header-only mechanics and electromagnetics simulation library.
|
Database for managing and retrieving material properties. More...
#include <Materials.hpp>
Public Member Functions | |
| IsotropicMaterial | Get (const std::string &name) const |
| Retrieve a material by its registered name. | |
| std::vector< std::string > | ListMaterials () const |
| Get a list of all registered material names. | |
| void | RegisterMaterial (const std::string &name, const IsotropicMaterial &material) |
| Register a new material in the database. | |
Static Public Member Functions | |
| static MaterialDatabase | FromINI (const std::string &path) |
| Create a MaterialDatabase from an INI configuration file. | |
Private Attributes | |
| std::unordered_map< std::string, IsotropicMaterial > | materials_ |
| Internal storage mapping names to materials. | |
Database for managing and retrieving material properties.
Provides a central registry for isotropic materials, supporting registration, lookup, and loading from configuration files.
The database stores materials by name and returns IsotropicMaterial objects for use in structural analysis computations.
Definition at line 145 of file Materials.hpp.
|
inlinestatic |
Create a MaterialDatabase from an INI configuration file.
Parses the specified INI file and registers all materials found.
| path | Path to the INI configuration file |
| std::runtime_error | If the file cannot be opened or parsed |
Supported keys: youngs_modulus/E and poisson_ratio/nu Comments start with # or ;
Definition at line 239 of file Materials.hpp.
|
inline |
Retrieve a material by its registered name.
| name | Name of the material to retrieve |
| std::runtime_error | If material name is not found in database |
Example: auto material = db.Get("Aluminum"); auto nu = material.GetPoissonRatio();
Definition at line 162 of file Materials.hpp.
|
inline |
Get a list of all registered material names.
Example: auto names = db.ListMaterials(); for (const auto& name : names) { std::cout << "Available: " << name << std::endl; }
Definition at line 183 of file Materials.hpp.
|
inline |
Register a new material in the database.
| name | Unique identifier for the material |
| material | IsotropicMaterial object containing properties |
Example: db.RegisterMaterial("CustomSteel", IsotropicMaterial(210e9_Pa, 0.3_));
Definition at line 204 of file Materials.hpp.
|
private |
Internal storage mapping names to materials.
Definition at line 250 of file Materials.hpp.