Loading...
Searching...
No Matches
meshkit::native_detail Namespace Reference

Implementation helpers of the native jobs and codecs (failure signalling, work accounting, file publication); not installed and not part of the supported API. More...

Classes

struct  Coordinate
 Exact hash-map key of an XY point: the bit patterns of its two doubles. More...
 
struct  CoordinateHash
 Hash functor for Coordinate keys in unordered containers. More...
 
class  Input
 Buffered little-endian binary reader with a running FNV-1a hash and byte count. More...
 
class  Output
 Buffered little-endian binary writer with a running FNV-1a hash and byte count. More...
 
struct  PreparedPatches
 Quad patches planned before triangulation, with the extra sources they need. More...
 
class  RegionLimits
 Bounding-volume hierarchy over quad-region bounding boxes that answers the smallest region spacing touching a footprint. More...
 
class  SourceChains
 Finds the chain of mesh edges that covers a straight source segment. More...
 
struct  Stop
 Exception object thrown by fail() to abort a native operation. More...
 
class  Transaction
 Exclusive temporary output file that commit() publishes atomically at a target path. More...
 
struct  Work
 Work-unit budget, workspace-estimate gate and cancellation poll for one operation. More...
 

Functions

bool validPath (const std::filesystem::path &p)
 Reject empty paths and paths containing an embedded NUL character.
 
void hashBytes (std::uint64_t &hash, const unsigned char *p, std::size_t n)
 Fold bytes into a running 64-bit FNV-1a hash.
 
void appendId (std::vector< std::int64_t > &values, std::int64_t id, std::size_t index)
 Append one external id to a sparse id array that stays empty while ids are 1, 2, ...
 
void appendMarker (std::vector< std::int32_t > &values, std::int32_t marker, std::size_t index)
 Append one marker to a sparse marker array that stays empty while markers are 0.
 
std::int64_t externalId (const std::vector< std::int64_t > &ids, std::size_t index)
 External id of a record from a possibly empty sparse id array.
 
std::int64_t signed64 (std::uint64_t bits)
 Reinterpret a 64-bit pattern as a two's-complement signed value.
 
std::int32_t signed32 (std::uint64_t bits)
 Reinterpret the low 32 bits of a pattern as a two's-complement signed value.
 
void setError (IOReport &r, const Stop &e)
 Copy a caught Stop into a report.
 
void setException (IOReport &r, const std::bad_alloc &)
 Record an allocation failure: status ResourceLimit, code allocation.
 
void setException (IOReport &r, const std::exception &e)
 Record any other standard exception: status Failed, code exception.
 
void validated (const Mesh &mesh, const IOOptions &o)
 Run validateMesh() with the options' limits and cancellation poll.
 
Coordinate coordinate (Point2 p)
 Build the exact key of a point, mapping -0.0 to +0.0.
 
PreparedPatches preparePatches (const JobRequest &r, const Providers &p, const std::function< double(const Box2 &)> &maximumSize, const std::function< double(const Box2 &)> &tolerance, Work &work, int attempt)
 Plan the request's fixed, authored and automatic quad patches before triangulation.
 
void fail (std::string code, std::string message, RunStatus status=RunStatus::Infeasible)
 Abort the current native operation by throwing a Stop.
 
std::uint64_t edgeKey (Index a, Index b)
 Order-independent 64-bit key of an undirected edge.
 
Box2 box (const Point2 *p, int n)
 Axis-aligned bounding box of a point array.
 
bool meets (const Box2 &a, const Box2 &b)
 Closed overlap test of two normalized boxes; touching edges or corners count.
 
bool finite (Point2 p)
 Test whether both coordinates are finite.
 
bool utf8 (const std::string &s)
 Check that a byte string is well-formed UTF-8.
 
double seconds (std::chrono::steady_clock::time_point start)
 Elapsed steady-clock time.
 

Variables

constexpr std::uint64_t hashSeed = 14695981039346656037ull
 64-bit FNV-1a offset basis, the starting value of every running hash.
 

Detailed Description

Implementation helpers of the native jobs and codecs (failure signalling, work accounting, file publication); not installed and not part of the supported API.

Function Documentation

◆ appendId()

void meshkit::native_detail::appendId ( std::vector< std::int64_t > & values,
std::int64_t id,
std::size_t index )
inline

Append one external id to a sparse id array that stays empty while ids are 1, 2, ...

The first id that differs from index + 1 materializes the implicit ids 1..index; every later call then appends.

Parameters
[in,out]valuesId array; empty means sequential one-based ids.
[in]idExternal id of record index.
[in]indexZero-based record number; calls must arrive in order 0, 1, 2, ...
Here is the caller graph for this function:

◆ appendMarker()

void meshkit::native_detail::appendMarker ( std::vector< std::int32_t > & values,
std::int32_t marker,
std::size_t index )
inline

Append one marker to a sparse marker array that stays empty while markers are 0.

The first nonzero marker materializes index zeros; every later call then appends.

Parameters
[in,out]valuesMarker array; empty means all zero.
[in]markerMarker of record index.
[in]indexZero-based record number; calls must arrive in order 0, 1, 2, ...
Here is the caller graph for this function:

◆ box()

Box2 meshkit::native_detail::box ( const Point2 * p,
int n )
inline

Axis-aligned bounding box of a point array.

Parameters
[in]pBorrowed array of at least n points (p[0] is always read).
[in]nPoint count, >= 1.
Returns
Normalized box from the minimum to the maximum coordinates; no finite check.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ coordinate()

Coordinate meshkit::native_detail::coordinate ( Point2 p)
inline

Build the exact key of a point, mapping -0.0 to +0.0.

Parameters
[in]pPoint; no tolerance is applied, so distinct doubles give distinct keys.
Returns
Key holding the bit patterns of p.x() and p.y().
Here is the call graph for this function:
Here is the caller graph for this function:

◆ edgeKey()

std::uint64_t meshkit::native_detail::edgeKey ( Index a,
Index b )
inline

Order-independent 64-bit key of an undirected edge.

Parameters
[in]aOne endpoint index.
[in]bThe other endpoint index.
Returns
min(a, b) << 32 | max(a, b).
Here is the caller graph for this function:

◆ externalId()

std::int64_t meshkit::native_detail::externalId ( const std::vector< std::int64_t > & ids,
std::size_t index )
inline

External id of a record from a possibly empty sparse id array.

Parameters
[in]idsId array; empty means sequential one-based ids.
[in]indexZero-based record number; must be in range when ids is non-empty.
Returns
index + 1 when ids is empty, otherwise ids[index].
Here is the caller graph for this function:

◆ fail()

void meshkit::native_detail::fail ( std::string code,
std::string message,
RunStatus status = RunStatus::Infeasible )
inline

Abort the current native operation by throwing a Stop.

Parameters
[in]codeMachine-readable failure code, moved into the exception.
[in]messageEnglish explanation, moved into the exception.
[in]statusReport status; Infeasible by default.
Here is the caller graph for this function:

◆ finite()

bool meshkit::native_detail::finite ( Point2 p)
inline

Test whether both coordinates are finite.

Parameters
[in]pPoint to test.
Returns
False when either coordinate is NaN or infinite.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hashBytes()

void meshkit::native_detail::hashBytes ( std::uint64_t & hash,
const unsigned char * p,
std::size_t n )
inline

Fold bytes into a running 64-bit FNV-1a hash.

Parameters
[in,out]hashRunning hash, updated in place.
[in]pBorrowed bytes; may be null only when n is 0.
[in]nNumber of bytes.
Here is the caller graph for this function:

◆ meets()

bool meshkit::native_detail::meets ( const Box2 & a,
const Box2 & b )
inline

Closed overlap test of two normalized boxes; touching edges or corners count.

Parameters
[in]aFirst box (nonnegative width and height).
[in]bSecond box (nonnegative width and height).
Returns
True when the boxes share at least one point.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ preparePatches()

PreparedPatches meshkit::native_detail::preparePatches ( const JobRequest & r,
const Providers & p,
const std::function< double(const Box2 &)> & maximumSize,
const std::function< double(const Box2 &)> & tolerance,
Work & work,
int attempt )
inline

Plan the request's fixed, authored and automatic quad patches before triangulation.

Outer and hole paths become planning domains and holes, other paths constraint lines, and points on no path become pins. With automatic blocks, a candidate grid over the outer paths' bounding box is sampled from maximumSize and the placed blocks are split into tiles added as background automatic-candidate regions. Fixed patches are validated and assessed. Callbacks run synchronously; their exceptions propagate.

Parameters
[in]rBorrowed job request; paths must index r.points.
[in]pBorrowed providers: cancelled, and with a positive terrain tolerance also elevation and terrainBound, are passed to the planner.
[in]maximumSizeBorrowed footprint size bound in XY units (0 = unbounded).
[in]toleranceBorrowed footprint terrain tolerance in Z units; used only with a positive request terrain tolerance.
[in,out]workBudget charged for planner work and tiles; also gates the result's workspace estimate.
[in]attemptRetry number; not used by this function.
Returns
Owned patches, sources and decisions.
Exceptions
Stopon invalid input (path_index, region_geometry), an invalid or cancelled block grid (planning_grid), fixed quads in triangles-only mode (quad_conflict), planning failure (quad_plan, with the planner's Cancelled/ResourceLimit/Infeasible status), invalid fixed patches (fixed_patch), result counts above the job limits (planning_limit), or from work.
Here is the call graph for this function:

◆ seconds()

double meshkit::native_detail::seconds ( std::chrono::steady_clock::time_point start)
inline

Elapsed steady-clock time.

Parameters
[in]startEarlier steady_clock reading.
Returns
Seconds from start to now.
Here is the caller graph for this function:

◆ setError()

void meshkit::native_detail::setError ( IOReport & r,
const Stop & e )
inline

Copy a caught Stop into a report.

Parameters
[in,out]rReport whose status, code and message are overwritten.
[in]eCaught failure.
Here is the caller graph for this function:

◆ setException() [1/2]

void meshkit::native_detail::setException ( IOReport & r,
const std::bad_alloc &  )
inline

Record an allocation failure: status ResourceLimit, code allocation.

Parameters
[in,out]rReport whose status, code and message are overwritten.
Here is the caller graph for this function:

◆ setException() [2/2]

void meshkit::native_detail::setException ( IOReport & r,
const std::exception & e )
inline

Record any other standard exception: status Failed, code exception.

Parameters
[in,out]rReport whose status, code and message are overwritten.
[in]eCaught exception; its what() text becomes the message.

◆ signed32()

std::int32_t meshkit::native_detail::signed32 ( std::uint64_t bits)
inline

Reinterpret the low 32 bits of a pattern as a two's-complement signed value.

Parameters
[in]bitsBit pattern as read from a file; higher bits are ignored.
Returns
The signed 32-bit value with the same low bits.
Here is the caller graph for this function:

◆ signed64()

std::int64_t meshkit::native_detail::signed64 ( std::uint64_t bits)
inline

Reinterpret a 64-bit pattern as a two's-complement signed value.

Parameters
[in]bitsBit pattern as read from a file.
Returns
The signed value with the same bits.
Here is the caller graph for this function:

◆ utf8()

bool meshkit::native_detail::utf8 ( const std::string & s)
inline

Check that a byte string is well-formed UTF-8.

Parameters
[in]sBytes to check; may be empty or contain NUL.
Returns
False for an invalid lead or continuation byte, a truncated sequence, an overlong encoding, a surrogate (U+D800 to U+DFFF) or a code point above U+10FFFF.
Here is the caller graph for this function:

◆ validated()

void meshkit::native_detail::validated ( const Mesh & mesh,
const IOOptions & o )
inline

Run validateMesh() with the options' limits and cancellation poll.

Parameters
[in]meshBorrowed mesh, unchanged.
[in]oSupplies limits and cancelled.
Exceptions
Stopcarrying the validation report's code, message and status when it is not complete.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ validPath()

bool meshkit::native_detail::validPath ( const std::filesystem::path & p)
inline

Reject empty paths and paths containing an embedded NUL character.

Parameters
[in]pPath to check.
Returns
True when p is non-empty and has no NUL; existence is not checked.
Here is the caller graph for this function:

Variable Documentation

◆ hashSeed

std::uint64_t meshkit::native_detail::hashSeed = 14695981039346656037ull
constexpr

64-bit FNV-1a offset basis, the starting value of every running hash.