FELiCS.IO.Mapping#

Module Contents#

Classes#

Mapping

Utility class for constructing index mappings between FEM spaces or DOF coordinates.

Attributes#

FELiCS.IO.Mapping.logger#
class FELiCS.IO.Mapping.Mapping#

Utility class for constructing index mappings between FEM spaces or DOF coordinates.

This class contains static methods that compute permutation arrays used to transfer values between meshes or finite element spaces with identical layouts but differing internal DOF orderings.

Initialize the Mapping object

This class is not intended to be instantiated; all functionality is provided through static methods.

Notes

  • The mapping assumes that input and output meshes have identical geometric DOF locations, possibly in different order.

  • Coordinates are rounded to 11 decimal places before comparison to avoid small floating-point inconsistencies.

static calculateMappingFromSpaces(inputSpace, outputSpace)#

Compute a DOF index mapping between two finite element spaces.

This method extracts the coordinates of DOFs from both spaces and delegates the mapping computation to calculateMappingFromDofs().

Parameters:
  • inputSpace (object) – Finite element space providing the input DOF coordinates. Must implement tabulate_dof_coordinates().

  • outputSpace (object) – Finite element space providing the output DOF coordinates. Must implement tabulate_dof_coordinates().

Returns:

One-dimensional array of indices such that output[index] = input[mapping[index]].

Return type:

numpy.ndarray

Raises:

ValueError – If the DOF coordinate arrays from the two spaces are incompatible in dimension.

static calculateMappingFromDofs(inputDofs, outputDofs)#

Compute a DOF index mapping from coordinate arrays.

The algorithm constructs a bijection between two sets of DOF coordinates by: 1. Copying the coordinate arrays, 2. Appending the original DOF indices, 3. Sorting by spatial coordinates, 4. Aligning sorted entries, 5. Extracting the permutation that maps input DOFs to output DOFs.

Parameters:
  • inputDofs (numpy.ndarray) – Array of shape (n_dofs, dim) containing input DOF coordinates.

  • outputDofs (numpy.ndarray) – Array of shape (n_dofs, dim) containing output DOF coordinates.

Returns:

One-dimensional integer array representing the mapping from input DOF indices to output DOF indices.

Return type:

numpy.ndarray

Raises:

ValueError – If the coordinate arrays have different lengths or incompatible shapes.

Notes

  • Coordinates are rounded to 11 decimal places before matching.

  • The mapping requires exact geometric correspondence of DOFs between input and output meshes.