f_decomposition module

f_decomposition.add_data_to_vtu(output_compression, spherical_compression, isovolumic_deformation, output_filepath)[source]

Adds spherical compression and isovolumic deformation data to a vtkUnstructuredGrid object, and writes it to a .vtu file.

Parameters:
  • output_compression (vtk.vtkUnstructuredGrid) – The vtkUnstructuredGrid object to which the data will be added.

  • spherical_compression (list or numpy.ndarray) – The spherical compression data to add.

  • isovolumic_deformation (list or numpy.ndarray) – The isovolumic deformation data to add.

  • output_filepath (str or pathlib.Path) – The path to the .vtu file to write.

f_decomposition.decomposition(F)[source]

Performs a decomposition of the input matrix F into spherical compression and isovolumic deformation.

Parameters:

F (numpy.ndarray) – A 3D numpy array with shape (3, 3, n), where n is the number of matrices to decompose.

Returns:

A tuple containing two 1D numpy arrays of length n. The first array represents the spherical compression of each matrix in F, and the second array represents the isovolumic deformation of each matrix.

Return type:

tuple

f_decomposition.decomposition_to_vtu(input_filepath)[source]
f_decomposition.get_F_matrix(centroid_arrays)[source]

This function takes a dictionary of centroid arrays and constructs a 3x3 matrix F.

Parameters:
  • centroid_arrays (dict) – A dictionary where keys are strings of the form “SDV_Fij_Centroid”

  • the (and values are numpy arrays representing centroids. 'i' and 'j' in the key represent)

  • indices (row and column)

Returns:

A 3x3 matrix constructed from the centroid arrays. The shape of F is (3, 3, -1), where -1 implies that the size of the last dimension is inferred so that the total size remains constant.

Return type:

F (numpy.ndarray)

f_decomposition.get_centroid_arrays(output_compression)[source]

Extracts centroid arrays from the cell data of the given output compression.

Parameters:
  • output_compression (vtk.vtkMultiBlockDataSet) – A VTK multi-block data set. The cell data of this

  • "Centroid". (data set is expected to contain arrays with names that include the word)

Returns:

A dictionary where keys are the names of the centroid arrays and values are the corresponding vtkDataArray objects. Only arrays with names that include the word “Centroid” are included in this dictionary.

Return type:

dict

f_decomposition.main()[source]
f_decomposition.read_vtu(filepath)[source]

Reads a .vtu file and returns the output of the vtkXMLUnstructuredGridReader.

Parameters:

filepath (str or pathlib.Path) – The path to the .vtu file to read.

Returns:

The output of the vtkXMLUnstructuredGridReader after reading the .vtu file.

Return type:

vtk.vtkUnstructuredGrid