1#ifndef included_AMP_Material
2#define included_AMP_Material
4#include "AMP/materials/Property.h"
42 std::shared_ptr<Property>
property(
const std::string &type );
50 std::shared_ptr<const Property>
property(
const std::string &type )
const;
53 std::vector<std::string>
list()
const;
57 template<
class PROPERTY>
62 template<
class PROPERTY,
typename... Args>
65 auto name2 =
materialName() +
"::" + std::string( name );
67 std::make_shared<PROPERTY>( name2, std::forward<Args>( args )... );
72 addStringProperty( std::string_view name, std::string value, std::string_view source =
"" );
78 std::string_view source =
"" );
84 std::string_view source =
"" );
89 std::vector<double> params = {},
90 std::vector<std::string> args = {},
91 std::vector<std::array<double, 2>> ranges = {},
92 std::vector<AMP::Units> argUnits = {},
93 std::string_view source =
"" );
98 std::string expression,
99 std::vector<std::string> args = {},
100 std::vector<std::array<double, 2>> ranges = {},
101 std::vector<AMP::Units> argUnits = {},
102 std::string_view source =
"" );
127void registerMaterial(
const std::string &name, std::function<std::unique_ptr<Material>()> fun );
Construct a material from a database.
std::string d_name
Name of material.
std::string materialName() const override
Return the name of the material.
DatabaseMaterial(std::string_view name, std::shared_ptr< Database > db)
Construct a material from the database.
std::vector< std::string > list() const
return a list of all properties in this material
void addProperty(std::string_view name, std::shared_ptr< PROPERTY > property)
Add a property.
void addScalarProperty(std::string_view name, AMP::Array< double > value, const AMP::Units &unit=AMP::Units(), std::string_view source="")
Add a constant-value fixed property.
std::map< std::string, std::shared_ptr< Property > > d_propertyMap
database of scalar properties
void addEquationProperty(std::string_view name, const AMP::Units &unit, std::string expression, std::vector< std::string > args={}, std::vector< std::array< double, 2 > > ranges={}, std::vector< AMP::Units > argUnits={}, std::string_view source="")
Add an equation based propoerty.
void addProperty(std::string_view name, Args &&...args)
std::shared_ptr< Property > property(const std::string &type)
Get the desired property.
void addScalarProperty(std::string_view name, double value, const AMP::Units &unit=AMP::Units(), std::string_view source="")
Add a constant-value fixed property.
bool hasProperty(const std::string &type) const
check if a property exists in the material
virtual std::string materialName() const =0
Return the name of the material.
void addPolynomialProperty(std::string_view name, const AMP::Units &unit={}, std::vector< double > params={}, std::vector< std::string > args={}, std::vector< std::array< double, 2 > > ranges={}, std::vector< AMP::Units > argUnits={}, std::string_view source="")
Add a polynomial based property.
Material()=default
Default constructor.
void addStringProperty(std::string_view name, std::string value, std::string_view source="")
Add a constant-value fixed property.
std::shared_ptr< const Property > property(const std::string &type) const
Get the desired property.
virtual ~Material()=default
Default destructor.
Provides a class for storing units.
std::unique_ptr< Material > getMaterial(const std::string &name)
Get a material.
std::vector< std::string > getMaterialList()
Get the list of materials available.
bool isMaterial(const std::string &name)
Check if the given material exists (is registered)
void registerMaterial(const std::string &name, std::function< std::unique_ptr< Material >()> fun)
Register a material with the factory.