Integration#
Many of the higher level functions need to integrate functions or differential forms over a domain. As such numerical integration is one of the cornerstones of this module. For an example of the different integration rules and their relative performance see Integration Rules.
Integration Specifications#
The way the method of integration is specified in \(N\)-dimensional space
is by “outer-product” grid, where for each dimension the method (as given by IntegrationMethod) and order of
integration is specified using IntegrationSpecs.
- class fdg.IntegrationMethod(*values)[source]#
Methods of integration which are supported.
- GAUSS = 'gauss'#
- GAUSS_LOBATTO = 'gauss-lobatto'#
- class fdg.IntegrationSpecs(order: int, /, method: Literal['gauss', 'gauss-lobatto'] = 'gauss')#
Type that describes an integration rule.
- Parameters:
- nodes(registry: IntegrationRegistry = DEFAULT_INTEGRATION_REGISTRY) numpy.typing.NDArray[numpy.double]#
Get the integration nodes.
- Parameters:
registry (fdg.IntegrationRegistry, default: DEFAULT_INTEGRATION_REGISTRY) – Registry used to retrieve the integration rule.
- Returns:
Array of integration nodes.
- Return type:
array
- weights(registry: IntegrationRegistry = DEFAULT_INTEGRATION_REGISTRY) numpy.typing.NDArray[numpy.double]#
Get the integration weights.
- Parameters:
registry (fdg.IntegrationRegistry, default: DEFAULT_INTEGRATION_REGISTRY) – Registry used to retrieve the integration rule.
- Returns:
Array of integration weights.
- Return type:
array
- method#
Method used for integration.
- Type:
_IntegrationMethodHint
Since values of integration nodes and weights are ofter reused, they are not stored inside IntegrationSpecs objects.
Instead, they are stored in IntegrationRegistry objects. By default, the fdg module provides one already,
however any number of new registries can be created.
- class fdg.IntegrationRegistry#
Registry for integration rules.
This registry contains all available integration rules and caches them for efficient retrieval.
- usage() tuple[IntegrationSpecs, ...]#
Returns a list of currently stored rules.
- fdg.DEFAULT_INTEGRATION_REGISTRY = <fdg._fdg.IntegrationRegistry>#
Registry for integration rules.
This registry contains all available integration rules and caches them for efficient retrieval.
Default
IntegrationRegistryused byfdgunless another is provided.
Integration Space#
To define how an integration should be done on a \(N\)-dimensional domain the individual specifications
for each dimension (given as IntegrationSpecs) are bundled together into IntegrationSpace.
- class fdg.IntegrationSpace(*specs : IntegrationSpecs, /)#
Integration space defined with integration rules.
Integration space defined by tensor product of integration rules in each dimension. Integration rule for each dimension are defined by an IntegrationSpecs object.
- Parameters:
*integration_specs (IntegrationSpecs) – Integration specifications for each dimension of the integration space.
- nodes(registry: IntegrationRegistry = DEFAULT_INTEGRATION_REGISTRY, /) numpy.typing.NDArray[numpy.double]#
Get the integration nodes of the space.
- registryfdg.IntegrationRegistry, default: DEFAULT_INTEGRATION_REGISTRY
Registry used to retrieve the integration rules.
- Returns:
Array of integration nodes.
- Return type:
array
- weights(registry: IntegrationRegistry = DEFAULT_INTEGRATION_REGISTRY, /) numpy.typing.NDArray[numpy.double]#
Get the integration weights of the space.
- registryfdg.IntegrationRegistry, default: DEFAULT_INTEGRATION_REGISTRY
Registry used to retrieve the integration rules.
- Returns:
Array of integration weights.
- Return type:
array
- integration_specs#
Integration specifications that define the integration space.
- Type: