Factory for dynamic material creation and registration.
More...
#include "MaterialFactory.h"
|
| typedef MaterialFactory | Self |
| | Type alias for the MaterialFactory class itself.
|
| |
| typedef Factory | Super |
| | Type alias for the base Factory class.
|
| |
| typedef Ref< Material >(* | Constructor) (const String &name, const Properties &conf, const Properties &props, const Properties &globdat) |
| | Constructor function pointer for material creation.
|
| |
|
| static void | declare (const String &type, Constructor ctor) |
| | Register a material type with the factory.
|
| |
| static bool | exists (const String &type) |
| | Check if a material type is registered.
|
| |
| static StringVector | listKnownTypes () |
| | Get list of all registered material types.
|
| |
| static Ref< Material > | newInstance (const String &type, const String &name, const Properties &conf, const Properties &props, const Properties &globdat) |
| | Create material instance with explicit type.
|
| |
| static Ref< Material > | newInstance (const String &name, const Properties &conf, const Properties &props, const Properties &globdat) |
| | Create material instance with type from properties.
|
| |
Provides centralized registry for material types, enabling dynamic instantiation based on string identifiers. Materials register with declare() and are created with newInstance().
Supported Materials
- Author
- Til Gärtner
- See also
- Material, ElasticRodMaterial, ElastoPlasticRodMaterial, declareMaterials()
◆ Constructor
| typedef Ref< Material >(* MaterialFactory::Constructor) (const String &name, const Properties &conf, const Properties &props, const Properties &globdat) |
- Parameters
-
| name | Material instance identifier |
| conf | Configuration properties for output |
| props | Input properties with material parameters |
| globdat | Global simulation data |
- Returns
- Reference to newly created Material
◆ Self
◆ Super
◆ declare()
| void MaterialFactory::declare |
( |
const String & |
type, |
|
|
Constructor |
ctor |
|
) |
| |
|
static |
- Parameters
-
| type | Material type identifier (e.g., "ElasticRodMaterial") |
| ctor | Constructor function matching Constructor signature |
◆ exists()
| bool MaterialFactory::exists |
( |
const String & |
type | ) |
|
|
static |
- Parameters
-
- Returns
- true if registered, false otherwise
◆ listKnownTypes()
| StringVector MaterialFactory::listKnownTypes |
( |
| ) |
|
|
static |
- Returns
- Vector of registered material type identifiers
◆ newInstance() [1/2]
| Ref< Material > MaterialFactory::newInstance |
( |
const String & |
name, |
|
|
const Properties & |
conf, |
|
|
const Properties & |
props, |
|
|
const Properties & |
globdat |
|
) |
| |
|
static |
- Parameters
-
| name | Material instance name |
| conf | Configuration properties for output |
| props | Input properties containing type and parameters |
| globdat | Global simulation data |
- Returns
- Reference to created Material
- Exceptions
-
| jive::util::noSuchTypeError | if type not registered |
◆ newInstance() [2/2]
| Ref< Material > MaterialFactory::newInstance |
( |
const String & |
type, |
|
|
const String & |
name, |
|
|
const Properties & |
conf, |
|
|
const Properties & |
props, |
|
|
const Properties & |
globdat |
|
) |
| |
|
static |
- Parameters
-
| type | Material type identifier |
| name | Material instance name |
| conf | Configuration properties for output |
| props | Input properties with parameters |
| globdat | Global simulation data |
- Returns
- Reference to created Material (null if type not registered)