optimad / bitpit

Open source library for scientific HPC
http://optimad.github.io/bitpit/
GNU Lesser General Public License v3.0
117 stars 33 forks source link

surfunstructured: use a better estimate of the number of vertices when importing an STL #298

Closed andrea-iob closed 2 years ago

andrea-iob commented 2 years ago

The number of facets and the number of vertices of a triangulation are related by the inequality nFacets <= 2 * nVertices - 4, where the equality holds for a closed triangulation. To limit memory usage in the case the facets are joined, we estimate the number of vertices assuming a closed triangulation (this gives us the minimum number of nodes the triangulation could possibly have).

With this change, there is a 30% reduction in the memory needed for importing a closed triangulation of 500K elements.