Constraint Mapping¶
fdtdx.constraints.mapping.ConstraintMapping
¶
Bases: ExtendedTreeClass
A mapping that chains multiple constraint modules together.
Manages a sequence of constraint modules that transform parameters between different representations while enforcing constraints. Each module's output must match the input interface of the next module in the chain.
Attributes:
Name | Type | Description |
---|---|---|
modules |
Sequence[ConstraintModule]
|
Sequence of ConstraintModule instances to apply in order. |
_input_interface |
ConstraintInterface
|
Interface specification for input parameters. |
Source code in src/fdtdx/constraints/mapping.py
__call__(input_params)
¶
Transform input parameters through the chain of constraint modules.
Applies each constraint module in sequence to transform the input parameters, validating interface compliance between modules.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_params
|
dict[str, Array]
|
Dictionary mapping parameter names to JAX arrays. |
required |
Returns:
Type | Description |
---|---|
Array
|
The final transformed array from the last module. |
Raises:
Type | Description |
---|---|
Exception
|
If input parameters don't match module interfaces. |
Source code in src/fdtdx/constraints/mapping.py
init_modules(config, permittivity_config, output_interface)
¶
Initialize all constraint modules in the mapping chain.
Sets up each module with the simulation configuration and ensures proper interface matching between modules. The last module must output inverse permittivity values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
SimulationConfig
|
Global simulation configuration. |
required |
permittivity_config
|
dict[str, float]
|
Material permittivity values. |
required |
output_interface
|
ConstraintInterface
|
Interface specification for final output. |
required |
Returns:
Type | Description |
---|---|
Self
|
Self with initialized modules. |
Raises:
Type | Description |
---|---|
Exception
|
If output interface is invalid or modules can't form valid chain. |