ctg.utils#

Small utilities used across the CTG codebase.

This module provides compact, well-tested helpers that operate on FE coordinates and on time slabs. The functions are intentionally simple and have predictable behaviour to ease testing and documentation.

Functions

cart_prod_coords(t_coords, x_coords)

Return the Cartesian product of time and space coordinate arrays.

compute_time_slabs(start_time, end_time, ...)

Split a time interval into consecutive slabs.

have_dolfinx()

ctg.utils.cart_prod_coords(t_coords, x_coords)[source]#

Return the Cartesian product of time and space coordinate arrays.

Parameters:
  • t_coords – Array of time coordinates (1D or (n,1) shaped).

  • x_coords – Array of space coordinates (1D or (m,1) shaped).

Returns:

2D array with rows representing pairs (t, x) from the Cartesian product of the inputs.

ctg.utils.compute_time_slabs(start_time, end_time, slab_size)[source]#

Split a time interval into consecutive slabs.

Parameters:
  • start_time – Start of the time interval.

  • end_time – End of the time interval.

  • slab_size – Desired slab size (positive float).

Returns:

List of (start, end) tuples covering [start_time, end_time].

ctg.utils.have_dolfinx()[source]#
Return type:

bool