Miscellaneous

Functions for data preparation and error evaluation

miscellaneous.error_evaluation.compute_integral_error(multipatch, fields_original, fields_recreated, norm='l2')

Compute integral error between original and recreated fields

miscellaneous.error_evaluation.get_solution_vectors(file_path: str, two_dimensional=False)

Load XML file to numpy array

miscellaneous.error_evaluation.integrate(bezier, field)

Integrate field over Bezier patch

miscellaneous.error_evaluation.integrate_multipatch(multipatch, fields)

Integrate field over multipatch geometry

miscellaneous.error_evaluation.l1func(orig, rec)
miscellaneous.error_evaluation.l1relfunc(orig, rec)
miscellaneous.error_evaluation.l2func(orig, rec)
miscellaneous.error_evaluation.l2relfunc(orig, rec)
miscellaneous.error_evaluation.load_geometry(filename, degree_elevations=0, h_refinements=0)

Load geometry and for velocity perform one degree elevation (Taylor-Hood elements)

filename: str

Filename of xml-file

miscellaneous.error_evaluation.show_multipatch_field(mp, solution_vectors, data_name='solution')

Show a field defined on a multipatch

Parameters:
  • mp (splinepy Multipatch) – Multipatch geometry object

  • solution_vectors (list<np.ndarray>) – List of patch solution vectors

miscellaneous.DataPreparation.get_matrix_size(file_path: str) int

Calculates the size of the matrix in the XML file.

Parameters:

file_path (str) – Path to the XML file.

Returns:

Number of rows in the matrix.

Return type:

int

miscellaneous.DataPreparation.load_xml_to_numpy(file_path: str) ndarray

Loads an XML file containing a matrix and returns it as a NumPy array.

Parameters:

file_path (str) – Path to the XML file.

Returns:

NumPy array containing the matrix data.

Return type:

np.ndarray

miscellaneous.DataPreparation.reconstruct_array(reduced_arr, zero_indices, original_shape)

Reconstruct the original array by reinserting zero rows at their original positions.

Parameters:
  • reduced_arr (np.ndarray) – Array with zero rows removed

  • zero_indices (np.ndarray) – Indices where zero rows were removed

  • original_shape (tuple) – Shape of the original array

Returns:

Reconstructed array with zero rows restored

Return type:

np.ndarray

miscellaneous.DataPreparation.save_numpy_to_xml(data: ndarray, file_path: str, rows: float, cols: float) None

Saves a numpy array to a new XML file with the given number of rows and columns.

Parameters:
  • data (np.ndarray) – NumPy array to save.

  • file_path (str) – Path to the XML file.

  • rows (float) – Row identifier for XML file.

  • cols (float) – Column identifier for XML file.