OpenPFC  0.1.4
Phase Field Crystal simulation framework
Loading...
Searching...
No Matches
field_modifier_registry.hpp File Reference

Registry for field modifiers (initial conditions and boundary conditions) More...

Include dependency graph for field_modifier_registry.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  pfc::ui::FieldModifierRegistry
 A registry for field modifiers used in the application. More...
 
struct  pfc::ui::FieldModifierInitializer
 Helper struct for registering field modifiers during static initialization. More...
 

Typedefs

using pfc::ui::FieldModifier_p = std::unique_ptr< FieldModifier >
 

Functions

template<typename T >
void pfc::ui::register_field_modifier (const std::string &type)
 Register a field modifier type with the FieldModifierRegistry.
 
std::unique_ptr< FieldModifierpfc::ui::create_field_modifier (const std::string &type, const json &params)
 Create an instance of a field modifier based on its type.
 

Detailed Description

Registry for field modifiers (initial conditions and boundary conditions)

This header provides a registry system for field modifiers that allows dynamic registration and creation of field modifiers from JSON configuration. It supports both initial conditions and boundary conditions.

Author
OpenPFC Development Team
Date
2025

Function Documentation

◆ create_field_modifier()

std::unique_ptr< FieldModifier > pfc::ui::create_field_modifier ( const std::string &  type,
const json &  params 
)

Create an instance of a field modifier based on its type.

Parameters
typeThe type string of the field modifier to create.
paramsA json object describing the parameters for field modifier.
Returns
Pointer to the created field modifier instance.
Exceptions
std::invalid_argumentif the specified type is not registered.

This function creates an instance of a field modifier based on its registered type. It retrieves the registered creator function associated with the specified type string from the FieldModifierRegistry and uses it to create the field modifier instance.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ register_field_modifier()

template<typename T >
void pfc::ui::register_field_modifier ( const std::string &  type)

Register a field modifier type with the FieldModifierRegistry.

Template Parameters
TThe type of the field modifier to register.
Parameters
typeThe type string associated with the field modifier.

This function registers a field modifier type with the FieldModifierRegistry. It associates the specified type string with a creator function that creates an instance of the field modifier.

Here is the call graph for this function:
Here is the caller graph for this function: