Domain Types#

To help with generating CoordinateMapping and SpaceMap objects based on more common ways to define domains by linearly interpolating between its boundaries, a few helper types are provided to allow for 1D and 2D deformed domain generation. To see an example of how these work, see Domain Examples.

class fdg.Line(*knots: array_like)[source]#

One dimensional object connecting two points.

Parameters:

*knots (npt.ArrayLike) – Values of knot points, that are used to interpolate the position along the line using Bernstein polynomials. All knots must have the same number of entries, but their number is not limited.

__call__(space: ~fdg._fdg.IntegrationSpace, /, *, integration_registry: ~fdg._fdg.IntegrationRegistry = <fdg._fdg.IntegrationRegistry>, basis_registry: ~fdg._fdg.BasisRegistry = <fdg._fdg.BasisRegistry object>) SpaceMap#

Create a space map based on the integration space.

Parameters:
  • space (IntegratinoSpace) – Integration space to base the space map on.

  • integration_registry (IntegrationRegistry, optional) – Integration registry to use for retrieving the integration nodes and weights.

  • basis_registry (BasisRegistry) – Basis registry to use for retrieving basis values from.

Returns:

Space mapping of the domain for the specified integration space.

Return type:

SpaceMap

compute_size(int_space: ~fdg._fdg.IntegrationSpace | None = None, *, integration_registry: ~fdg._fdg.IntegrationRegistry = <fdg._fdg.IntegrationRegistry>, basis_registry: ~fdg._fdg.BasisRegistry = <fdg._fdg.BasisRegistry object>) float#

Compute the size of the domain.

Parameters:
  • int_space (IntegrationSpace, optional) – Integration space to use for computing the size of the domain. If it is not given, a new one will be created, such that the size is computed exactly.

  • integration_registry (IntegrationRegistry, optional) – Integration registry to use for retrieving the integration nodes and weights.

  • basis_registry (BasisRegistry) – Basis registry to use for retrieving basis values from.

Returns:

Size of the domain. For a 1D domain this is the lenght, for a 2D domain this is the surface area, for a 3D domain it is the volume, and so on.

Return type:

float

integrate(fn: ~fdg.integration.Integrable, int_space: ~fdg._fdg.IntegrationSpace, *, integration_registry: ~fdg._fdg.IntegrationRegistry = <fdg._fdg.IntegrationRegistry>, basis_registry: ~fdg._fdg.BasisRegistry = <fdg._fdg.BasisRegistry object>) float#

Integrates the callable.

Parameters:
  • fn (Integrable) – Callable to integrate.

  • int_space (IntegrationSpace) – Integration space to use for integration.

  • integration_registry (IntegrationRegistry, default: DEFAULT_INTEGRATION_REGISTRY) – Integration registry to use for retrieving integration rules.

  • basis_registry (BasisRegistry, default: DEFAULT_BASIS_REGISTRY) – Basis registry to use for retrieving basis values.

Returns:

Result of integrating the callable on the domain.

Return type:

float

reverse() Line[source]#

Reverse the orientation of the line.

Returns:

Line which has its orientation flipped.

Return type:

Line

sample(*x: npt.NDArray[np.double]) tuple[npt.NDArray[np.double], ...]#

Sample coordinates in the physical domain.

Parameters:

*x (array) – Arrays of coordinate positions to evaluate the points in domain at.

Returns:

Arrays with the shape of x, containing values of coordinates at the specified points.

Return type:

tuple of array

subregion(*ranges: tuple[float, float]) HypercubeDomain#

Split self into a sub-region of the domain.

Parameters:

*ranges ((float, float)) – Range of the domain to include for each dimension.

Returns:

Subregion of the domain, where the boundaries are determined from where the ranges parameters constrain the original domain.

Return type:

HypercubeDomain

dofs: tuple[DegreesOfFreedom, ...]#
property end: npt.NDArray[np.double]#

The end point of the line.

property endpoints: tuple[npt.NDArray[np.double], ...]#

Return the end points of the domain.

property function_space: FunctionSpace#

Function space used by all the DoFs.

knots: ndarray[tuple[Any, ...], dtype[float64]]#
property ndim_physical: int#

Number of physical dimensions of the domain.

property ndim_reference: int#

Number of reference dimensions of the domain.

property start: npt.NDArray[np.double]#

The start point of the line.

class fdg.Quad(bottom: Line, right: Line, top: Line, left: Line)[source]#

Two dimensional object with four corners.

Parameters:
  • bottom (Line) – Bottom boundary along which the second dimension is -1. Starts where the left boundary ends and ends where the right boundary starts.

  • right (Line) – Right boundary along which the first dimension is +1. Starts where the bottom boundary ends and ends where the top boundary starts.

  • top (Line) – Top boundary along which the second dimension is +1. Starts where the right boundary ends and ends where the left boundary starts.

  • left (Line) – Left boundary along which the first dimension is -1. Starts where the top boundary ends and ends where the bottom boundary starts.

classmethod from_corners(bottom_left: array_like, bottom_right: array_like, top_right: array_like, top_left: array_like) Self[source]#

Create a new (linear) Quad based on four corners.

Parameters:
  • bottom_left (npt.ArrayLike) – Bottom left corner.

  • bottom_right (npt.ArrayLike) – Bottom right corner.

  • top_right (npt.ArrayLike) – Top right corner.

  • top_left (npt.ArrayLike) – Top left corner.

Returns:

Quad domain that has straight lines for its edges.

Return type:

Quad

__call__(space: ~fdg._fdg.IntegrationSpace, /, *, integration_registry: ~fdg._fdg.IntegrationRegistry = <fdg._fdg.IntegrationRegistry>, basis_registry: ~fdg._fdg.BasisRegistry = <fdg._fdg.BasisRegistry object>) SpaceMap#

Create a space map based on the integration space.

Parameters:
  • space (IntegratinoSpace) – Integration space to base the space map on.

  • integration_registry (IntegrationRegistry, optional) – Integration registry to use for retrieving the integration nodes and weights.

  • basis_registry (BasisRegistry) – Basis registry to use for retrieving basis values from.

Returns:

Space mapping of the domain for the specified integration space.

Return type:

SpaceMap

compute_size(int_space: ~fdg._fdg.IntegrationSpace | None = None, *, integration_registry: ~fdg._fdg.IntegrationRegistry = <fdg._fdg.IntegrationRegistry>, basis_registry: ~fdg._fdg.BasisRegistry = <fdg._fdg.BasisRegistry object>) float#

Compute the size of the domain.

Parameters:
  • int_space (IntegrationSpace, optional) – Integration space to use for computing the size of the domain. If it is not given, a new one will be created, such that the size is computed exactly.

  • integration_registry (IntegrationRegistry, optional) – Integration registry to use for retrieving the integration nodes and weights.

  • basis_registry (BasisRegistry) – Basis registry to use for retrieving basis values from.

Returns:

Size of the domain. For a 1D domain this is the lenght, for a 2D domain this is the surface area, for a 3D domain it is the volume, and so on.

Return type:

float

integrate(fn: ~fdg.integration.Integrable, int_space: ~fdg._fdg.IntegrationSpace, *, integration_registry: ~fdg._fdg.IntegrationRegistry = <fdg._fdg.IntegrationRegistry>, basis_registry: ~fdg._fdg.BasisRegistry = <fdg._fdg.BasisRegistry object>) float#

Integrates the callable.

Parameters:
  • fn (Integrable) – Callable to integrate.

  • int_space (IntegrationSpace) – Integration space to use for integration.

  • integration_registry (IntegrationRegistry, default: DEFAULT_INTEGRATION_REGISTRY) – Integration registry to use for retrieving integration rules.

  • basis_registry (BasisRegistry, default: DEFAULT_BASIS_REGISTRY) – Basis registry to use for retrieving basis values.

Returns:

Result of integrating the callable on the domain.

Return type:

float

sample(*x: npt.NDArray[np.double]) tuple[npt.NDArray[np.double], ...]#

Sample coordinates in the physical domain.

Parameters:

*x (array) – Arrays of coordinate positions to evaluate the points in domain at.

Returns:

Arrays with the shape of x, containing values of coordinates at the specified points.

Return type:

tuple of array

subregion(*ranges: tuple[float, float]) HypercubeDomain#

Split self into a sub-region of the domain.

Parameters:

*ranges ((float, float)) – Range of the domain to include for each dimension.

Returns:

Subregion of the domain, where the boundaries are determined from where the ranges parameters constrain the original domain.

Return type:

HypercubeDomain

dofs: tuple[DegreesOfFreedom, ...]#
property endpoints: tuple[npt.NDArray[np.double], ...]#

Return the end points of the domain.

property function_space: FunctionSpace#

Function space used by all the DoFs.

property ndim_physical: int#

Number of physical dimensions of the domain.

property ndim_reference: int#

Number of reference dimensions of the domain.