Skip to content

Massive speed-up of the contour extraction algorithm

Boris Basic requested to merge extract-contour-optim into main

Reference issue

None

Description

The original contour extraction algorithm, while working, was flawed in several ways. This replaces it entirely with a new one which consists in three steps:

  1. Boundary edges extraction using Cantor pairing for fast identification of unique edges.
  2. Grouping of boundary nodes into contours by using a dictionary of node neighbours for quick search.
  3. Building the list of domains with external and internal contours identification by computing the signed area of each contour using the Shoelace formula.

This substantially improves on the previous algorithm: for a mesh consisting of 369769 nodes with several islands (holes), the previous algorithm took 2.64 seconds, whereas the new algorithm takes 0.39 seconds. It is also much more efficient than the previous algorithm when using a boundary conditions file, which is no longer necessary.

Checklist

All Merge Requests:

  • Update NEWS.txt to describe your changes.
  • Run compile_telemac.py --check-code to check FORTRAN coding conventions.
  • Run pylint to check Python coding conventions.
  • If you added new files, run compile_telemac.py --clean --rescan and commit the updated cmdf file(s) accordingly.
  • Run compile_telemac.py --clean for both normal and debug configurations.
  • Run validate_telemac.py for both normal and debug configurations.
  • Run validate_telemac.py --notebook for both normal and debug configurations.
  • Run doc_telemac.py if there are any modifications in the documentation.
  • Run damocles.py --eficas if there are any modifications in the dictionaries.

Additionnaly, for a new feature:

  • Check that your feature works in both serial and parallel modes.
  • Add at least one test case to check the functionality (with documentation, graphics and VnV script)
  • Update the documentation for the module in which your feature will be available.
Edited by Boris Basic

Merge request reports