src.cell_centroid module
- src.cell_centroid.calculate_centroids(mesh: dict, mesh_name: str, output_dir: str = 'config', main_args: dict | None = None) DataFrame[source]
Calculate the centroid of each cell in a loaded 2D mesh.
- Parameters:
mesh (dict) – Dictionary containing ‘nodes’ and ‘cells’.
mesh_name (str) – Name of the mesh file.
output_dir (str) – Directory to save or load the centroid file.
main_args (dict) – Additional arguments for file saving.
- Returns:
DataFrame containing cell IDs and their corresponding centroids (cx, cy, cz).
- Return type:
pd.DataFrame
- src.cell_centroid.main(data: dict, paths: dict[str, str], user_opts: dict) dict[source]
Calculate the centroids of the cells in the mesh.
- Parameters:
data (dict) – Dictionary containing all the imported data, including mesh data.
paths (dict) – dictionary containing all relevant paths
user_opts (dict) – Main arguments from main.py.
- Returns:
Updated data dictionary with centroids.
- Return type:
dict