Skip to content

cycletools

calc_topological_charge(phase_diffs, orientation)

Calculate the topological charge from phase differences.

Parameters:

Name Type Description Default
phase_diffs ndarray

Array of phase differences.

required
orientation int

Orientation factor, either 1 or -1.

required

Returns:

Type Description
ndarray

np.array: The calculated topological charge and wave number.

extract_boundary_cycles(phasefield)

Extract boundary cycles from mesh boundaries.

Parameters:

Name Type Description Default
phasefield PhaseField

Phasefield mesh containing vertices, faces, edges, and face_masks.

required

Returns:

Type Description
DataFrame

pd.DataFrame: DataFrame representing cycles with columns: 'time_axis', 'nodes', 'top_charge', 'wave_number', 'n_nodes'.

extract_face_cycles(phasefield)

Extract mesh face cycles.

Parameters:

Name Type Description Default
phasefield PhaseField

Phasefield mesh containing faces, phase differences for each face, and face_masks.

required

Returns:

Type Description
DataFrame

pd.DataFrame: DataFrame representing cycles with columns: 'time_axis', 'nodes', 'top_charge', 'wave_number', 'n_nodes'.

get_boundaries(polydata)

Extract boundary loops from a polydata object.

Parameters:

Name Type Description Default
polydata PolyData

The input mesh.

required

Returns:

Type Description
list[list[int]]

list[list[int]]: A list of boundary loops, where each loop is a list of point indices.

get_cutout_polydata(points, faces, face_mask)

Create a PyVista PolyData object from filtered faces.

Parameters:

Name Type Description Default
points ndarray

Array of mesh points.

required
faces ndarray

Array of mesh faces.

required
face_mask ndarray

Boolean mask to filter faces.

required

Returns:

Type Description
PolyData

pv.PolyData: The resulting PolyData object.

orient_boundary(boundary, boundary_first_edge_id, filtered_edges_id)

Orient a boundary based on the presence of its first edge in filtered edges.

Parameters:

Name Type Description Default
boundary list[int]

The boundary to orient.

required
boundary_first_edge_id int

ID of the first edge in the boundary.

required
filtered_edges_id ndarray

Array of filtered edge IDs.

required

Returns:

Type Description
tuple[list[int], int]

tuple[list[int], int]: The oriented boundary and its orientation factor (1 or -1).

split_boundaries(boundaries)

Split boundaries into simple loops.

A simple loop is defined as a boundary that does not intersect itself.

Parameters:

Name Type Description Default
boundaries list[list[int]]

List of boundary loops.

required

Returns:

Type Description
list[list[int]]

list[list[int]]: List of simple boundary loops.

split_boundary(boundary)

Split a boundary into simple loops using networkx.

Parameters:

Name Type Description Default
boundary list[int]

List of point indices forming a boundary.

required

Returns:

Type Description
list[list[int]]

list[list[int]]: List of simple boundary loops.