Skip to main content

Mesh schema and accessors for structured-array mesh blocks in DataNode trees

Project description

vcti-mesh-schema

Mesh schema and accessors for structured-array mesh blocks in DataNode trees.

Overview

vcti-mesh-schema defines what a mesh subtree looks like: a DataNode subtree whose children carry one structured numpy array per block — a node block with point coordinates (x, y for 2-D meshes, x, y, z for 3-D), and cell blocks (edge, triangle, tetrahedron, ...) with integer node_index* connectivity fields. It is the shared contract that lets mesh readers (fileloader plugins such as vcti-fileloader-slim) and mesh writers (vcti-tree-exporter-mesh) interoperate without depending on each other. There is deliberately no container class — just the vocabulary, and free functions that extract coordinate/connectivity matrices, locate blocks in a tree, and validate conformance.

Installation

pip install vcti-mesh-schema

In requirements.txt

vcti-mesh-schema>=1.0.0

In pyproject.toml dependencies

dependencies = [
    "vcti-mesh-schema>=1.0.0",
]

Quick Start

Work with a block array directly (any structured array with schema fields):

import numpy as np
from vcti.mesh.schema import attribute_fields, connectivity, coordinates

node = np.array(
    [(0.0, 0.0, 0.0, 10), (1.0, 0.0, 0.0, 11), (1.0, 1.0, 0.0, 12)],
    dtype=[("x", "<f8"), ("y", "<f8"), ("z", "<f8"), ("uid", "<i4")],
)
triangle = np.array(
    [(0, 1, 2, 7)],
    dtype=[("node_index0", "<u4"), ("node_index1", "<u4"),
           ("node_index2", "<u4"), ("uid", "<i4")],
)

coordinates(node)            # (3, 3) float64 matrix — (N, 2) for a 2-D mesh
connectivity(triangle)       # (1, 3) int64 matrix, zero-based indices
attribute_fields(node.dtype) # ("uid",) — the per-entity fields
dimension(node.dtype)        # 3 (a block with only x, y fields gives 2)

Work with a mesh subtree produced by a loader:

from vcti.mesh.schema import load_mesh_blocks, validate_mesh_subtree

validate_mesh_subtree(tree, mesh_root)          # raises MeshSchemaError subclass
blocks = load_mesh_blocks(tree, mesh_root)      # {"node": ..., "triangle": ...}
xyz = coordinates(blocks["node"])

Blocks may be lazy (LazyDataNode-style payloads); load_mesh_blocks materialises them through the payload's own load().


API surface

Name Kind Purpose
NODE_BLOCK, COORDINATE_FIELDS, CONNECTIVITY_PREFIX, UID_FIELD constants Schema vocabulary
CELL_NODE_COUNTS mapping Canonical cell types → nodes per cell
dimension(dtype) function Mesh dimension: 2 or 3
coordinates(block) function (N, d) float64 matrix from a point block
connectivity(block) function (M, k) int64 matrix from a cell block
connectivity_fields(dtype) / attribute_fields(dtype) function Field classification
block_array(payload) function Duck-typed (lazy-aware) array access
find_mesh_blocks(tree, root) function Block handles by name
load_mesh_blocks(tree, root) function Block arrays by name
validate_mesh_subtree(tree, root) function Schema conformance check
MeshSchemaError exception Base; BlockNotFoundError, BlockFormatError, ConnectivityError

See docs/schema.md for the normative schema and docs/design.md for the rationale and boundaries.


Dependencies

  • vcti-tree — the tree protocols the accessors walk.
  • numpy — structured-array block access.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vcti_mesh_schema-1.0.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vcti_mesh_schema-1.0.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file vcti_mesh_schema-1.0.0.tar.gz.

File metadata

  • Download URL: vcti_mesh_schema-1.0.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vcti_mesh_schema-1.0.0.tar.gz
Algorithm Hash digest
SHA256 aeaedfebc327dfe1c3284855d8eb51db3ce0f98bc9bf4a904a206dcaa60d01f9
MD5 88cce7389940e792d0b18c0c43bce301
BLAKE2b-256 206b1ac5e90245cff7cc663cb187dca5cf07f989232ed6f3f1bdd4259c2c6398

See more details on using hashes here.

Provenance

The following attestation bundles were made for vcti_mesh_schema-1.0.0.tar.gz:

Publisher: release.yml on vcollab/vcti-python-mesh-schema

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vcti_mesh_schema-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for vcti_mesh_schema-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ecb1d0195bff0090060bc2e8388e5b0c7d9c656c05652e2ff8aec52582ceb88
MD5 e06372e34fce3dbdeec7f9b04fd30ee5
BLAKE2b-256 027365475614b0322b543ea8b65c50f6c1a93a88417f1a4b18cb1cb0eaa0313d

See more details on using hashes here.

Provenance

The following attestation bundles were made for vcti_mesh_schema-1.0.0-py3-none-any.whl:

Publisher: release.yml on vcollab/vcti-python-mesh-schema

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page