SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
mesh::RefineHook Struct Reference

Callbacks consulted by Triangle's -u user test. More...

#include <trirefinehook.h>

Collaboration diagram for mesh::RefineHook:

Public Attributes

std::function< bool()> isCancelled
 
std::function< double(double x, double y)> targetAreaAt
 
std::function< void(qint64 testCount)> onProgress
 

Detailed Description

Callbacks consulted by Triangle's -u user test.

Every member is optional. A hook with all members empty is equivalent to not passing -u at all (every triangle is reported suitable), so installing one never changes the mesh by itself.

Member Data Documentation

◆ isCancelled

std::function<bool()> mesh::RefineHook::isCancelled

Polled periodically during refinement. Returning true stops further refinement; generate() then reports failure rather than a partial mesh. Must be cheap and thread-safe (typically reads an atomic).

◆ onProgress

std::function<void(qint64 testCount)> mesh::RefineHook::onProgress

Called every few hundred thousand tests with the running test count. Purely advisory — there is no way to know the total in advance, so this suits a busy indicator or a log line, not a percentage.

◆ targetAreaAt

std::function<double(double x, double y)> mesh::RefineHook::targetAreaAt

Maximum permitted triangle area at map coordinate (x, y), evaluated at the candidate triangle's centroid. Return <= 0 to leave the triangle unconstrained. When set, this SUPERSEDES GenerationOptions::maxAreaMeshGenerator omits the global -a<area> switch so the two cannot fight.

CAREFUL with per-region bounds (corrected 2026-08-17; this comment previously claimed they were "unaffected and still applied", which is wrong). Triangle honours RegionMarker::maxArea only when its internal vararea flag is set, and that flag is set only by a BARE a switch with no number (vendor/triangle/triangle.c:3449-3469, tested at 7390). So the two configurations differ:

  • maxArea > 0 and NO size function → a<area> is emitted, vararea stays clear, and per-region bounds are silently IGNORED;
  • size function installed → no numeric a, the bare a branch runs, and per-region bounds take effect.

Installing a size function therefore switches region area bounds on for the first time on a model that has them. Callers that care should clamp RegionMarker::maxArea to their own floor before addRegion(); the mesh generation dialog does exactly that.


The documentation for this struct was generated from the following file: